|
7 | 7 |
|
8 | 8 | // Mock requireOrError to provide a fake @rspack/core (v2 is pure ESM, can't be require()'d by Jest) |
9 | 9 | jest.mock("../../package/utils/requireOrError", () => { |
10 | | - const CssExtractRspackPlugin = jest.fn(function (options) { |
11 | | - this.options = options |
12 | | - }) |
| 10 | + const CssExtractRspackPlugin = jest.fn( |
| 11 | + function CssExtractRspackPluginMock(options) { |
| 12 | + this.options = options |
| 13 | + } |
| 14 | + ) |
13 | 15 | CssExtractRspackPlugin.loader = "css-extract-rspack-loader" |
14 | 16 |
|
15 | 17 | return { |
16 | 18 | requireOrError: (moduleName) => { |
17 | 19 | if (moduleName === "@rspack/core") { |
18 | 20 | return { |
19 | | - DefinePlugin: jest.fn(function (definitions) { |
| 21 | + DefinePlugin: jest.fn(function DefinePluginMock(definitions) { |
20 | 22 | this.definitions = definitions |
21 | 23 | }), |
22 | | - EnvironmentPlugin: jest.fn(function (env) { |
| 24 | + EnvironmentPlugin: jest.fn(function EnvironmentPluginMock(env) { |
23 | 25 | this.env = env |
24 | 26 | }), |
25 | | - ProvidePlugin: jest.fn(function (definitions) { |
| 27 | + ProvidePlugin: jest.fn(function ProvidePluginMock(definitions) { |
26 | 28 | this.definitions = definitions |
27 | 29 | }), |
28 | 30 | HotModuleReplacementPlugin: jest.fn(), |
29 | 31 | ProgressPlugin: jest.fn(), |
30 | 32 | CssExtractRspackPlugin, |
31 | | - SubresourceIntegrityPlugin: jest.fn(function (options) { |
32 | | - this.options = options |
33 | | - }), |
| 33 | + SubresourceIntegrityPlugin: jest.fn( |
| 34 | + function SubresourceIntegrityPluginMock(options) { |
| 35 | + this.options = options |
| 36 | + } |
| 37 | + ), |
34 | 38 | SwcJsMinimizerRspackPlugin: jest.fn(), |
35 | 39 | LightningCssMinimizerRspackPlugin: jest.fn() |
36 | 40 | } |
|
0 commit comments