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: nodejs#34057
  • Loading branch information
addaleax committed Jul 20, 2020
1 parent 01bd810 commit f23670e
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 f23670e

Please sign in to comment.