@rspack/test-tools 1.3.9 → 1.3.11

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.
@@ -16,5 +16,4 @@ export * from "./treeshaking";
16
16
  export * from "./watch";
17
17
  export * from "./new-incremental";
18
18
  export * from "./cache";
19
- export * from "./new-code-splitting";
20
19
  export * from "./serial";
@@ -32,5 +32,4 @@ __exportStar(require("./treeshaking"), exports);
32
32
  __exportStar(require("./watch"), exports);
33
33
  __exportStar(require("./new-incremental"), exports);
34
34
  __exportStar(require("./cache"), exports);
35
- __exportStar(require("./new-code-splitting"), exports);
36
35
  __exportStar(require("./serial"), exports);
@@ -257,8 +257,16 @@ class BasicCaseCreator {
257
257
  }
258
258
  checkSkipped(src, testConfig) {
259
259
  const filterPath = node_path_1.default.join(src, "test.filter.js");
260
- return (node_fs_1.default.existsSync(filterPath) &&
261
- !require(filterPath)(this._options, testConfig));
260
+ // no test.filter.js, should not skip
261
+ if (!node_fs_1.default.existsSync(filterPath)) {
262
+ return false;
263
+ }
264
+ // test.filter.js exists, skip if it returns false|string|array
265
+ const filtered = require(filterPath)(this._options, testConfig);
266
+ if (typeof filtered === "string" || Array.isArray(filtered)) {
267
+ return true;
268
+ }
269
+ return !filtered;
262
270
  }
263
271
  createTester(name, src, dist, temp, testConfig) {
264
272
  return new tester_1.Tester({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -58,15 +58,15 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@rspack/plugin-preact-refresh": "1.1.2",
61
- "@rspack/plugin-react-refresh": "^1.4.1",
61
+ "@rspack/plugin-react-refresh": "^1.4.3",
62
62
  "@swc/helpers": "0.5.17",
63
63
  "@swc/plugin-remove-console": "^7.0.4",
64
64
  "@types/babel__generator": "7.27.0",
65
65
  "@types/babel__traverse": "7.20.7",
66
66
  "@types/fs-extra": "11.0.4",
67
67
  "@types/jsdom": "^21.1.7",
68
- "@types/react": "^19.1.3",
69
- "@types/react-dom": "^19.1.3",
68
+ "@types/react": "^19.1.4",
69
+ "@types/react-dom": "^19.1.5",
70
70
  "@types/webpack": "5.28.5",
71
71
  "@types/webpack-sources": "3.2.3",
72
72
  "@webdiscus/pug-loader": "^2.11.1",
@@ -80,7 +80,7 @@
80
80
  "graceful-fs": "^4.2.11",
81
81
  "html-loader": "^5.1.0",
82
82
  "html-webpack-plugin": "^5.6.3",
83
- "less-loader": "^12.2.0",
83
+ "less-loader": "^12.3.0",
84
84
  "lodash": "^4.17.21",
85
85
  "postcss-loader": "^8.1.1",
86
86
  "postcss-pxtorem": "^6.1.0",
@@ -92,13 +92,13 @@
92
92
  "source-map": "^0.7.4",
93
93
  "source-map-loader": "^5.0.0",
94
94
  "style-loader": "^4.0.0",
95
- "terser": "5.39.0",
95
+ "terser": "5.39.1",
96
96
  "typescript": "^5.8.3",
97
97
  "wast-loader": "^1.14.1",
98
98
  "worker-rspack-loader": "^3.1.2",
99
- "@rspack/core": "1.3.9",
100
- "@rspack/test-tools": "1.3.9",
101
- "@rspack/cli": "1.3.9"
99
+ "@rspack/cli": "1.3.11",
100
+ "@rspack/core": "1.3.11",
101
+ "@rspack/test-tools": "1.3.11"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "@rspack/core": ">=1.0.0"
@@ -1,2 +0,0 @@
1
- export declare function createConfigNewCodeSplittingCase(name: string, src: string, dist: string): void;
2
- export declare function createStatsAPINewCodeSplittingCase(name: string, src: string, dist: string, testConfig: string): void;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConfigNewCodeSplittingCase = createConfigNewCodeSplittingCase;
4
- exports.createStatsAPINewCodeSplittingCase = createStatsAPINewCodeSplittingCase;
5
- const processor_1 = require("../processor");
6
- const runner_1 = require("../runner");
7
- const creator_1 = require("../test/creator");
8
- const simple_1 = require("../test/simple");
9
- const type_1 = require("../type");
10
- function createConfigNewCodeSplittingCase(name, src, dist) {
11
- configCreator.create(name, src, dist);
12
- }
13
- const configCreator = new creator_1.BasicCaseCreator({
14
- clean: true,
15
- runner: runner_1.MultipleRunnerFactory,
16
- describe: false,
17
- testConfig: testConfig => {
18
- const oldModuleScope = testConfig.moduleScope;
19
- testConfig.moduleScope = (ms, stats) => {
20
- let res = ms;
21
- // TODO: modify runner module scope based on stats here
22
- if (typeof oldModuleScope === "function") {
23
- res = oldModuleScope(ms, stats);
24
- }
25
- return res;
26
- };
27
- },
28
- steps: ({ name }) => {
29
- const processor = new NewCodeSplittingProcessor({
30
- name,
31
- runable: true,
32
- compilerType: type_1.ECompilerType.Rspack,
33
- configFiles: [
34
- "rspack.config.cjs",
35
- "rspack.config.js",
36
- "webpack.config.js"
37
- ]
38
- });
39
- return [processor];
40
- },
41
- concurrent: true
42
- });
43
- class NewCodeSplittingProcessor extends processor_1.ConfigProcessor {
44
- constructor(_configOptions) {
45
- super({
46
- ..._configOptions,
47
- overrideOptions: (NewCodeSplittingProcessor.overrideOptions)
48
- });
49
- this._configOptions = _configOptions;
50
- }
51
- static overrideOptions(index, context, options) {
52
- processor_1.ConfigProcessor.overrideOptions(index, context, options);
53
- options.experiments ??= {};
54
- options.experiments.parallelCodeSplitting ??= true;
55
- }
56
- }
57
- function createStatsAPINewCodeSplittingCase(name, src, dist, testConfig) {
58
- const caseConfig = require(testConfig);
59
- const runner = (0, simple_1.getSimpleProcessorRunner)(src, dist);
60
- it(caseConfig.description, async () => {
61
- await runner(name, new NewCodeSplittingStatsAPIProcessor({
62
- name: name,
63
- snapshotName: "NewCodeSplittingStatsOutput",
64
- compilerType: type_1.ECompilerType.Rspack,
65
- ...caseConfig
66
- }));
67
- });
68
- }
69
- class NewCodeSplittingStatsAPIProcessor extends processor_1.StatsAPIProcessor {
70
- constructor(_statsAPIOptions) {
71
- super({
72
- ..._statsAPIOptions,
73
- options: context => {
74
- const res = _statsAPIOptions.options?.(context) || {};
75
- res.experiments ??= {};
76
- res.experiments.parallelCodeSplitting ??= true;
77
- return res;
78
- }
79
- });
80
- this._statsAPIOptions = _statsAPIOptions;
81
- }
82
- }