Skip to main content

method MockTracker.prototype.module

unstable
#MockTracker.prototype.module(
specifier: string,
): MockModuleContext

This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules. Any references to the original module prior to mocking are not impacted.

Only available through the --experimental-test-module-mocks flag.

Parameters #

#specifier: string

A string identifying the module to mock.

#options: MockModuleOptions
optional

Optional configuration options for the mock module.

Return Type #

Did you find what you needed?

Privacy policy