@rspack-debug/test-tools 1.6.6 → 1.7.0-beta.0

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.
@@ -123,6 +123,7 @@ function defaultOptions(context) {
123
123
  chunkIds: "named",
124
124
  sideEffects: false,
125
125
  mangleExports: false,
126
+ inlineExports: false,
126
127
  usedExports: false,
127
128
  concatenateModules: false,
128
129
  nodeEnv: false
@@ -13,7 +13,6 @@ const runner_1 = require("../runner");
13
13
  const creator_1 = require("../test/creator");
14
14
  const common_1 = require("./common");
15
15
  const runner_2 = require("./runner");
16
- const MAX_COMPILER_INDEX = 100;
17
16
  function createCacheProcessor(name, src, temp, target) {
18
17
  const updatePlugin = new hot_update_1.HotUpdatePlugin(src, temp);
19
18
  return {
@@ -23,9 +22,7 @@ function createCacheProcessor(name, src, temp, target) {
23
22
  },
24
23
  config: async (context) => {
25
24
  const compiler = context.getCompiler();
26
- let options = defaultOptions(context, temp, target);
27
- options = await (0, common_1.config)(context, name, ["rspack.config.js", "webpack.config.js"].map(i => node_path_1.default.resolve(temp, i)), options);
28
- overrideOptions(options, temp, target, updatePlugin);
25
+ const options = await generateOptions(context, temp, target, updatePlugin);
29
26
  compiler.setOptions(options);
30
27
  },
31
28
  compiler: async (context) => {
@@ -75,8 +72,8 @@ function createCacheCase(name, src, dist, target, temp) {
75
72
  creator.create(name, src, dist, temp);
76
73
  }
77
74
  const creators = new Map();
78
- function defaultOptions(context, temp, target) {
79
- const options = {
75
+ async function generateOptions(context, temp, target, updatePlugin) {
76
+ let options = {
80
77
  context: temp,
81
78
  mode: "production",
82
79
  cache: true,
@@ -99,15 +96,13 @@ function defaultOptions(context, temp, target) {
99
96
  bundlerInfo: {
100
97
  force: false
101
98
  }
102
- },
103
- inlineConst: true
99
+ }
104
100
  }
105
101
  };
106
102
  options.plugins ??= [];
107
103
  options.plugins.push(new core_1.default.HotModuleReplacementPlugin());
108
- return options;
109
- }
110
- function overrideOptions(options, temp, target, updatePlugin) {
104
+ options = await (0, common_1.config)(context, "cacheCase", ["rspack.config.js", "webpack.config.js"].map(i => node_path_1.default.resolve(temp, i)), options);
105
+ // overwrite
111
106
  if (!options.entry) {
112
107
  options.entry = "./index.js";
113
108
  }
@@ -127,6 +122,7 @@ function overrideOptions(options, temp, target, updatePlugin) {
127
122
  level: "error"
128
123
  };
129
124
  }
125
+ return options;
130
126
  }
131
127
  function findBundle(name, target, context) {
132
128
  const files = [];
@@ -181,6 +177,7 @@ function createRunner(context, name, file, env) {
181
177
  moduleScope.COMPILER_INDEX = compilerIndex;
182
178
  moduleScope.NEXT_HMR = nextHmr;
183
179
  moduleScope.NEXT_START = nextStart;
180
+ moduleScope.NEXT_MOVE_DIR_START = nextMoveDirStart;
184
181
  return moduleScope;
185
182
  }
186
183
  },
@@ -189,19 +186,19 @@ function createRunner(context, name, file, env) {
189
186
  compilerOptions: options
190
187
  });
191
188
  };
189
+ const checkStats = async (stats) => {
190
+ const compilerOptions = compiler.getOptions();
191
+ const updateIndex = updatePlugin.getUpdateIndex();
192
+ await (0, checkArrayExpectation_1.default)(source, stats, "error", `errors${updateIndex}`, "Error", compilerOptions);
193
+ await (0, checkArrayExpectation_1.default)(source, stats, "warning", `warnings${updateIndex}`, "Warning", compilerOptions);
194
+ };
192
195
  const nextHmr = async (m, options) => {
193
196
  await updatePlugin.goNext();
194
197
  const stats = await compiler.build();
195
- if (!stats) {
196
- throw new Error("Should generate stats during build");
197
- }
198
198
  const jsonStats = stats.toJson({
199
199
  // errorDetails: true
200
200
  });
201
- const compilerOptions = compiler.getOptions();
202
- const updateIndex = updatePlugin.getUpdateIndex();
203
- await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error", compilerOptions);
204
- await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning", compilerOptions);
201
+ await checkStats(jsonStats);
205
202
  const updatedModules = await m.hot.check(options || true);
206
203
  if (!updatedModules) {
207
204
  throw new Error("No update available");
@@ -210,24 +207,33 @@ function createRunner(context, name, file, env) {
210
207
  };
211
208
  const nextStart = async () => {
212
209
  await compiler.close();
210
+ await updatePlugin.goNext();
211
+ compilerIndex++;
213
212
  compiler.createCompiler();
213
+ const stats = await compiler.build();
214
+ const jsonStats = stats.toJson({
215
+ // errorDetails: true
216
+ });
217
+ await checkStats(jsonStats);
218
+ env.it(`NEXT_START run with compilerIndex==${compilerIndex}`, async () => {
219
+ return getWebRunner().run(file);
220
+ });
221
+ return jsonStats;
222
+ };
223
+ const nextMoveDirStart = async () => {
224
+ await compiler.close();
225
+ const tempDir = await updatePlugin.moveTempDir();
226
+ const options = await generateOptions(context, tempDir, compiler.getOptions().target, updatePlugin);
227
+ compiler.setOptions(options);
214
228
  await updatePlugin.goNext();
229
+ compilerIndex++;
230
+ compiler.createCompiler();
215
231
  const stats = await compiler.build();
216
- if (!stats) {
217
- throw new Error("Should generate stats during build");
218
- }
219
232
  const jsonStats = stats.toJson({
220
233
  // errorDetails: true
221
234
  });
222
- const compilerOptions = compiler.getOptions();
223
- const updateIndex = updatePlugin.getUpdateIndex();
224
- await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error", compilerOptions);
225
- await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning", compilerOptions);
226
- env.it(`NEXT_START run with compilerIndex==${compilerIndex + 1}`, async () => {
227
- if (compilerIndex > MAX_COMPILER_INDEX) {
228
- throw new Error("NEXT_START has been called more than the maximum times");
229
- }
230
- compilerIndex++;
235
+ await checkStats(jsonStats);
236
+ env.it(`NEXT_MOVE_DIR_START run with compilerIndex==${compilerIndex}`, async () => {
231
237
  return getWebRunner().run(file);
232
238
  });
233
239
  return jsonStats;
@@ -79,8 +79,7 @@ function defaultOptions(index, context) {
79
79
  bundlerInfo: {
80
80
  force: false
81
81
  }
82
- },
83
- inlineConst: true
82
+ }
84
83
  }
85
84
  };
86
85
  }
@@ -82,8 +82,7 @@ function defaultOptions(context) {
82
82
  bundlerInfo: {
83
83
  force: false
84
84
  }
85
- },
86
- inlineConst: true
85
+ }
87
86
  }
