@rspack/test-tools 1.3.13 → 1.3.14

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.
@@ -1,5 +1,5 @@
1
- import { ECompilerType, type EDocumentType, type TCompilerOptions } from "../type";
2
- export declare function createHotNewIncrementalCase(name: string, src: string, dist: string, target: TCompilerOptions<ECompilerType.Rspack>["target"], documentType: EDocumentType): void;
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
3
  export type WatchNewIncrementalOptions = {
4
4
  ignoreNotFriendlyForIncrementalWarnings?: boolean;
5
5
  };
@@ -13,8 +13,8 @@ const runner_1 = require("../runner");
13
13
  const creator_1 = require("../test/creator");
14
14
  const type_1 = require("../type");
15
15
  const hotCreators = new Map();
16
- function getHotCreator(target, documentType) {
17
- const key = JSON.stringify({ target, documentType });
16
+ function getHotCreator(target, webpackCases) {
17
+ const key = JSON.stringify({ target, webpackCases });
18
18
  if (!hotCreators.has(key)) {
19
19
  hotCreators.set(key, new creator_1.BasicCaseCreator({
20
20
  clean: true,
@@ -26,7 +26,7 @@ function getHotCreator(target, documentType) {
26
26
  target: target,
27
27
  compilerType: type_1.ECompilerType.Rspack,
28
28
  configFiles: ["rspack.config.js", "webpack.config.js"],
29
- documentType
29
+ webpackCases
30
30
  })
31
31
  ],
32
32
  runner: runner_1.HotRunnerFactory,
@@ -35,8 +35,8 @@ function getHotCreator(target, documentType) {
35
35
  }
36
36
  return hotCreators.get(key);
37
37
  }
38
- function createHotNewIncrementalCase(name, src, dist, target, documentType) {
39
- const creator = getHotCreator(target, documentType);
38
+ function createHotNewIncrementalCase(name, src, dist, target, webpackCases) {
39
+ const creator = getHotCreator(target, webpackCases);
40
40
  creator.create(name, src, dist);
41
41
  }
42
42
  const watchCreators = new Map();
@@ -1,9 +1,9 @@
1
- import { ECompilerType, EDocumentType, type ITestContext, type ITestEnv, type TCompilerOptions } from "../type";
1
+ import { ECompilerType, type ITestContext, type ITestEnv, type TCompilerOptions } from "../type";
2
2
  import type { IBasicProcessorOptions } from "./basic";
3
3
  import { HotProcessor } from "./hot";
4
4
  export interface IHotNewIncrementalProcessorOptions<T extends ECompilerType> extends Omit<IBasicProcessorOptions<T>, "runable"> {
5
5
  target: TCompilerOptions<T>["target"];
6
- documentType?: EDocumentType;
6
+ webpackCases: boolean;
7
7
  }
8
8
  export declare class HotNewIncrementalProcessor<T extends ECompilerType> extends HotProcessor<T> {
9
9
  protected _hotOptions: IHotNewIncrementalProcessorOptions<T>;
@@ -5,11 +5,14 @@ const type_1 = require("../type");
5
5
  const hot_1 = require("./hot");
6
6
  class HotNewIncrementalProcessor extends hot_1.HotProcessor {
7
7
  constructor(_hotOptions) {
8
- super(_hotOptions);
8
+ super({
9
+ defaultOptions: HotNewIncrementalProcessor.defaultOptions,
10
+ ..._hotOptions
11
+ });
9
12
  this._hotOptions = _hotOptions;
10
13
  }
11
14
  async run(env, context) {
12
- context.setValue(this._options.name, "documentType", this._hotOptions.documentType);
15
+ context.setValue(this._options.name, "documentType", this._hotOptions.webpackCases ? type_1.EDocumentType.Fake : type_1.EDocumentType.JSDOM);
13
16
  await super.run(env, context);
14
17
  }
15
18
  async afterAll(context) {
@@ -29,7 +32,7 @@ class HotNewIncrementalProcessor extends hot_1.HotProcessor {
29
32
  if (this._hotOptions.compilerType === type_1.ECompilerType.Rspack) {
30
33
  const rspackOptions = options;
31
34
  rspackOptions.experiments ??= {};
32
- rspackOptions.experiments.incremental ??= "advance";
35
+ rspackOptions.experiments.incremental ??= "advance-silent";
33
36
  }
34
37
  else {
35
38
  throw new Error("HotNewIncrementalProcessor should only used for Rspack.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -31,9 +31,9 @@
31
31
  "directory": "packages/rspack-test-tools"
32
32
  },
33
33
  "dependencies": {
34
- "@babel/generator": "7.27.3",
35
- "@babel/parser": "7.27.3",
36
- "@babel/traverse": "7.27.3",
34
+ "@babel/generator": "7.27.5",
35
+ "@babel/parser": "7.27.5",
36
+ "@babel/traverse": "7.27.4",
37
37
  "@babel/types": "7.27.3",
38
38
  "cross-env": "^7.0.3",
39
39
  "csv-to-markdown-table": "^1.5.0",
@@ -95,9 +95,9 @@
95
95
  "typescript": "^5.8.3",
96
96
  "wast-loader": "^1.14.1",
97
97
  "worker-rspack-loader": "^3.1.2",
98
- "@rspack/cli": "1.3.13",
99
- "@rspack/core": "1.3.13",
100
- "@rspack/test-tools": "1.3.13"
98
+ "@rspack/core": "1.3.14",
99
+ "@rspack/cli": "1.3.14",
100
+ "@rspack/test-tools": "1.3.14"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@rspack/core": ">=1.0.0"