@rspack-canary/test-tools 1.5.7-canary-a3406c0a-20250922173625 → 1.5.8-canary-e350b761-20250924173613

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/case/builtin.d.ts +2 -2
  2. package/dist/case/builtin.js +37 -28
  3. package/dist/case/cache.d.ts +1 -1
  4. package/dist/case/cache.js +135 -42
  5. package/dist/case/common.d.ts +10 -0
  6. package/dist/case/common.js +237 -0
  7. package/dist/case/compiler.d.ts +7 -4
  8. package/dist/case/compiler.js +144 -109
  9. package/dist/case/config.d.ts +3 -2
  10. package/dist/case/config.js +47 -39
  11. package/dist/case/defaults.d.ts +2 -2
  12. package/dist/case/defaults.js +28 -18
  13. package/dist/case/diagnostic.d.ts +1 -1
  14. package/dist/case/diagnostic.js +52 -43
  15. package/dist/case/diff.d.ts +17 -1
  16. package/dist/case/diff.js +170 -22
  17. package/dist/case/error.d.ts +14 -4
  18. package/dist/case/error.js +51 -21
  19. package/dist/case/hash.d.ts +1 -1
  20. package/dist/case/hash.js +41 -34
  21. package/dist/case/hook.d.ts +4 -5
  22. package/dist/case/hook.js +78 -70
  23. package/dist/case/hot-step.d.ts +1 -1
  24. package/dist/case/hot-step.js +9 -5
  25. package/dist/case/hot.d.ts +5 -5
  26. package/dist/case/hot.js +142 -55
  27. package/dist/case/incremental.d.ts +1 -1
  28. package/dist/case/incremental.js +19 -34
  29. package/dist/case/native-watcher.js +10 -23
  30. package/dist/case/normal.js +46 -31
  31. package/dist/case/runner.d.ts +18 -0
  32. package/dist/case/runner.js +108 -0
  33. package/dist/case/serial.d.ts +1 -1
  34. package/dist/case/serial.js +7 -15
  35. package/dist/case/stats-api.js +52 -22
  36. package/dist/case/stats-output.js +133 -137
  37. package/dist/case/treeshaking.js +33 -22
  38. package/dist/case/watch.d.ts +27 -0
  39. package/dist/case/watch.js +321 -21
  40. package/dist/index.d.ts +0 -2
  41. package/dist/index.js +0 -2
  42. package/dist/runner/index.d.ts +2 -7
  43. package/dist/runner/index.js +2 -7
  44. package/dist/runner/{runner/node → node}/index.d.ts +1 -2
  45. package/dist/runner/{runner/node → node}/index.js +2 -2
  46. package/dist/runner/{runner/web → web}/fake.d.ts +1 -2
  47. package/dist/runner/{runner/web → web}/fake.js +7 -7
  48. package/dist/runner/{runner/web → web}/index.d.ts +2 -2
  49. package/dist/runner/{runner/web → web}/index.js +1 -1
  50. package/dist/runner/{runner/web → web}/jsdom.d.ts +1 -2
  51. package/dist/runner/{runner/web → web}/jsdom.js +4 -4
  52. package/dist/test/context.d.ts +3 -5
  53. package/dist/test/context.js +22 -12
  54. package/dist/test/creator.d.ts +13 -12
  55. package/dist/test/creator.js +52 -43
  56. package/dist/test/tester.js +4 -1
  57. package/dist/type.d.ts +41 -10
  58. package/dist/type.js +7 -1
  59. package/package.json +5 -5
  60. package/dist/processor/basic.d.ts +0 -27
  61. package/dist/processor/basic.js +0 -157
  62. package/dist/processor/diff.d.ts +0 -30
  63. package/dist/processor/diff.js +0 -140
  64. package/dist/processor/index.d.ts +0 -6
  65. package/dist/processor/index.js +0 -22
  66. package/dist/processor/multi.d.ts +0 -19
  67. package/dist/processor/multi.js +0 -75
  68. package/dist/processor/simple.d.ts +0 -24
  69. package/dist/processor/simple.js +0 -51
  70. package/dist/processor/snapshot.d.ts +0 -12
  71. package/dist/processor/snapshot.js +0 -67
  72. package/dist/processor/watch.d.ts +0 -30
  73. package/dist/processor/watch.js +0 -252
  74. package/dist/runner/basic.d.ts +0 -10
  75. package/dist/runner/basic.js +0 -64
  76. package/dist/runner/cache.d.ts +0 -5
  77. package/dist/runner/cache.js +0 -92
  78. package/dist/runner/hot.d.ts +0 -5
  79. package/dist/runner/hot.js +0 -91
  80. package/dist/runner/multiple.d.ts +0 -11
  81. package/dist/runner/multiple.js +0 -52
  82. package/dist/runner/runner/index.d.ts +0 -2
  83. package/dist/runner/runner/index.js +0 -18
  84. package/dist/runner/type.d.ts +0 -42
  85. package/dist/runner/type.js +0 -9
  86. package/dist/runner/watch.d.ts +0 -7
  87. package/dist/runner/watch.js +0 -71
  88. package/dist/test/simple.d.ts +0 -5
  89. package/dist/test/simple.js +0 -43
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSerialCase = createSerialCase;
4
- const processor_1 = require("../processor");
5
- const runner_1 = require("../runner");
6
4
  const creator_1 = require("../test/creator");
