Skip to content
Prev Previous commit
Next Next commit
test: fixup worker + source map test
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
  • Loading branch information
addaleax committed Jul 20, 2020
commit 37fa7011209a2daf133f5b2ff0834a026a88a9a7
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');