88
87
  };
89
88
  }
package/dist/case/hash.js CHANGED
@@ -52,8 +52,7 @@ function defaultOptions(index, context) {
52
52
  bundlerInfo: {
53
53
  force: false
54
54
  }
55
- },
56
- inlineConst: true
55
+ }
57
56
  }
58
57
  };
59
58
  }
package/dist/case/hook.js CHANGED
@@ -213,8 +213,7 @@ function defaultOptions(context, custom) {
213
213
  bundlerInfo: {
214
214
  force: false
215
215
  }
216
- },
217
- inlineConst: true
216
+ }
218
217
  }
219
218
  };
220
219
  if (custom) {
package/dist/case/hot.js CHANGED
@@ -110,8 +110,7 @@ function defaultOptions(context, target) {
110
110
  bundlerInfo: {
111
111
  force: false
112
112
  }
113
- },
114
- inlineConst: true
113
+ }
115
114
  }
116
115
  };
117
116
  options.plugins ??= [];
@@ -111,6 +111,7 @@ function defaultOptions(context, compilerOptions, mode) {
111
111
  providedExports: true,
112
112
  usedExports: true,
113
113
  mangleExports: true,
114
+ inlineExports: true,
114
115
  // CHANGE: rspack does not support `emitOnErrors` yet.
115
116
  emitOnErrors: true,
116
117
  concatenateModules: !!testConfig?.optimization?.concatenateModules,
@@ -195,7 +196,6 @@ function defaultOptions(context, compilerOptions, mode) {
195
196
  },
196
197
  asyncWebAssembly: true,
197
198
  topLevelAwait: true,
198
- inlineConst: true,
199
199
  // CHANGE: rspack does not support `backCompat` yet.
200
200
  // backCompat: false,
201
201
  // CHANGE: Rspack enables `css` by default.
@@ -83,8 +83,7 @@ function defaultOptions(index, context) {
83
83
  bundlerInfo: {
84
84
  force: false
85
85
  }
86
- },
87
- inlineConst: true
86
+ }
88
87
  }
