@rspack/test-tools 1.4.0 → 1.4.2

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <picture>
2
- <img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner.png">
2
+ <img alt="Rspack Banner" src="https://assets.rspack.rs/rspack/rspack-banner.png">
3
3
  </picture>
4
4
 
5
5
  # @rspack/test-tools
@@ -8,6 +8,19 @@
8
8
 
9
9
  Test tools for rspack.
10
10
 
11
+ ## Wasm Tests
12
+
13
+ We expect to reuse the tests for Rspack wasm target as many as possible and we have managed to do it partially. Currently wasm tests should be run with an environment variable `WASM=1` under the following limitations:
14
+
15
+ 1. Node 20 is required, which is consistent with the Node version in StackBlitz.
16
+ 2. Set `maxWorkers` to `1`, `maxConcurrency` to `1` and disable concurrent mode to avoid flaky failures.
17
+ 3. `forceExit` is needed.
18
+
19
+ Also check all the skipped testcases with `!process.env.WASM` in `test.filter.js`s and the skipped testsuits in `jest.config.js`s. They are divided into two categories:
20
+
21
+ 1. Skip due to lacks of api support, such as tests related to swc wasm plugins, pnp and profiling. We skip them to avoid obsolete snapshot errors.
22
+ 2. Skip temporarily and should be investigate in the future. There could be something wrong with test harness and rspack wasm itself. Since it could be time-consuming to figure out all of them so in this stage we use the wasm test ci to avoid the regression rather than improve its stability.
23
+
11
24
  ## Documentation
12
25
 
13
26
  See [https://rspack.rs](https://rspack.rs) for details.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // Skip all snapshot tests for wasm because:
3
+ // 1. The wasm error backtrace bypasses emnapi.
4
+ // 2. Wasm target is a 32-bit platform, where all hash results are diffeference from the native targets.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ function toMatchSnapshot() {
7
+ return { pass: true, message: () => "" };
8
+ }
9
+ function toMatchInlineSnapshot() {
10
+ return { pass: true, message: () => "" };
11
+ }
12
+ function toMatchFileSnapshot() {
13
+ return { pass: true, message: () => "" };
14
+ }
15
+ expect.extend({
16
+ toMatchSnapshot,
17
+ toMatchInlineSnapshot,
18
+ toMatchFileSnapshot
19
+ });
@@ -31,7 +31,9 @@ class BasicCaseCreator {
31
31
  }
32
32
  const run = this.shouldRun(name);
33
33
  const tester = this.createTester(name, src, dist, temp, testConfig);
34
- const concurrent = testConfig.concurrent ?? this._options.concurrent ?? false;
34
+ const concurrent = process.env.WASM
35
+ ? false
36
+ : testConfig.concurrent || this._options.concurrent;
35
37
  if (this._options.describe) {
36
38
  if (run) {
37
39
  if (concurrent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "./setup-expect": "./dist/helper/setup-expect.js",
13
13
  "./setup-env": "./dist/helper/setup-env.js",
14
+ "./setup-wasm": "./dist/helper/setup-wasm.js",
14
15
  "./package.json": "./package.json"
15
16
  },
16
17
  "files": [
@@ -95,9 +96,9 @@
95
96
  "typescript": "^5.8.3",
96
97
  "wast-loader": "^1.14.1",
97
98
  "worker-rspack-loader": "^3.1.2",
98
- "@rspack/cli": "1.4.0",
99
- "@rspack/test-tools": "1.4.0",
100
- "@rspack/core": "1.4.0"
99
+ "@rspack/cli": "1.4.2",
100
+ "@rspack/core": "1.4.2",
101
+ "@rspack/test-tools": "1.4.2"
101
102
  },
102
103
  "peerDependencies": {
103
104
  "@rspack/core": ">=1.0.0"