2022-02-09 06:23:36 +01:00
|
|
|
'use strict';
|
2024-04-21 18:53:08 +02:00
|
|
|
|
|
|
|
const {
|
|
|
|
ObjectAssign,
|
|
|
|
ObjectDefineProperty,
|
|
|
|
} = primordials;
|
|
|
|
|
2024-03-19 16:38:17 +01:00
|
|
|
const { test, suite, before, after, beforeEach, afterEach } = require('internal/test_runner/harness');
|
2022-08-15 11:12:11 +02:00
|
|
|
const { run } = require('internal/test_runner/runner');
|
2024-05-18 18:32:41 +02:00
|
|
|
const { getOptionValue } = require('internal/options');
|
2022-02-09 06:23:36 +01:00
|
|
|
|
|
|
|
module.exports = test;
|
2022-08-15 11:12:11 +02:00
|
|
|
ObjectAssign(module.exports, {
|
|
|
|
after,
|
|
|
|
afterEach,
|
|
|
|
before,
|
|
|
|
beforeEach,
|
2024-03-19 16:38:17 +01:00
|
|
|
describe: suite,
|
|
|
|
it: test,
|
2022-08-15 11:12:11 +02:00
|
|
|
run,
|
2024-03-19 16:38:17 +01:00
|
|
|
suite,
|
2022-08-15 11:12:11 +02:00
|
|
|
test,
|
|
|
|
});
|
2022-04-05 00:36:40 +02:00
|
|
|
|
|
|
|
let lazyMock;
|
|
|
|
|
|
|
|
ObjectDefineProperty(module.exports, 'mock', {
|
|
|
|
__proto__: null,
|
|
|
|
configurable: true,
|
|
|
|
enumerable: true,
|
|
|
|
get() {
|
|
|
|
if (lazyMock === undefined) {
|
2023-06-22 06:01:52 +02:00
|
|
|
const { MockTracker } = require('internal/test_runner/mock/mock');
|
2022-04-05 00:36:40 +02:00
|
|
|
|
|
|
|
lazyMock = new MockTracker();
|
|
|
|
}
|
|
|
|
|
|
|
|
return lazyMock;
|
|
|
|
},
|
|
|
|
});
|
2024-05-18 18:32:41 +02:00
|
|
|
|
|
|
|
if (getOptionValue('--experimental-test-snapshots')) {
|
|
|
|
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;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|