0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 03:07:54 +01:00
nodejs/lib/test.js
Colin Ihrig c921676512
test_runner: mark snapshot testing as stable
This commit marks the test runner's snapshot testing API as
stable.

PR-URL: https://github.com/nodejs/node/pull/55897
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2024-11-19 17:37:35 +00:00

64 lines
1.2 KiB
JavaScript

'use strict';
const {
ObjectAssign,
ObjectDefineProperty,
} = primordials;
const { test, suite, before, after, beforeEach, afterEach } = require('internal/test_runner/harness');
const { run } = require('internal/test_runner/runner');
module.exports = test;
ObjectAssign(module.exports, {
after,
afterEach,
before,
beforeEach,
describe: suite,
it: test,
run,
suite,
test,
});
let lazyMock;
ObjectDefineProperty(module.exports, 'mock', {
__proto__: null,
configurable: true,
enumerable: true,
get() {
if (lazyMock === undefined) {
const { MockTracker } = require('internal/test_runner/mock/mock');
lazyMock = new MockTracker();
}
return lazyMock;
},
});
let lazySnapshot;
ObjectDefineProperty(module.exports, 'snapshot', {
__proto__: null,
configurable: true,
enumerable: true,
get() {
if (lazySnapshot === undefined) {
const {
setDefaultSnapshotSerializers,
setResolveSnapshotPath,
} = require('internal/test_runner/snapshot');
lazySnapshot = {
__proto__: null,
setDefaultSnapshotSerializers,
setResolveSnapshotPath,
};
}
return lazySnapshot;
},
});