Skip to content

Commit

Permalink
test: fixup worker + source map test
Browse files Browse the repository at this point in the history
The messaging code uses `Object.defineProperty()`, which accesses
`value` on `Object.prototype` by default, so some calls to the
getter here would actually be expected. Instead, make the list
of accessed properties more specific to the tested source map
code to avoid flakiness.

Refs: https://twitter.com/addaleax/status/1276289101671608320
Refs: #34057

PR-URL: #34446
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax committed Sep 22, 2020
1 parent 771c3e4 commit 8311425
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/parallel/test-worker-terminate-source-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ Map.prototype.entries = increaseCallCount;
Object.keys = increaseCallCount;
Object.create = increaseCallCount;
Object.hasOwnProperty = increaseCallCount;
Object.defineProperty(Object.prototype, 'value', {
get: increaseCallCount,
set: increaseCallCount
});
for (const property of ['_cache', 'lineLengths', 'url']) {
Object.defineProperty(Object.prototype, property, {
get: increaseCallCount,
set: increaseCallCount
});
}

parentPort.postMessage('done');

0 comments on commit 8311425

Please sign in to comment.