From 8311425f376fe7dfae75bf7519299bded4893fce Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 26 Jun 2020 00:56:14 +0200 Subject: [PATCH] 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 Refs: https://github.com/nodejs/node/pull/34057 PR-URL: https://github.com/nodejs/node/pull/34446 Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-worker-terminate-source-map.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-worker-terminate-source-map.js b/test/parallel/test-worker-terminate-source-map.js index d88a4c68366865..8cd40a6607422c 100644 --- a/test/parallel/test-worker-terminate-source-map.js +++ b/test/parallel/test-worker-terminate-source-map.js @@ -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');