89
88
  };
90
89
  }
@@ -174,9 +173,14 @@ async function check(env, context, name, writeStatsOuptut, snapshot, stderr) {
174
173
  // CHANGE: The time unit display in Rspack is second
175
174
  .replace(/[.0-9]+(\s?s)/g, "X$1")
176
175
  // CHANGE: Replace bundle size, since bundle sizes may differ between platforms
177
- .replace(/[0-9]+\.?[0-9]+ KiB/g, "xx KiB")
178
- .replace(/[0-9]+ ms/g, "xx ms");
176
+ .replace(/[0-9]+(\.[0-9]+)? KiB/g, "xx KiB")
177
+ .replace(/[0-9]+(\.[0-9]+)? bytes/g, "xx bytes")
178
+ .replace(/[0-9]+(\.[0-9]+)? ms/g, "xx ms");
179
179
  }
180
+ actual = actual
181
+ .split("\n")
182
+ .filter(line => !line.includes("@rstest/core/dist"))
183
+ .join("\n");
180
184
  const snapshotPath = node_path_1.default.isAbsolute(snapshot)
181
185
  ? snapshot
182
186
  : node_path_1.default.resolve(context.getSource(), `./__snapshots__/${snapshot}`);
@@ -8,8 +8,8 @@ exports.createWatchStepProcessor = createWatchStepProcessor;
8
8
  exports.createWatchCase = createWatchCase;
9
9
  exports.getWatchRunnerKey = getWatchRunnerKey;
10
10
  exports.createWatchRunner = createWatchRunner;
11
- const node_fs_1 = __importDefault(require("node:fs"));
12
11
  const node_path_1 = __importDefault(require("node:path"));
12
+ const fs_extra_1 = __importDefault(require("fs-extra"));
13
13
  const webpack_merge_1 = __importDefault(require("webpack-merge"));
14
14
  const compiler_1 = require("../compiler");
15
15
  const helper_1 = require("../helper");
@@ -58,8 +58,14 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
58
58
  },
