mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test_runner: fix lazy test.assert accessor
PR-URL: https://github.com/nodejs/node/pull/61097 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Aviv Keller <me@aviv.sh>
This commit is contained in:
12
lib/test.js
12
lib/test.js
@@ -62,14 +62,18 @@ ObjectDefineProperty(module.exports, 'snapshot', {
|
||||
},
|
||||
});
|
||||
|
||||
let lazyAssert;
|
||||
|
||||
ObjectDefineProperty(module.exports, 'assert', {
|
||||
__proto__: null,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
const { register } = require('internal/test_runner/assert');
|
||||
const assert = { __proto__: null, register };
|
||||
ObjectDefineProperty(module.exports, 'assert', assert);
|
||||
return assert;
|
||||
if (lazyAssert === undefined) {
|
||||
const { register } = require('internal/test_runner/assert');
|
||||
lazyAssert = { __proto__: null, register };
|
||||
}
|
||||
|
||||
return lazyAssert;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user