nstdlib-nightly
Version:
Node.js standard library converted to runtime-agnostic ES modules.
69 lines (58 loc) • 1.57 kB
JavaScript
// Source: https://github.com/nodejs/node/blob/65eff1eb/lib/test.js
import * as __hoisted_internal_test_runner_snapshot__ from "nstdlib/lib/internal/test_runner/snapshot";
import {
test,
suite,
before,
after,
beforeEach,
afterEach,
} from "nstdlib/lib/internal/test_runner/harness";
import { run } from "nstdlib/lib/internal/test_runner/runner";
import { getOptionValue } from "nstdlib/lib/internal/options";
import * as __hoisted_internal_test_runner_mock_mock__ from "nstdlib/lib/internal/test_runner/mock/mock";
export default test;
Object.assign(module.exports, {
after,
afterEach,
before,
beforeEach,
describe: suite,
it: test,
run,
suite,
test,
});
let lazyMock;
Object.defineProperty(module.exports, "mock", {
__proto__: null,
configurable: true,
enumerable: true,
get() {
if (lazyMock === undefined) {
const { MockTracker } = __hoisted_internal_test_runner_mock_mock__;
lazyMock = new MockTracker();
}
return lazyMock;
},
});
if (getOptionValue("--experimental-test-snapshots")) {
let lazySnapshot;
Object.defineProperty(module.exports, "snapshot", {
__proto__: null,
configurable: true,
enumerable: true,
get() {
if (lazySnapshot === undefined) {
const { setDefaultSnapshotSerializers, setResolveSnapshotPath } =
__hoisted_internal_test_runner_snapshot__;
lazySnapshot = {
__proto__: null,
setDefaultSnapshotSerializers,
setResolveSnapshotPath,
};
}
return lazySnapshot;
},
});
}