7
- const type_1 = require("../type");
8
5
  const config_1 = require("./config");
6
+ const runner_1 = require("./runner");
9
7
  const creator = new creator_1.BasicCaseCreator({
10
8
  clean: true,
11
9
  describe: false,
@@ -20,18 +18,12 @@ const creator = new creator_1.BasicCaseCreator({
20
18
  return res;
21
19
  };
22
20
  },
23
- steps: ({ name }) => [
24
- new processor_1.MultiTaskProcessor({
25
- name,
26
- runable: true,
27
- compilerType: type_1.ECompilerType.Rspack,
28
- configFiles: ["rspack.config.js", "webpack.config.js"],
29
- defaultOptions: config_1.defaultOptions,
30
- overrideOptions: config_1.overrideOptions,
31
- findBundle: config_1.findBundle
32
- })
33
- ],
34
- runner: runner_1.MultipleRunnerFactory
21
+ steps: ({ name }) => [(0, config_1.createConfigProcessor)(name)],
22
+ runner: {
23
+ key: runner_1.getMultiCompilerRunnerKey,
24
+ runner: runner_1.createMultiCompilerRunner
25
+ },
26
+ concurrent: false
35
27
  });
36
28
  function createSerialCase(name, src, dist) {
37
29
  creator.create(name, src, dist);
@@ -2,10 +2,55 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStatsAPICase = createStatsAPICase;
4
4
  const memfs_1 = require("memfs");
5
- const processor_1 = require("../processor");
6
- const simple_1 = require("../test/simple");
7
- const type_1 = require("../type");
5
+ const creator_1 = require("../test/creator");
6
+ const common_1 = require("./common");
8
7
  let addedSerializer = false;
8
+ const creator = new creator_1.BasicCaseCreator({
9
+ clean: true,
10
+ describe: true,
11
+ steps: ({ name, caseConfig }) => {
12
+ const config = caseConfig;
13
+ return [
14
+ {
15
+ config: async (context) => {
16
+ const compiler = (0, common_1.getCompiler)(context, name);
17
+ compiler.setOptions(options(context, config.options));
18
+ },
19
+ compiler: async (context) => {
20
+ const compilerManager = (0, common_1.getCompiler)(context, name);
21
+ compilerManager.createCompiler();
22
+ compiler(context, compilerManager.getCompiler(), config.compiler);
23
+ },
24
+ build: async (context) => {
25
+ const compiler = (0, common_1.getCompiler)(context, name);
26
+ if (typeof config.build === "function") {
27
+ await config.build(context, compiler.getCompiler());
28
+ }
29
+ else {
30
+ await compiler.build();
31
+ }
32
+ },
33
+ run: async (env, context) => {
34
+ // no need to run, just check the snapshot of diagnostics
35
+ },
36
+ check: async (env, context) => {
37
+ await check(env, context, name, config.check);
38
+ }
39
+ }
40
+ ];
41
+ },
42
+ concurrent: true
43
+ });
44
+ function createStatsAPICase(name, src, dist, testConfig) {
45
+ if (!addedSerializer) {
46
+ addedSerializer = true;
47
+ }
48
+ const caseConfig = require(testConfig);
49
+ creator.create(name, src, dist, undefined, {
50
+ caseConfig,
51
+ description: () => caseConfig.description
52
+ });
53
+ }
9
54
  function options(context, custom) {
10
55
  const res = (custom?.(context) ||
11
56
  {});
@@ -29,24 +74,9 @@ async function compiler(context, compiler, custom) {
29
74
  compiler.outputFileSystem = (0, memfs_1.createFsFromVolume)(new memfs_1.Volume());
30
75
  }
31
76
  }
32
- async function check(env, context, compiler, stats, custom) {
77
+ async function check(env, context, name, custom) {
78
+ const manager = (0, common_1.getCompiler)(context, name);
79
+ const stats = manager.getStats();
33
80
  env.expect(typeof stats).toBe("object");
34
- await custom?.(stats, compiler);
35
- }
36
- function createStatsAPICase(name, src, dist, testConfig) {
37
- if (!addedSerializer) {
38
- addedSerializer = true;
39
- }
40
- const caseConfig = require(testConfig);
41
- const runner = (0, simple_1.getSimpleProcessorRunner)(src, dist);
42
- it(caseConfig.description, async () => {
43
- await runner(name, new processor_1.SimpleTaskProcessor({
44
- name: name,
45
- compilerType: type_1.ECompilerType.Rspack,
46
- options: context => options(context, caseConfig.options),
47
- compiler: (context, c) => compiler(context, c, caseConfig.compiler),
48
- build: caseConfig.build,
49
- check: (env, context, compiler, stats) => check(env, context, compiler, stats, caseConfig.check)
50
- }));
51
- });
81
+ await custom?.(stats, manager.getCompiler());
52
82
  }
@@ -8,10 +8,47 @@ const node_path_1 = __importDefault(require("node:path"));
8
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  const placeholder_1 = require("../helper/expect/placeholder");
10
10
  const captureStdio_1 = __importDefault(require("../helper/legacy/captureStdio"));
11
- const processor_1 = require("../processor");
12
11
  const creator_1 = require("../test/creator");
13
- const type_1 = require("../type");
12
+ const common_1 = require("./common");
14
13
  const REG_ERROR_CASE = /error$/;
14
+ function createStatsProcessor(name) {
15
+ const writeStatsOuptut = false;
16
+ const snapshotName = "stats.txt";
17
+ let stderr = null;
18
+ return {
19
+ before: async (context) => {
20
+ stderr = (0, captureStdio_1.default)(process.stderr, true);
21
+ },
22
+ config: async (context) => {
23
+ (0, common_1.configMultiCompiler)(context, name, ["rspack.config.js", "webpack.config.js"], defaultOptions, overrideOptions);
24
+ },
25
+ compiler: async (context) => {
26
+ const c = await (0, common_1.compiler)(context, name);
27
+ await statsCompiler(context, c);
28
+ },
29
+ build: async (context) => {
30
+ await (0, common_1.build)(context, name);
31
+ },
32
+ run: async (env, context) => {
33
+ // no need to run, just check snapshot
34
+ },
35
+ check: async (env, context) => {
36
+ await check(env, context, name, writeStatsOuptut, snapshotName, stderr);
37
+ },
38
+ after: async (context) => {
39
+ stderr.restore();
40
+ }
41
+ };
42
+ }
43
+ const creator = new creator_1.BasicCaseCreator({
44
+ clean: true,
45
+ describe: false,
46
+ steps: ({ name }) => [createStatsProcessor(name)],
47
+ description: () => "should print correct stats for"
48
+ });
49
+ function createStatsOutputCase(name, src, dist) {
50
+ creator.create(name, src, dist);
51
+ }
15
52
  function defaultOptions(index, context) {
16
53
  if (fs_extra_1.default.existsSync(node_path_1.default.join(context.getSource(), "rspack.config.js"))) {
17
54
  return {
@@ -73,141 +110,100 @@ class RspackStats {
73
110
  this.value = value;
74
111
  }
75
112
  }
76
- function createStatsProcessor(name) {
77
- const writeStatsOuptut = false;
78
- const snapshotName = "stats.txt";
79
- const processor = new processor_1.MultiTaskProcessor({
80
- name,
81
- compilerType: type_1.ECompilerType.Rspack,
82
- configFiles: ["rspack.config.js", "webpack.config.js"],
83
- runable: false,
84
- defaultOptions: (index, context) => defaultOptions(index, context),
85
- overrideOptions: (index, context, options) => overrideOptions(index, context, options),
86
- async check(env, context, compiler, stats) {
87
- if (!stats || !compiler)
88
- return;
89
- for (const compilation of []
90
- .concat(stats.stats || stats)
91
- .map((s) => s.compilation)) {
92
- compilation.logging.delete("webpack.Compilation.ModuleProfile");
93
- }
94
- if (REG_ERROR_CASE.test(name)) {
95
- env.expect(stats.hasErrors()).toBe(true);
96
- }
97
- else if (stats.hasErrors()) {
98
- throw new Error(stats.toString({
99
- all: false,
100
- errors: true
101
- // errorStack: true,
102
- // errorDetails: true
103
- }));
104
- }
105
- else if (writeStatsOuptut) {
106
- fs_extra_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
107
- preset: "verbose",
108
- // context: context.getSource(),
109
- colors: false
110
- }), "utf-8");
111
- }
112
- let toStringOptions = {
113
- context: context.getSource(),
114
- colors: false
115
- };
116
- let hasColorSetting = false;
117
- if (typeof compiler.options.stats !== "undefined") {
118
- toStringOptions = compiler.options.stats;
119
- if (toStringOptions === null || typeof toStringOptions !== "object")
120
- toStringOptions = { preset: toStringOptions };
121
- if (!toStringOptions.context)
122
- toStringOptions.context = context.getSource();
123
- hasColorSetting = typeof toStringOptions.colors !== "undefined";
124
- }
125
- if (Array.isArray(compiler.options) && !toStringOptions.children) {
126
- toStringOptions.children = compiler.options.map(o => o.stats);
127
- }
128
- // mock timestamps
129
- for (const { compilation: s } of [].concat(stats.stats || stats)) {
130
- env.expect(s.startTime).toBeGreaterThan(0);
131
- env.expect(s.endTime).toBeGreaterThan(0);
132
- s.endTime = new Date("04/20/1970, 12:42:42 PM").getTime();
133
- s.startTime = s.endTime - 1234;
134
- }
135
- let actual = stats.toString(toStringOptions);
136
- env.expect(typeof actual).toBe("string");
137
- actual = stderr.toString() + actual;
138
- if (!hasColorSetting) {
139
- actual = actual
140
- .replace(/\u001b\[[0-9;]*m/g, "")
141
- // CHANGE: The time unit display in Rspack is second
142
- .replace(/[.0-9]+(\s?s)/g, "X$1")
143
- // CHANGE: Replace bundle size, since bundle sizes may differ between platforms
144
- .replace(/[0-9]+\.?[0-9]+ KiB/g, "xx KiB");
145
- }
146
- const snapshotPath = node_path_1.default.isAbsolute(snapshotName)
147
- ? snapshotName
148
- : node_path_1.default.resolve(context.getSource(), `./__snapshots__/${snapshotName}`);
149
- env.expect(new RspackStats(actual)).toMatchFileSnapshot(snapshotPath);
150
- const testConfig = context.getTestConfig();
151
- if (typeof testConfig?.validate === "function") {
152
- testConfig.validate(stats, stderr.toString());
153
- }
154
- },
155
- async compiler(context, compiler) {
156
- const compilers = compiler.compilers
157
- ? compiler.compilers
158
- : [compiler];
159
- for (const compiler of compilers) {
160
- if (!compiler.inputFileSystem) {
161
- continue;
162
- }
163
- const ifs = compiler.inputFileSystem;
164
- const inputFileSystem = Object.create(ifs);
165
- compiler.inputFileSystem = inputFileSystem;
166
- inputFileSystem.readFile = (...args) => {
167
- const callback = args.pop();
168
- ifs.readFile.apply(ifs, args.concat([
169
- (err, result) => {
170
- if (err)
171
- return callback(err);
172
- if (!/\.(js|json|txt)$/.test(args[0]))
173
- return callback(null, result);
174
- callback(null, (0, placeholder_1.normalizePlaceholder)(result.toString("utf-8")));
175
- }
176
- ]));
177
- };
178
- // CHANGE: The checkConstraints() function is currently not implemented in rspack
179
- // compiler.hooks.compilation.tap("StatsTestCasesTest", compilation => {
180
- // [
181
- // "optimize",
182
- // "optimizeModules",
183
- // "optimizeChunks",
184
- // "afterOptimizeTree",
185
- // "afterOptimizeAssets",
186
- // "beforeHash"
187
- // ].forEach(hook => {
188
- // compilation.hooks[hook].tap("TestCasesTest", () =>
189
- // compilation.checkConstraints()
190
- // );
191
- // });
192
- // });
193
- }
194
- }
195
- });
196
- let stderr;
197
- processor.before = async (context) => {
198
- stderr = (0, captureStdio_1.default)(process.stderr, true);
199
- };
200
- processor.after = async (context) => {
201
- stderr.restore();
113
+ async function check(env, context, name, writeStatsOuptut, snapshot, stderr) {
114
+ const compiler = (0, common_1.getCompiler)(context, name);
115
+ const options = compiler.getOptions();
116
+ const stats = compiler.getStats();
117
+ if (!stats || !compiler)
118
+ return;
119
+ for (const compilation of []
120
+ .concat(stats.stats || stats)
121
+ .map((s) => s.compilation)) {
122
+ compilation.logging.delete("webpack.Compilation.ModuleProfile");
123
+ }
124
+ if (REG_ERROR_CASE.test(name)) {
125
+ env.expect(stats.hasErrors()).toBe(true);
126
+ }
127
+ else if (stats.hasErrors()) {
128
+ throw new Error(stats.toString({
129
+ all: false,
130
+ errors: true
131
+ // errorStack: true,
132
+ // errorDetails: true
133
+ }));
134
+ }
135
+ else if (writeStatsOuptut) {
136
+ fs_extra_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
137
+ preset: "verbose",
138
+ // context: context.getSource(),
139
+ colors: false
140
+ }), "utf-8");
141
+ }
142
+ let toStringOptions = {
143
+ context: context.getSource(),
144
+ colors: false
202
145
  };
203
- return processor;
146
+ let hasColorSetting = false;
147
+ if (typeof options.stats !== "undefined") {
148
+ toStringOptions = options.stats;
149
+ if (toStringOptions === null || typeof toStringOptions !== "object")
150
+ toStringOptions = { preset: toStringOptions };
151
+ if (!toStringOptions.context)
152
+ toStringOptions.context = context.getSource();
153
+ hasColorSetting = typeof toStringOptions.colors !== "undefined";
154
+ }
155
+ if (Array.isArray(options) && !toStringOptions.children) {
156
+ toStringOptions.children = options.map(o => o.stats);
157
+ }
158
+ // mock timestamps
159
+ for (const { compilation: s } of [].concat(stats.stats || stats)) {
160
+ env.expect(s.startTime).toBeGreaterThan(0);
161
+ env.expect(s.endTime).toBeGreaterThan(0);
162
+ s.endTime = new Date("04/20/1970, 12:42:42 PM").getTime();
163
+ s.startTime = s.endTime - 1234;
164
+ }
165
+ let actual = stats.toString(toStringOptions);
166
+ env.expect(typeof actual).toBe("string");
167
+ actual = stderr.toString() + actual;
168
+ if (!hasColorSetting) {
169
+ actual = actual
170
+ .replace(/\u001b\[[0-9;]*m/g, "")
171
+ // CHANGE: The time unit display in Rspack is second
172
+ .replace(/[.0-9]+(\s?s)/g, "X$1")
173
+ // CHANGE: Replace bundle size, since bundle sizes may differ between platforms
174
+ .replace(/[0-9]+\.?[0-9]+ KiB/g, "xx KiB");
175
+ }
176
+ const snapshotPath = node_path_1.default.isAbsolute(snapshot)
177
+ ? snapshot
178
+ : node_path_1.default.resolve(context.getSource(), `./__snapshots__/${snapshot}`);
179
+ env.expect(new RspackStats(actual)).toMatchFileSnapshot(snapshotPath);
180
+ const testConfig = context.getTestConfig();
181
+ if (typeof testConfig?.validate === "function") {
182
+ testConfig.validate(stats, stderr.toString());
183
+ }
204
184
  }
205
- const creator = new creator_1.BasicCaseCreator({
206
- clean: true,
207
- describe: false,
208
- steps: ({ name }) => [createStatsProcessor(name)],
209
- description: () => "should print correct stats for"
210
- });
211
- function createStatsOutputCase(name, src, dist) {
212
- creator.create(name, src, dist);
185
+ async function statsCompiler(context, compiler) {
186
+ const compilers = compiler.compilers
187
+ ? compiler.compilers
188
+ : [compiler];
189
+ for (const compiler of compilers) {
190
+ if (!compiler.inputFileSystem) {
191
+ continue;
192
+ }
193
+ const ifs = compiler.inputFileSystem;
194
+ const inputFileSystem = Object.create(ifs);
195
+ compiler.inputFileSystem = inputFileSystem;
196
+ inputFileSystem.readFile = (...args) => {
197
+ const callback = args.pop();
198
+ ifs.readFile.apply(ifs, args.concat([
199
+ (err, result) => {
200
+ if (err)
201
+ return callback(err);
202
+ if (!/\.(js|json|txt)$/.test(args[0]))
203
+ return callback(null, result);
204
+ callback(null, (0, placeholder_1.normalizePlaceholder)(result.toString("utf-8")));
205
+ }
206
+ ]));
207
+ };
208
+ }
213
209
  }
@@ -1,22 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTreeShakingCase = createTreeShakingCase;
4
- const processor_1 = require("../processor");
5
4
  const creator_1 = require("../test/creator");
6
- const type_1 = require("../type");
7
5
  const builtin_1 = require("./builtin");
8
- function overrideOptions(context, options) {
9
- options.target = options.target || ["web", "es2022"];
10
- options.optimization ??= {};
11
- options.optimization.providedExports = true;
12
- options.optimization.innerGraph = true;
13
- options.optimization.usedExports = true;
14
- if (!global.printLogger) {
15
- options.infrastructureLogging = {
16
- level: "error"
17
- };
18
- }
19
- }
6
+ const common_1 = require("./common");
20
7
  const creator = new creator_1.BasicCaseCreator({
21
8
  clean: true,
22
9
  describe: false,
@@ -24,16 +11,40 @@ const creator = new creator_1.BasicCaseCreator({
24
11
  return `${name} with newTreeshaking should match snapshot`;
25
12
  },
26
13
  steps: ({ name }) => [
27
- new processor_1.SnapshotProcessor({
28
- name,
29
- snapshot: "treeshaking.snap.txt",
30
- compilerType: type_1.ECompilerType.Rspack,
31
- runable: false,
32
- defaultOptions: builtin_1.defaultOptions,
33
- overrideOptions
34
- })
14
+ {
15
+ config: async (context) => {
16
+ const compiler = (0, common_1.getCompiler)(context, name);
17
+ const options = (0, builtin_1.defaultOptions)(context);
18
+ overrideOptions(context, options);
19
+ compiler.setOptions(options);
20
+ },
21
+ compiler: async (context) => {
22
+ await (0, common_1.compiler)(context, name);
23
+ },
24
+ build: async (context) => {
25
+ await (0, common_1.build)(context, name);
26
+ },
27
+ run: async (env, context) => {
28
+ // no need to run, just check snapshot
29
+ },
30
+ check: async (env, context) => {
31
+ await (0, common_1.checkSnapshot)(env, context, name, "treeshaking.snap.txt");
32
+ }
33
+ }
35
34
  ]
36
35
  });
37
36
  function createTreeShakingCase(name, src, dist) {
38
37
  creator.create(name, src, dist);
39
38
  }
39
+ function overrideOptions(context, options) {
40
+ options.target = options.target || ["web", "es2022"];
41
+ options.optimization ??= {};
42
+ options.optimization.providedExports = true;
43
+ options.optimization.innerGraph = true;
44
+ options.optimization.usedExports = true;
45
+ if (!global.printLogger) {
46
+ options.infrastructureLogging = {
47
+ level: "error"
48
+ };
49
+ }
50
+ }
@@ -1 +1,28 @@
1
+ import { type ECompilerType, type ITestContext, type ITestEnv, type ITestRunner } from "../type";
2
+ export declare function createWatchInitialProcessor(name: string, tempDir: string, step: string, watchState: Record<string, any>, { incremental, nativeWatcher, ignoreNotFriendlyForIncrementalWarnings }?: {
3
+ incremental?: boolean | undefined;
4
+ nativeWatcher?: boolean | undefined;
5
+ ignoreNotFriendlyForIncrementalWarnings?: boolean | undefined;
6
+ }): {
7
+ before: (context: ITestContext) => Promise<void>;
8
+ config: <T extends ECompilerType.Rspack>(context: ITestContext) => Promise<void>;
9
+ compiler: (context: ITestContext) => Promise<void>;
10
+ build: (context: ITestContext) => Promise<void>;
11
+ run: (env: ITestEnv, context: ITestContext) => Promise<void>;
12
+ check: <T extends ECompilerType.Rspack>(env: ITestEnv, context: ITestContext) => Promise<void>;
13
+ };
14
+ export declare function createWatchStepProcessor(name: string, tempDir: string, step: string, watchState: Record<string, any>, { incremental, nativeWatcher, ignoreNotFriendlyForIncrementalWarnings }?: {
15
+ incremental?: boolean | undefined;
16
+ nativeWatcher?: boolean | undefined;
17
+ ignoreNotFriendlyForIncrementalWarnings?: boolean | undefined;
18
+ }): {
19
+ before: (context: ITestContext) => Promise<void>;
20
+ config: <T extends ECompilerType.Rspack>(context: ITestContext) => Promise<void>;
21
+ compiler: (context: ITestContext) => Promise<void>;
22
+ build: (context: ITestContext) => Promise<void>;
23
+ run: (env: ITestEnv, context: ITestContext) => Promise<void>;
24
+ check: <T extends ECompilerType.Rspack>(env: ITestEnv, context: ITestContext) => Promise<void>;
25
+ };
1
26
  export declare function createWatchCase(name: string, src: string, dist: string, temp: string): void;
27
+ export declare function getWatchRunnerKey(context: ITestContext, name: string, file: string): string;
28
+ export declare function createWatchRunner<T extends ECompilerType = ECompilerType.Rspack>(context: ITestContext, name: string, file: string, env: ITestEnv): ITestRunner;