test_runner: fix lazy test.assert accessor
Some checks failed
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-nix (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` with invalid message (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
V8 patch update / v8-update (push) Has been cancelled
OpenSSL update / openssl-update (push) Has been cancelled
Timezone update / timezone_update (push) Has been cancelled

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:
René 2025-12-20 18:54:32 +00:00 committed by GitHub
parent 79d695356a
commit 3b7477c4d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
},
});