@rspack/test-tools 1.7.1 → 2.0.0-canary-20260116

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.
@@ -78,6 +78,9 @@ function defaultOptions(context) {
78
78
  webassemblyModuleFilename: '[hash].module.wasm',
79
79
  workerChunkLoading: 'import-scripts',
80
80
  workerWasmLoading: 'fetch',
81
+ bundlerInfo: {
82
+ force: false,
83
+ },
81
84
  },
82
85
  module: {
83
86
  rules: [
@@ -146,11 +149,6 @@ function defaultOptions(context) {
146
149
  experiments: {
147
150
  css: true,
148
151
  futureDefaults: true,
149
- rspackFuture: {
150
- bundlerInfo: {
151
- force: false,
152
- },
153
- },
154
152
  },
155
153
  devtool: false,
156
154
  context: context.getSource(),
@@ -84,6 +84,9 @@ async function generateOptions(context, temp, target, updatePlugin) {
84
84
  chunkFilename: '[name].chunk.[fullhash].js',
85
85
  publicPath: 'https://test.cases/path/',
86
86
  library: { type: 'commonjs2' },
87
+ bundlerInfo: {
88
+ force: false,
89
+ },
87
90
  },
88
91
  optimization: {
89
92
  moduleIds: 'named',
@@ -92,11 +95,6 @@ async function generateOptions(context, temp, target, updatePlugin) {
92
95
  target,
93
96
  experiments: {
94
97
  css: true,
95
- rspackFuture: {
96
- bundlerInfo: {
97
- force: false,
98
- },
99
- },
100
98
  },
101
99
  };
102
100
  options.plugins ??= [];
@@ -69,17 +69,15 @@ function defaultOptions(index, context) {
69
69
  cache: false,
70
70
  output: {
71
71
  path: context.getDist(),
72
+ bundlerInfo: {
73
+ force: false,
74
+ },
72
75
  },
73
76
  optimization: {
74
77
  minimize: false,
75
78
  },
76
79
  experiments: {
77
80
  css: true,
78
- rspackFuture: {
79
- bundlerInfo: {
80
- force: false,
81
- },
82
- },
83
81
  },
84
82
  };
85
83
  }
@@ -40,8 +40,7 @@ function getRspackDefaultConfig(cwd, config) {
40
40
  const normalizedConfig = getNormalizedWebpackOptions(config);
41
41
  applyWebpackOptionsDefaults(normalizedConfig);
42
42
  // make snapshot stable
43
- normalizedConfig.experiments.rspackFuture.bundlerInfo.version =
44
- '$version$';
43
+ normalizedConfig.output.bundlerInfo.version = '$version$';
45
44
  process.chdir(CURRENT_CWD);
46
45
  return normalizedConfig;
47
46
  }
@@ -75,14 +75,12 @@ function defaultOptions(context) {
75
75
  },
76
76
  output: {
77
77
  path: context.getDist(),
78
+ bundlerInfo: {
79
+ force: false,
80
+ },
78
81
  },
79
82
  experiments: {
80
83
  css: true,
81
- rspackFuture: {
82
- bundlerInfo: {
83
- force: false,
84
- },
85
- },
86
84
  },
87
85
  };
88
86
  }
@@ -78,13 +78,13 @@ function options(context, custom) {
78
78
  moduleIds: 'named',
79
79
  chunkIds: 'named',
80
80
  },
81
+ otuput: {
82
+ bundlerInfo: {
83
+ force: false,
84
+ },
85
+ },
81
86
  experiments: {
82
87
  css: true,
83
- rspackFuture: {
84
- bundlerInfo: {
85
- force: false,
86
- },
87
- },
88
88
  },
89
89
  };
