mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-10-26 05:25:05 +00:00
run-test: pass --experimental-test-module-mocks through to node
Specs that replace a module need mock.module from node:test, which Node only exposes behind this flag. The runner rejected unknown flags, so there was no way to turn it on. It is now accepted and forwarded to node like --import and --require. The repo's own test run enables it, and a spec checks that a module registered as a mock is what a later dynamic import receives.
This commit is contained in:
1 parent
15747fde74
commit
2e3c47bbd7
4 files changed
+25
-1
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017-2026 @pezkuwi/dev-test authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { mock } from 'node:test';
|
||||
|
||||
describe('mock.module', () => {
|
||||
it('replaces a module loaded after the mock is registered', async () => {
|
||||
mock.module('node:os', { namedExports: { platform: () => 'mocked' } });
|
||||
|
||||
const { platform } = await import('node:os');
|
||||
|
||||
expect(platform()).toBe('mocked');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user