59
59
  build: async (context) => {
60
60
  const compiler = context.getCompiler();
61
- node_fs_1.default.mkdirSync(watchContext.tempDir, { recursive: true });
61
+ fs_extra_1.default.mkdirSync(watchContext.tempDir, { recursive: true });
62
62
  (0, copyDiff_1.default)(node_path_1.default.join(context.getSource(), watchContext.step), watchContext.tempDir, true);
63
+ const pkgJsonFile = node_path_1.default.join(watchContext.tempDir, "package.json");
64
+ if (!fs_extra_1.default.existsSync(pkgJsonFile)) {
65
+ fs_extra_1.default.writeJsonSync(pkgJsonFile, { name, version: "0.0.1" });
66
+ const longTimeAgo = Date.now() - 1000 * 60 * 60 * 24;
67
+ fs_extra_1.default.utimesSync(pkgJsonFile, Date.now() - longTimeAgo, Date.now() - longTimeAgo);
68
+ }
63
69
  const task = new Promise((resolve, reject) => {
64
70
  compiler.getEmitter().once(compiler_1.ECompilerEvent.Build, (e, stats) => {
65
71
  if (e)
@@ -88,7 +94,7 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
88
94
  const checkStats = testConfig.checkStats || (() => true);
89
95
  if (stats) {
90
96
  if (testConfig.writeStatsOuptut) {
91
- node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
97
+ fs_extra_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
92
98
  preset: "verbose",
93
99
  colors: false
94
100
  }), "utf-8");
@@ -127,10 +133,10 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
127
133
  }
128
134
  }
129
135
  if (testConfig.writeStatsJson) {
130
- node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.json"), JSON.stringify(getJsonStats(), null, 2), "utf-8");
136
+ fs_extra_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.json"), JSON.stringify(getJsonStats(), null, 2), "utf-8");
131
137
  }
132
- if (node_fs_1.default.existsSync(context.getSource(`${watchContext.step}/errors.js`)) ||
133
- node_fs_1.default.existsSync(context.getSource(`${watchContext.step}/warnings.js`)) ||
138
+ if (fs_extra_1.default.existsSync(context.getSource(`${watchContext.step}/errors.js`)) ||
139
+ fs_extra_1.default.existsSync(context.getSource(`${watchContext.step}/warnings.js`)) ||
134
140
  stats.hasErrors() ||
135
141
  stats.hasWarnings()) {
136
142
  const statsJson = stats.toJson({
@@ -147,15 +153,15 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
147
153
  await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), watchContext.step), { errors }, "error", "errors", "Error", options);
148
154
  await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), watchContext.step), { warnings }, "warning", "warnings", "Warning", options);
149
155
  // clear error if checked
150
- if (node_fs_1.default.existsSync(context.getSource("errors.js"))) {
156
+ if (fs_extra_1.default.existsSync(context.getSource("errors.js"))) {
151
157
  context.clearError();
152
158
  }
153
159
  // check hash
154
160
  if (testConfig.writeStatsOuptut) {
155
- node_fs_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.txt"), node_path_1.default.join(context.getDist(), `stats.${watchContext.step}.txt`));
161
+ fs_extra_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.txt"), node_path_1.default.join(context.getDist(), `stats.${watchContext.step}.txt`));
156
162
  }
157
163
  if (testConfig.writeStatsJson) {
158
- node_fs_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.json"), node_path_1.default.join(context.getDist(), `stats.${watchContext.step}.json`));
164
+ fs_extra_1.default.renameSync(node_path_1.default.join(context.getDist(), "stats.json"), node_path_1.default.join(context.getDist(), `stats.${watchContext.step}.json`));
159
165
  }
160
166
  },
