esmocha
Version:
[Mocha](https://mochajs.org) wrapper with built-in [typescript](https://github.com/node-loaders/loaders/tree/main/workspaces/esbuild), built-in [expect](https://jestjs.io/docs/expect) with [mock](https://github.com/node-loaders/loaders/tree/main/workspace
23 lines • 920 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Module = require('node:module');
const process = require('node:process');
const { pathToFileURL } = require('node:url');
/** @type {import('mocha').RootHookObject} */
const snapshotHooks = require('mocha-expect-snapshot').mochaHooks;
Module.register(pathToFileURL(require.resolve('@node-loaders/esbuild/strict')));
if ('setSourceMapsEnabled' in process && typeof Error.prepareStackTrace !== 'function') {
process.setSourceMapsEnabled(true);
}
/** @type {import('mocha').RootHookObject} */
const mochaHooks = {
...snapshotHooks,
async afterAll(...arguments_) {
const { reset, restoreAllMocks } = await import('./jest-mock.js');
reset(true);
restoreAllMocks();
await snapshotHooks.afterAll?.call(this, ...arguments_);
},
};
module.exports = { mochaHooks };
//# sourceMappingURL=mocha.cjs.map