Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3ac4a9b
migrate rspack wasm test to rstest
CPunisher Oct 23, 2025
b1ba3cb
Disable jest for wasm
CPunisher Oct 23, 2025
e2f9fc8
Disable jest for wasm
CPunisher Oct 23, 2025
b889177
More tests
CPunisher Oct 23, 2025
cb0b488
Add __DEBUG__ back
CPunisher Oct 23, 2025
7ab077a
Fix lint
CPunisher Oct 23, 2025
3cea42a
test: compatible with jest tests
9aoy Oct 27, 2025
87cf9f9
test: skip Hot* tests
9aoy Oct 27, 2025
8cf3356
fix: bump rstest
9aoy Oct 27, 2025
ddc2285
fix: test
9aoy Oct 30, 2025
2ff4f77
test: wasm concurrent 1
9aoy Oct 30, 2025
622d5b2
fix: hash case error
9aoy Oct 30, 2025
99a4d4d
test: update
9aoy Oct 31, 2025
b372270
fix: test wasm
9aoy Oct 31, 2025
0e70507
chore: debugger
CPunisher Nov 3, 2025
da2888e
chore: debugger
CPunisher Nov 3, 2025
5ba342f
test: jest wasm
9aoy Nov 3, 2025
795befc
Merge branch '10-23-chore/rstest-wasm-test' of https://github.com/web…
9aoy Nov 3, 2025
71630d5
test: update
9aoy Nov 3, 2025
2b59229
test: update rstest
9aoy Nov 3, 2025
ca058d6
test: exclude config
9aoy Nov 3, 2025
4993e47
test: enable debugger
9aoy Nov 3, 2025
748c51b
test: log heap usage
9aoy Nov 3, 2025
7669624
test: debugger
9aoy Nov 6, 2025
e392b20
test: update
9aoy Nov 7, 2025
cccd7f2
test: remove SIGTERM event handler
9aoy Nov 7, 2025
1870995
test: include all tests
9aoy Nov 7, 2025
c15e9fd
test: bump rstest
9aoy Nov 10, 2025
c5193af
test: update
9aoy Nov 10, 2025
8c798bc
Merge branch 'main' into 10-23-chore/rstest-wasm-test
9aoy Nov 10, 2025
560dfff
fix: docs lint
9aoy Nov 10, 2025
2257e20
test: update
9aoy Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"cross-env": "^10.1.0",
"husky": "^9.1.7",
"is-ci": "4.1.0",
"@rstest/core": "^0.6.1",
"@rstest/core": "^0.6.3",
"jest": "29.7.0",
"jest-cli": "29.7.0",
"lint-staged": "^16.2.6",
Expand Down
9 changes: 7 additions & 2 deletions packages/rspack-test-tools/src/case/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ async function check(env: ITestEnv, context: ITestContext, name: string) {
const stats = compiler.getStats();
const testConfig = context.getTestConfig();
if (!stats) {
env.expect(false);
return;
throw new Error(
"No stats found\n" +
context
.getError()
.map(e => e.stack)
.join("\n")
);
}
if (REG_ERROR_CASE.test(name)) {
env.expect(stats.hasErrors());
Expand Down
3 changes: 0 additions & 3 deletions packages/rspack-test-tools/src/helper/setup-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ if (process.env.RSTEST) {
global.__RSPACK_PATH__ ??= process.env.__RSPACK_PATH__;
global.__RSPACK_TEST_TOOLS_PATH__ ??= process.env.__RSPACK_TEST_TOOLS_PATH__;
global.__DEBUG__ ??= process.env.DEBUG === "test";
} else {
// Compatible with wasm tests (lazyTestEnv)
global.rstest = jest;
}

if (process.env.ALTERNATIVE_SORT) {
Expand Down
4 changes: 2 additions & 2 deletions packages/rspack-test-tools/src/test/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface IBasicCaseCreatorOptions {
[key: string]: unknown;
}

const DEFAULT_MAX_CONCURRENT = 5;
const DEFAULT_MAX_CONCURRENT = process.env.WASM ? 1 : 5;

export class BasicCaseCreator {
protected currentConcurrent = 0;
Expand Down Expand Up @@ -88,7 +88,7 @@ export class BasicCaseCreator {
options
);
const concurrent = process.env.WASM
? false
? 1
: testConfig.concurrent || options.concurrent;
if (options.describe) {
if (run) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/ChunkGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Object.defineProperty(ChunkGraph.prototype, "getOrderedChunkModulesIterable", {
value(
this: ChunkGraph,
chunk: Chunk,
compareFn: (a: Module, b: Module) => number
compareFn: (_a: Module, _b: Module) => number
): Iterable<Module> {
const modules = this.getChunkModules(chunk);
modules.sort(compareFn);
Expand Down
90 changes: 83 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rspack-test/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const setupFilesAfterEnv = [
const wasmConfig = process.env.WASM && {
setupFilesAfterEnv: [...setupFilesAfterEnv, "@rspack/test-tools/setup-wasm"],
testPathIgnorePatterns: [
// Skip because they reply on snapshots
// Skip because they rely on snapshots
"Diagnostics.test.js",
"Error.test.js",
"StatsAPI.test.js",
Expand Down
4 changes: 2 additions & 2 deletions tests/rspack-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"test": "cross-env RUST_BACKTRACE=full pnpm run --stream /^test:.*/",
"testu": "pnpm run --stream /^test:.*/ -u",
"test:rstest": "rstest",
"test:base": "cross-env node --no-warnings --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --colors --config ./jest.config.js --passWithNoTests",
"test:hot": "cross-env RSPACK_HOT_TEST=true node --no-warnings --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/@rstest/core/bin/rstest --config ./rstest.config.hot.ts --passWithNoTests"
},
"devDependencies": {
Expand All @@ -20,7 +19,7 @@
"@rspack/plugin-preact-refresh": "1.1.4",
"@rspack/plugin-react-refresh": "^1.5.2",
"@rspack/test-tools": "workspace:*",
"@rstest/core": "^0.6.1",
"@rstest/core": "^0.6.3",
"@swc/helpers": "0.5.17",
"@swc/plugin-remove-console": "^10.0.0",
"@types/babel__generator": "7.27.0",
Expand All @@ -45,6 +44,7 @@
"lodash": "^4.17.21",
"memfs": "4.48.1",
"mini-svg-data-uri": "^1.4.4",
"node-polyfill-webpack-plugin": "^4.1.0",
"postcss-loader": "^8.2.0",
"postcss-pxtorem": "^6.1.0",
"raw-loader": "^4.0.2",
Expand Down
33 changes: 32 additions & 1 deletion tests/rspack-test/rstest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,39 @@ const setupFilesAfterEnv = [
"@rspack/test-tools/setup-expect",
];

const wasmConfig = process.env.WASM && defineConfig({
setupFiles: [...setupFilesAfterEnv, "@rspack/test-tools/setup-wasm"],
exclude: [
// Skip because they rely on snapshots
"Diagnostics.test.js",
"Error.test.js",
"StatsAPI.test.js",
"StatsOutput.test.js",
// Skip because the loader can not be loaded in CI
"Hot*.test.js",

// Skip temporarily and should investigate in the future
"Cache.test.js",
"Compiler.test.js",
"MultiCompiler.test.js",
"Serial.test.js",
"Defaults.test.js",
"Example.test.js",
"Incremental-*.test.js",
"NativeWatcher*.test.js",
],
maxConcurrency: 1,
pool: {
maxWorkers: 1,
execArgv: ['--no-warnings', '--expose-gc', '--max-old-space-size=6144', '--experimental-vm-modules'],
}
});


export default defineConfig({
setupFiles: setupFilesAfterEnv,
testTimeout: process.env.CI ? 60000 : 30000,
include: process.env.WASM ? [] : [
include: [
"*.test.js",
],
slowTestThreshold: 5000,
Expand All @@ -25,6 +54,7 @@ export default defineConfig({
source: {
exclude: [root],
},
disableConsoleIntercept: true,
globals: true,
output: {
externals: [/.*/],
Expand Down Expand Up @@ -62,5 +92,6 @@ export default defineConfig({
__DEBUG__: process.env.DEBUG === "test" ? 'true' : 'false',
},
hideSkippedTests: true,
...(wasmConfig || {}),
});

6 changes: 1 addition & 5 deletions website/docs/en/plugins/webpack/entry-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ When the plugin's `name` option is set to `undefined`, the entry is treated as a
This allows you to inject global runtime code, such as the dev server's HMR runtime or the initialization logic for module federation.

```js
new rspack.EntryPlugin(
context,
'./global-runtime.js',
{ name: undefined }
);
new rspack.EntryPlugin(context, './global-runtime.js', { name: undefined });
```
6 changes: 1 addition & 5 deletions website/docs/zh/plugins/webpack/entry-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ type EntryOptions =
这可以用于注入一段全局代码,例如 dev server 的热更新运行时代码,或是模块联邦的初始化逻辑。

```js
new rspack.EntryPlugin(
context,
'./global-runtime.js',
{ name: undefined }
);
new rspack.EntryPlugin(context, './global-runtime.js', { name: undefined });
```
Loading