161
167
  after: async (context) => {
@@ -206,10 +212,10 @@ const creator = new creator_1.BasicCaseCreator({
206
212
  describe: false,
207
213
  steps: ({ name, src, temp }) => {
208
214
  const watchState = {};
209
- const runs = node_fs_1.default
215
+ const runs = fs_extra_1.default
210
216
  .readdirSync(src)
211
217
  .sort()
212
- .filter(name => node_fs_1.default.statSync(node_path_1.default.join(src, name)).isDirectory())
218
+ .filter(name => fs_extra_1.default.statSync(node_path_1.default.join(src, name)).isDirectory())
213
219
  .map(name => ({ name }));
214
220
  return runs.map((run, index) => index === 0
215
221
  ? createWatchInitialProcessor(name, temp, run.name, watchState)
@@ -18,7 +18,7 @@ function describeByWalk(testFile, createCase, options = {}) {
18
18
  const describeFn = options.describe || describe;
19
19
  const testBasename = node_path_1.default
20
20
  .basename(testFile)
21
- .replace(/\.(diff|hot)?test\.(j|t)s/, "");
21
+ .replace(/(\.part\d+)?\.(diff|hot)?test\.(j|t)s/, "");
22
22
  const testId = testBasename.charAt(0).toLowerCase() + testBasename.slice(1);
23
23
  const sourceBase = options.source || node_path_1.default.join(node_path_1.default.dirname(testFile), `${testId}Cases`);
24
24
  const testSourceId = node_path_1.default.basename(sourceBase);
@@ -13,5 +13,6 @@ export declare class HotUpdatePlugin {
13
13
  getUpdateIndex(): number;
14
14
  getTotalUpdates(): number;
15
15
  goNext(): Promise<void>;
16
+ moveTempDir(): Promise<string>;
16
17
  apply(compiler: Compiler): void;
17
18
  }
@@ -22,6 +22,7 @@ async function loopFile(dir, callback) {
22
22
  }));
23
23
  }
24
24
  const PLUGIN_NAME = "HotUpdatePlugin";
25
+ const MAX_UPDATE_INDEX = 100;
25
26
  class HotUpdatePlugin {
26
27
  constructor(projectDir, tempDir) {
27
28
  this.projectDir = projectDir;
@@ -91,10 +92,31 @@ class HotUpdatePlugin {
91
92
  }, 1);
92
93
  }
93
94
  async goNext() {
95
+ if (this.updateIndex > MAX_UPDATE_INDEX) {
96
+ throw new Error("NEXT_* has been called more than the maximum times");
97
+ }
94
98
  this.updateIndex++;
95
99
  await this.updateFiles();
96
100
  }
101
+ async moveTempDir() {
102
+ // generate next temp dir path.
103
+ const nextTempDir = this.tempDir.replace(/(___[0-9]+)?[/\\]*$/, "") +
104
+ "___" +
105
+ this.updateIndex;
106
+ // update this.files.
107
+ for (const key of Object.keys(this.files)) {
108
+ const nextKey = key.replace(this.tempDir, nextTempDir);
109
+ this.files[nextKey] = this.files[key];
110
+ delete this.files[key];
111
+ }
112
+ // move files.
113
+ (0, rimraf_1.rimrafSync)(nextTempDir);
114
+ fs_extra_1.default.renameSync(this.tempDir, nextTempDir);
115
+ this.tempDir = nextTempDir;
116
+ return this.tempDir;
117
+ }
97
118
  apply(compiler) {
119
+ const RuntimeGlobals = compiler.rspack.RuntimeGlobals;
98
120
  const options = compiler.options;
99
121
  options.context = this.tempDir;
100
122
  options.module.rules ??= [];
@@ -113,14 +135,14 @@ class HotUpdatePlugin {
113
135
  });
114
136
  compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
115
137
  compilation.hooks.additionalTreeRuntimeRequirements.tap(PLUGIN_NAME, (_chunk, set) => {
116
- set.add(compiler.webpack.RuntimeGlobals.moduleCache);
138
+ set.add(compiler.rspack.RuntimeGlobals.moduleCache);
117
139
  });
118
140
  compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module, _set) => {
119
141
  if (module.constructorName === "DefinePropertyGettersRuntimeModule") {
120
142
  module.source.source = Buffer.from(`
121
- __webpack_require__.d = function (exports, definition) {
143
+ ${RuntimeGlobals.definePropertyGetters} = function (exports, definition) {
122
144
  for (var key in definition) {
123
- if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
145
+ if (${RuntimeGlobals.hasOwnProperty}(definition, key) && !${RuntimeGlobals.hasOwnProperty}(exports, key)) {
124
146
  Object.defineProperty(exports, key, { configurable: true, enumerable: true, get: definition[key] });
125
147
  }
126
148
  }
@@ -87,20 +87,50 @@ module.exports = async function checkArrayExpectation(testDirectory, object, kin
87
87
  done(new Error(`Less ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
88
88
  return true;
89
89
  }
90
+ const usedExpected = new Array(expected.length).fill(false);
90
91
  for (let i = 0; i < array.length; i++) {
91
- if (Array.isArray(expected[i])) {
92
- for (let j = 0; j < expected[i].length; j++) {
93
- if (!check(expected[i][j], array[i])) {
94
- done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match ${explain(expected[i][j])}`));
95
- return true;
92
+ let found = false;
93
+ for (let j = 0; j < expected.length; j++) {
94
+ if (usedExpected[j])
95
+ continue;
96
+ if (Array.isArray(expected[j])) {
97
+ for (let k = 0; k < expected[j].length; k++) {
98
+ if (check(expected[j][k], array[i])) {
99
+ usedExpected[j] = true;
100
+ found = true;
101
+ break;
102
+ }
96
103
  }
97
104
  }
105
+ else {
106
+ if (check(expected[j], array[i])) {
107
+ usedExpected[j] = true;
108
+ found = true;
109
+ break;
110
+ }
111
+ }
112
+ if (found)
113
+ break;
98
114
  }
99
- else if (!check(expected[i], array[i])) {
100
- done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match ${explain(expected[i])}`));
115
+ if (!found) {
116
+ done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match any expected value`));
101
117
  return true;
102
118
  }
103
119
  }
120
+ const unused = [];
121
+ for (let j = 0; j < expected.length; j++) {
122
+ if (!usedExpected[j]) {
123
+ unused.push(Array.isArray(expected[j])
124
+ ? expected[j].map(explain).join(' | ')
125
+ : explain(expected[j]));
126
+ }
127
+ }
128
+ if (unused.length > 0) {
129
+ done(new Error(`The following expected ${kind}s were not matched:\n${unused
130
+ .map(u => ` ${u}`)
131
+ .join('\n')}`));
132
+ return true;
133
+ }
104
134
  }
105
135
  else if (array.length > 0) {
106
136
  done(new Error(`${upperCaseKind}s while compiling:\n\n${array
@@ -36,6 +36,22 @@ self.importScripts = url => {
36
36
  : "require(urlToPath(url))"};
37
37
  };
38
38
  self.fetch = async url => {
39
+ if (typeof url === "string" ? url.endsWith(".wasm") : url.toString().endsWith(".wasm")) {
40
+ return new Promise((resolve, reject) => {
41
+ fs.readFile(require("node:url").fileURLToPath(url), (err, data) => {
42
+ if (err) {
43
+ reject(err);
44
+ return;
45
+ }
46
+ return resolve(
47
+ new Response(data, {
48
+ headers: { "Content-Type": "application/wasm" }
49
+ })
50
+ );
51
+ });
52
+ });
53
+ }
54
+
39
55
  try {
40
56
  const buffer = await new Promise((resolve, reject) =>
41
57
  fs.readFile(urlToPath(url), (err, b) =>
@@ -43,7 +59,9 @@ self.fetch = async url => {
43
59
  )
44
60
  );
45
61
  return {
46
- headers: { get(name) { } },
62
+ headers: { get(name) {
63
+ if (name.toLowerCase() === "content-type") {}
64
+ } },
47
65
  status: 200,
48
66
  ok: true,
49
67
  arrayBuffer() { return buffer; },
@@ -29,7 +29,7 @@ class LazyCompilationTestPlugin {
29
29
  else if (compiler.options.lazyCompilation) {
30
30
  compiler.options.lazyCompilation.serverUrl = urlBase;
31
31
  }
32
- middleware = core_1.experiments.lazyCompilationMiddleware(compiler);
32
+ middleware = (0, core_1.lazyCompilationMiddleware)(compiler);
33
33
  resolve(null);
34
34
  });
35
35
  server.on("request", (req, res) => {
@@ -184,6 +184,8 @@ class NodeRunner {
184
184
  setImmediate,
185
185
  self: this.globalContext,
186
186
  __TEST_PATH__: __TEST_PATH__,
187
+ __TEST_SOURCE_PATH__: this._options.source,
188
+ __TEST_DIST_PATH__: this._options.dist,
187
189
  __MODE__: this._options.compilerOptions.mode,
188
190
  __SNAPSHOT__: node_path_1.default.join(this._options.source, "__snapshot__"),
189
191
  Worker: (0, createFakeWorker_1.default)(this._options.env, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/test-tools",
3
- "version": "1.6.6",
3
+ "version": "1.7.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  "jest-diff": "^29.7.0",
48
48
  "jest-snapshot": "29.7.0",
49
49
  "jsdom": "^26.1.0",
50
- "memfs": "4.48.1",
50
+ "memfs": "4.51.1",
51
51
  "path-serializer": "0.5.1",
52
52
  "pretty-format": "29.7.0",
53
53
  "rimraf": "^5.0.10",
@@ -65,7 +65,7 @@
65
65
  "@types/jsdom": "^21.1.7",
66
66
  "typescript": "^5.9.3",
67
67
  "wast-loader": "^1.14.1",
68
- "@rspack/core": "npm:@rspack-debug/core@1.6.6"
68
+ "@rspack/core": "npm:@rspack-debug/core@1.7.0-beta.0"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@rspack/core": ">=1.0.0"