90
90
  if (typeof custom === 'function') {
@@ -93,6 +93,9 @@ const defaultOptions = (_index, context) => ({
93
93
  filename: '[name].mjs',
94
94
  pathinfo: true,
95
95
  module: true,
96
+ bundlerInfo: {
97
+ force: false,
98
+ },
96
99
  },
97
100
  bail: true,
98
101
  optimization: {
@@ -108,11 +111,6 @@ const defaultOptions = (_index, context) => ({
108
111
  plugins: [new core_1.default.experiments.EsmLibraryPlugin()],
109
112
  experiments: {
110
113
  css: true,
111
- rspackFuture: {
112
- bundlerInfo: {
113
- force: false,
114
- },
115
- },
116
114
  outputModule: true,
117
115
  },
118
116
  });
package/dist/case/hash.js CHANGED
@@ -45,14 +45,12 @@ function defaultOptions(index, context) {
45
45
  context: context.getSource(),
46
46
  output: {
47
47
  path: context.getDist(),
48
+ bundlerInfo: {
49
+ force: false,
50
+ },
48
51
  },
49
52
  experiments: {
50
53
  css: true,
51
- rspackFuture: {
52
- bundlerInfo: {
53
- force: false,
54
- },
55
- },
56
54
  },
57
55
  };
58
56
  }
package/dist/case/hook.js CHANGED
@@ -203,17 +203,15 @@ function defaultOptions(context, custom) {
203
203
  entry: './hook',
204
204
  output: {
205
205
  path: context.getDist(),
206
+ bundlerInfo: {
207
+ force: false,
208
+ },
206
209
  },
207
210
  optimization: {
208
211
  minimize: false,
209
212
  },
210
213
  experiments: {
211
214
  css: true,
212
- rspackFuture: {
213
- bundlerInfo: {
214
- force: false,
215
- },
216
- },
217
215
  },
218
216
  };
219
217
  if (custom) {
package/dist/case/hot.js CHANGED
@@ -97,6 +97,9 @@ function defaultOptions(context, target) {
97
97
  chunkFilename: '[name].chunk.[fullhash].js',
98
98
  publicPath: 'https://test.cases/path/',
99
99
  library: { type: 'commonjs2' },
100
+ bundlerInfo: {
101
+ force: false,
102
+ },
100
103
  },
101
104
  optimization: {
102
105
  moduleIds: 'named',
@@ -106,11 +109,6 @@ function defaultOptions(context, target) {
106
109
  css: true,
107
110
  // test incremental: "safe" here, we test default incremental in Incremental-*.test.js
108
111
  incremental: 'safe',
109
- rspackFuture: {
110
- bundlerInfo: {
111
- force: false,
112
- },
113
- },
114
112
  },
115
113
  };
116
114
  options.plugins ??= [];
@@ -141,6 +141,9 @@ function defaultOptions(context, compilerOptions, mode) {
141
141
  pathinfo: 'verbose',
142
142
  path: context.getDist(),
143
143
  filename: compilerOptions?.module ? 'bundle.mjs' : 'bundle.js',
144
+ bundlerInfo: {
145
+ force: false,
146
+ },
144
147
  },
145
148
  resolve: {
146
149
  modules: ['web_modules', 'node_modules'],
@@ -169,6 +172,11 @@ function defaultOptions(context, compilerOptions, mode) {
169
172
  type: 'webassembly/async',
170
173
  },
171
174
  ],
175
+ parser: {
176
+ javascript: {
177
+ requireAlias: true,
178
+ },
179
+ },
172
180
  },
173
181
  plugins: (compilerOptions?.plugins || [])
174
182
  .concat(testConfig.plugins || [])
@@ -189,13 +197,7 @@ function defaultOptions(context, compilerOptions, mode) {
189
197
  }),
190
198
  experiments: {
191
199
  css: false,
192
- rspackFuture: {
193
- bundlerInfo: {
194
- force: false,
195
- },
196
- },
197
200
  asyncWebAssembly: true,
198
- topLevelAwait: true,
199
201
  // CHANGE: rspack does not support `backCompat` yet.
200
202
  // backCompat: false,
201
203
  // CHANGE: Rspack enables `css` by default.
@@ -54,9 +54,9 @@ function options(context, custom) {
54
54
  const res = (custom?.(context) || {});
55
55
  res.experiments ??= {};
56
56
  res.experiments.css ??= true;
57
- res.experiments.rspackFuture ??= {};
58
- res.experiments.rspackFuture.bundlerInfo ??= {};
59
- res.experiments.rspackFuture.bundlerInfo.force ??= false;
57
+ res.output ??= {};
58
+ res.output.bundlerInfo ??= {};
59
+ res.output.bundlerInfo.force ??= false;
60
60
  if (!global.printLogger) {
61
61
  res.infrastructureLogging = {
62
62
  level: 'error',
@@ -56,13 +56,13 @@ function defaultOptions(index, context) {
56
56
  if (fs_extra_1.default.existsSync(node_path_1.default.join(context.getSource(), 'rspack.config.js')) ||
57
57
  fs_extra_1.default.existsSync(node_path_1.default.join(context.getSource(), 'webpack.config.js'))) {
58
58
  return {
59
+ output: {
60
+ bundlerInfo: {
61
+ force: false,
62
+ },
63
+ },
59
64
  experiments: {
60
65
  css: true,
61
- rspackFuture: {
62
- bundlerInfo: {
63
- force: false,
64
- },
65
- },
66
66
  },
67
67
  };
68
68
  }
@@ -73,17 +73,15 @@ function defaultOptions(index, context) {
73
73
  output: {
74
74
  filename: 'bundle.js',
75
75
  path: context.getDist(),
76
+ bundlerInfo: {
77
+ force: false,
78
+ },
76
79
  },
77
80
  optimization: {
78
81
  minimize: false,
79
82
  },
80
83
  experiments: {
81
84
  css: true,
82
- rspackFuture: {
83
- bundlerInfo: {
84
- force: false,
85
- },
86
- },
87
85
  },
88
86
  };
89
87
  }
@@ -245,21 +245,15 @@ function overrideOptions(index, context, options, tempDir, nativeWatcher) {
245
245
  options.output.pathinfo = false;
246
246
  if (!options.output.filename)
247
247
  options.output.filename = 'bundle.js';
248
- if (options.cache && options.cache.type === 'filesystem') {
249
- const cacheDirectory = node_path_1.default.join(tempDir, '.cache');
250
- options.cache.cacheDirectory = cacheDirectory;
251
- options.cache.name = `config-${index}`;
252
- }
253
248
  options.optimization ??= {};
254
249
  options.experiments ??= {};
255
250
  options.experiments.css ??= true;
256
251
  if (nativeWatcher) {
257
252
  options.experiments.nativeWatcher ??= true;
258
253
  }
259
- options.experiments.rspackFuture ??= {};
260
- options.experiments.rspackFuture.bundlerInfo ??= {};
261
- options.experiments.rspackFuture.bundlerInfo.force ??=
262
- false;
254
+ options.output ??= {};
255
+ options.output.bundlerInfo ??= {};
256
+ options.output.bundlerInfo.force ??= false;
263
257
  // test incremental: "safe" here, we test default incremental in Incremental-*.test.js
264
258
  options.experiments.incremental ??= 'safe';
265
259
  if (!global.printLogger) {
@@ -23,6 +23,10 @@ const placeholderSerializer = (0, path_serializer_1.createSnapshotSerializer)({
23
23
  match: __RSPACK_PATH__,
24
24
  mark: 'rspack_root',
25
25
  },
26
+ {
27
+ match: /<ROOT>\/packages\/rspack/g,
28
+ mark: 'rspack_root',
29
+ },
26
30
  {
27
31
  match: /:\d+:\d+-\d+:\d+/g,
28
32
  mark: 'line_col_range',
@@ -138,7 +138,7 @@ class HotUpdatePlugin {
138
138
  set.add(compiler.rspack.RuntimeGlobals.moduleCache);
139
139
  });
140
140
  compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module, _set) => {
141
- if (module.constructorName === 'DefinePropertyGettersRuntimeModule') {
141
+ if (module.constructor.name === 'DefinePropertyGettersRuntimeModule') {
142
142
  module.source.source = Buffer.from(`
143
143
  ${RuntimeGlobals.definePropertyGetters} = function (exports, definition) {
144
144
  for (var key in definition) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.7.1",
3
+ "version": "2.0.0-canary-20260116",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -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": "1.7.1"
68
+ "@rspack/core": "2.0.0-canary-20260116"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@rspack/core": ">=1.0.0"