node/test/fixtures/test-runner/output/coverage-with-mock.mjs
Shima Ryuhei 220f5c644e
test: exclude mock from coverage
Fixes: https://github.com/nodejs/node/issues/59112
PR-URL: https://github.com/nodejs/node/pull/59348
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2025-08-11 05:49:53 +00:00

17 lines
475 B
JavaScript

import { describe, it, mock } from 'node:test';
describe('module test with mock', async () => {
mock.module('../coverage-with-mock/sum.js', {
namedExports: {
sum: (a, b) => 1,
getData: () => ({}),
},
});
const { theModuleSum, theModuleGetData } = await import('../coverage-with-mock/module.js');
it('tests correct thing', (t) => {
t.assert.strictEqual(theModuleSum(1, 2), 1);
t.assert.deepStrictEqual(theModuleGetData(), {});
});
});