module

fun module(specifier: String, options: MockModuleOptions = definedExternally): MockModuleContext(source)

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.

Since

v22.3.0

Parameters

specifier

A string identifying the module to mock.

options

Optional configuration options for the mock module.