@rspack/test-tools 1.3.14 → 1.4.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.
@@ -0,0 +1,6 @@
1
+ import { ECompilerType, type TCompilerOptions } from "../type";
2
+ export declare function createHotIncrementalCase(name: string, src: string, dist: string, target: TCompilerOptions<ECompilerType.Rspack>["target"], webpackCases: boolean): void;
3
+ export type WatchIncrementalOptions = {
4
+ ignoreNotFriendlyForIncrementalWarnings?: boolean;
5
+ };
6
+ export declare function createWatchIncrementalCase(name: string, src: string, dist: string, temp: string, options?: WatchIncrementalOptions): void;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createHotNewIncrementalCase = createHotNewIncrementalCase;
7
- exports.createWatchNewIncrementalCase = createWatchNewIncrementalCase;
6
+ exports.createHotIncrementalCase = createHotIncrementalCase;
7
+ exports.createWatchIncrementalCase = createWatchIncrementalCase;
8
8
  const node_fs_1 = __importDefault(require("node:fs"));
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
- const hot_new_incremental_1 = require("../processor/hot-new-incremental");
10
+ const hot_incremental_1 = require("../processor/hot-incremental");
11
11
  const watch_1 = require("../processor/watch");
12
12
  const runner_1 = require("../runner");
13
13
  const creator_1 = require("../test/creator");
@@ -21,7 +21,7 @@ function getHotCreator(target, webpackCases) {
21
21
  describe: true,
22
22
  target,
23
23
  steps: ({ name, target }) => [
24
- new hot_new_incremental_1.HotNewIncrementalProcessor({
24
+ new hot_incremental_1.HotIncrementalProcessor({
25
25
  name,
26
26
  target: target,
27
27
  compilerType: type_1.ECompilerType.Rspack,
@@ -35,7 +35,7 @@ function getHotCreator(target, webpackCases) {
35
35
  }
36
36
  return hotCreators.get(key);
37
37
  }
38
- function createHotNewIncrementalCase(name, src, dist, target, webpackCases) {
38
+ function createHotIncrementalCase(name, src, dist, target, webpackCases) {
39
39
  const creator = getHotCreator(target, webpackCases);
40
40
  creator.create(name, src, dist);
41
41
  }
@@ -94,7 +94,7 @@ function getWatchCreator(options) {
94
94
  }
95
95
  return watchCreators.get(key);
96
96
  }
97
- function createWatchNewIncrementalCase(name, src, dist, temp, options = {}) {
97
+ function createWatchIncrementalCase(name, src, dist, temp, options = {}) {
98
98
  const creator = getWatchCreator(options);
99
99
  creator.create(name, src, dist, temp);
100
100
  }
@@ -14,6 +14,6 @@ export * from "./stats-api";
14
14
  export * from "./stats-output";
15
15
  export * from "./treeshaking";
16
16
  export * from "./watch";
17
- export * from "./new-incremental";
17
+ export * from "./incremental";
18
18
  export * from "./cache";
19
19
  export * from "./serial";
@@ -30,6 +30,6 @@ __exportStar(require("./stats-api"), exports);
30
30
  __exportStar(require("./stats-output"), exports);
31
31
  __exportStar(require("./treeshaking"), exports);
32
32
  __exportStar(require("./watch"), exports);
33
- __exportStar(require("./new-incremental"), exports);
33
+ __exportStar(require("./incremental"), exports);
34
34
  __exportStar(require("./cache"), exports);
35
35
  __exportStar(require("./serial"), exports);
@@ -6,7 +6,7 @@ exports.checkChunkModules = function checkChunkModules(statsJson, chunkModulesMa
6
6
  const expectedModules = chunkModulesMap[chunkId];
7
7
  const chunkModules = chunk.modules.map(m => m.identifier);
8
8
  if (strict && expectedModules.length !== chunkModules.length) {
9
- throw new Error(`expect chunk ${chunkId} has ${chunkModules.length} modules: ${chunkModules}\nbut received ${chunkModules.length} modules`);
9
+ throw new Error(`expect chunk ${chunkId} has ${expectedModules.length} modules: ${expectedModules}\nbut received ${chunkModules.length} modules`);
10
10
  }
11
11
  for (const module of expectedModules) {
12
12
  if (!chunkModules.find(moduleId => moduleId.includes(module))) {
@@ -0,0 +1,14 @@
1
+ import { ECompilerType, type ITestContext, type ITestEnv, type TCompilerOptions } from "../type";
2
+ import type { IBasicProcessorOptions } from "./basic";
3
+ import { HotProcessor } from "./hot";
4
+ export interface IHotIncrementalProcessorOptions<T extends ECompilerType> extends Omit<IBasicProcessorOptions<T>, "runable"> {
5
+ target: TCompilerOptions<T>["target"];
6
+ webpackCases: boolean;
7
+ }
8
+ export declare class HotIncrementalProcessor<T extends ECompilerType> extends HotProcessor<T> {
9
+ protected _hotOptions: IHotIncrementalProcessorOptions<T>;
10
+ constructor(_hotOptions: IHotIncrementalProcessorOptions<T>);
11
+ run(env: ITestEnv, context: ITestContext): Promise<void>;
12
+ afterAll(context: ITestContext): Promise<void>;
13
+ static defaultOptions<T extends ECompilerType>(this: HotIncrementalProcessor<T>, context: ITestContext): TCompilerOptions<T>;
14
+ }
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HotNewIncrementalProcessor = void 0;
3
+ exports.HotIncrementalProcessor = void 0;
4
4
  const type_1 = require("../type");
5
5
  const hot_1 = require("./hot");
6
- class HotNewIncrementalProcessor extends hot_1.HotProcessor {
6
+ class HotIncrementalProcessor extends hot_1.HotProcessor {
7
7
  constructor(_hotOptions) {
8
8
  super({
9
- defaultOptions: HotNewIncrementalProcessor.defaultOptions,
9
+ defaultOptions: HotIncrementalProcessor.defaultOptions,
10
10
  ..._hotOptions
11
11
  });
12
12
  this._hotOptions = _hotOptions;
@@ -35,9 +35,9 @@ class HotNewIncrementalProcessor extends hot_1.HotProcessor {
35
35
  rspackOptions.experiments.incremental ??= "advance-silent";
36
36
  }
37
37
  else {
38
- throw new Error("HotNewIncrementalProcessor should only used for Rspack.");
38
+ throw new Error("HotIncrementalProcessor should only used for Rspack.");
39
39
  }
40
40
  return options;
41
41
  }
42
42
  }
43
- exports.HotNewIncrementalProcessor = HotNewIncrementalProcessor;
43
+ exports.HotIncrementalProcessor = HotIncrementalProcessor;
@@ -87,6 +87,8 @@ class HotProcessor extends basic_1.BasicProcessor {
87
87
  target: this._hotOptions.target,
88
88
  experiments: {
89
89
  css: true,
90
+ // test incremental: "safe" here, we test default incremental in Incremental-*.test.js
91
+ incremental: "safe",
90
92
  rspackFuture: {
91
93
  bundlerInfo: {
92
94
  force: false
@@ -8,7 +8,7 @@ export * from "./error";
8
8
  export * from "./hash";
9
9
  export * from "./hook";
10
10
  export * from "./hot";
11
- export * from "./hot-new-incremental";
11
+ export * from "./hot-incremental";
12
12
  export * from "./hot-step";
13
13
  export * from "./multi";
14
14
  export * from "./normal";
@@ -24,7 +24,7 @@ __exportStar(require("./error"), exports);
24
24
  __exportStar(require("./hash"), exports);
25
25
  __exportStar(require("./hook"), exports);
26
26
  __exportStar(require("./hot"), exports);
27
- __exportStar(require("./hot-new-incremental"), exports);
27
+ __exportStar(require("./hot-incremental"), exports);
28
28
  __exportStar(require("./hot-step"), exports);
29
29
  __exportStar(require("./multi"), exports);
30
30
  __exportStar(require("./normal"), exports);
@@ -190,6 +190,8 @@ class WatchProcessor extends multi_1.MultiTaskProcessor {
190
190
  options.experiments.rspackFuture ??= {};
191
191
  options.experiments.rspackFuture.bundlerInfo ??= {};
192
192
  options.experiments.rspackFuture.bundlerInfo.force ??= false;
193
+ // test incremental: "safe" here, we test default incremental in Incremental-*.test.js
194
+ options.experiments.incremental ??= "safe";
193
195
  if (!global.printLogger) {
194
196
  options.infrastructureLogging = {
195
197
  level: "error"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.3.14",
3
+ "version": "1.4.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@babel/generator": "7.27.5",
35
35
  "@babel/parser": "7.27.5",
36
36
  "@babel/traverse": "7.27.4",
37
- "@babel/types": "7.27.3",
37
+ "@babel/types": "7.27.6",
38
38
  "cross-env": "^7.0.3",
39
39
  "csv-to-markdown-table": "^1.5.0",
40
40
  "deepmerge": "^4.3.1",
@@ -48,14 +48,14 @@
48
48
  "jsdom": "^26.1.0",
49
49
  "memfs": "4.17.2",
50
50
  "loader-utils": "^2.0.4",
51
- "path-serializer": "0.4.0",
51
+ "path-serializer": "0.4.1",
52
52
  "pretty-format": "29.7.0",
53
53
  "rimraf": "^5.0.10",
54
54
  "source-map": "^0.7.4",
55
55
  "terser-webpack-plugin": "^5.3.14",
56
56
  "webpack": "5.99.9",
57
57
  "webpack-merge": "6.0.1",
58
- "webpack-sources": "3.3.0"
58
+ "webpack-sources": "3.3.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@rspack/plugin-preact-refresh": "1.1.2",
@@ -66,8 +66,8 @@
66
66
  "@types/babel__traverse": "7.20.7",
67
67
  "@types/fs-extra": "11.0.4",
68
68
  "@types/jsdom": "^21.1.7",
69
- "@types/react": "^19.1.6",
70
- "@types/react-dom": "^19.1.5",
69
+ "@types/react": "^19.1.7",
70
+ "@types/react-dom": "^19.1.6",
71
71
  "@webdiscus/pug-loader": "^2.11.1",
72
72
  "acorn": "^8.14.1",
73
73
  "babel-loader": "^10.0.0",
@@ -91,13 +91,13 @@
91
91
  "source-map": "^0.7.4",
92
92
  "source-map-loader": "^5.0.0",
93
93
  "style-loader": "^4.0.0",
94
- "terser": "5.40.0",
94
+ "terser": "5.41.0",
95
95
  "typescript": "^5.8.3",
96
96
  "wast-loader": "^1.14.1",
97
97
  "worker-rspack-loader": "^3.1.2",
98
- "@rspack/core": "1.3.14",
99
- "@rspack/cli": "1.3.14",
100
- "@rspack/test-tools": "1.3.14"
98
+ "@rspack/cli": "1.4.0-beta.0",
99
+ "@rspack/test-tools": "1.4.0-beta.0",
100
+ "@rspack/core": "1.4.0-beta.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@rspack/core": ">=1.0.0"
@@ -1,6 +0,0 @@
1
- import { ECompilerType, type TCompilerOptions } from "../type";
2
- export declare function createHotNewIncrementalCase(name: string, src: string, dist: string, target: TCompilerOptions<ECompilerType.Rspack>["target"], webpackCases: boolean): void;
3
- export type WatchNewIncrementalOptions = {
4
- ignoreNotFriendlyForIncrementalWarnings?: boolean;
5
- };
6
- export declare function createWatchNewIncrementalCase(name: string, src: string, dist: string, temp: string, options?: WatchNewIncrementalOptions): void;
@@ -1,14 +0,0 @@
1
- import { ECompilerType, type ITestContext, type ITestEnv, type TCompilerOptions } from "../type";
2
- import type { IBasicProcessorOptions } from "./basic";
3
- import { HotProcessor } from "./hot";
4
- export interface IHotNewIncrementalProcessorOptions<T extends ECompilerType> extends Omit<IBasicProcessorOptions<T>, "runable"> {
5
- target: TCompilerOptions<T>["target"];
6
- webpackCases: boolean;
7
- }
8
- export declare class HotNewIncrementalProcessor<T extends ECompilerType> extends HotProcessor<T> {
9
- protected _hotOptions: IHotNewIncrementalProcessorOptions<T>;
10
- constructor(_hotOptions: IHotNewIncrementalProcessorOptions<T>);
11
- run(env: ITestEnv, context: ITestContext): Promise<void>;
12
- afterAll(context: ITestContext): Promise<void>;
13
- static defaultOptions<T extends ECompilerType>(this: HotNewIncrementalProcessor<T>, context: ITestContext): TCompilerOptions<T>;
14
- }