@rspack-canary/test-tools 1.6.0-canary-6cd722f4-20251022123039 → 1.6.0-canary-e28e40e9-20251022173516
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/dist/case/builtin.d.ts +3 -2
- package/dist/case/cache.d.ts +2 -2
- package/dist/case/cache.js +4 -1
- package/dist/case/common.d.ts +11 -10
- package/dist/case/common.js +2 -5
- package/dist/case/compiler.d.ts +9 -8
- package/dist/case/config.d.ts +6 -5
- package/dist/case/defaults.d.ts +5 -4
- package/dist/case/defaults.js +1 -1
- package/dist/case/error.d.ts +5 -5
- package/dist/case/hash.d.ts +2 -2
- package/dist/case/hook.d.ts +4 -3
- package/dist/case/hot-step.d.ts +2 -2
- package/dist/case/hot-step.js +1 -2
- package/dist/case/hot.d.ts +5 -4
- package/dist/case/incremental.d.ts +2 -2
- package/dist/case/index.d.ts +0 -1
- package/dist/case/index.js +1 -3
- package/dist/case/multi-compiler.d.ts +9 -8
- package/dist/case/runner.d.ts +5 -4
- package/dist/case/serial.d.ts +2 -2
- package/dist/case/stats-api.d.ts +6 -5
- package/dist/case/stats-api.js +1 -2
- package/dist/case/stats-output.d.ts +3 -2
- package/dist/case/watch.d.ts +6 -6
- package/dist/case/watch.js +2 -1
- package/dist/compiler.d.ts +15 -17
- package/dist/compiler.js +4 -11
- package/dist/helper/legacy/checkArrayExpectation.js +1 -1
- package/dist/helper/read-config-file.d.ts +3 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/plugin/index.d.ts +0 -3
- package/dist/plugin/index.js +0 -3
- package/dist/runner/node/index.d.ts +9 -8
- package/dist/runner/node/index.js +3 -1
- package/dist/runner/web/index.d.ts +5 -5
- package/dist/test/context.d.ts +4 -4
- package/dist/test/context.js +5 -13
- package/dist/test/creator.d.ts +14 -14
- package/dist/test/creator.js +3 -4
- package/dist/type.d.ts +27 -40
- package/dist/type.js +1 -6
- package/package.json +4 -9
- package/dist/case/diff.d.ts +0 -19
- package/dist/case/diff.js +0 -274
- package/dist/compare/comparator.d.ts +0 -17
- package/dist/compare/comparator.js +0 -52
- package/dist/compare/compare.d.ts +0 -17
- package/dist/compare/compare.js +0 -178
- package/dist/compare/format-code.d.ts +0 -16
- package/dist/compare/format-code.js +0 -244
- package/dist/compare/index.d.ts +0 -5
- package/dist/compare/index.js +0 -21
- package/dist/compare/replace-module-argument.d.ts +0 -1
- package/dist/compare/replace-module-argument.js +0 -8
- package/dist/compare/replace-runtime-module-name.d.ts +0 -1
- package/dist/compare/replace-runtime-module-name.js +0 -71
- package/dist/plugin/rspack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/rspack-diff-config-plugin.js +0 -42
- package/dist/plugin/webpack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/webpack-diff-config-plugin.js +0 -41
- package/dist/plugin/webpack-module-placeholder-plugin.d.ts +0 -3
- package/dist/plugin/webpack-module-placeholder-plugin.js +0 -106
- package/template/diff.bundle.css +0 -1
- package/template/diff.bundle.js +0 -144
- package/template/diff.html +0 -14
- package/template/editor.worker.js +0 -1
package/dist/case/builtin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
2
3
|
export declare function createBuiltinCase(name: string, src: string, dist: string): void;
|
|
3
|
-
export declare function defaultOptions
|
|
4
|
+
export declare function defaultOptions(context: ITestContext): RspackOptions;
|
package/dist/case/cache.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function createCacheCase(name: string, src: string, dist: string, target:
|
|
1
|
+
import { type RspackOptions } from "@rspack/core";
|
|
2
|
+
export declare function createCacheCase(name: string, src: string, dist: string, target: RspackOptions["target"], temp: string): void;
|
package/dist/case/cache.js
CHANGED
|
@@ -137,7 +137,10 @@ function findBundle(name, target, context) {
|
|
|
137
137
|
const stats = compiler.getStats();
|
|
138
138
|
if (!stats)
|
|
139
139
|
throw new Error("Stats should exists when find bundle");
|
|
140
|
-
const info = stats.toJson({
|
|
140
|
+
const info = stats.toJson({
|
|
141
|
+
all: false,
|
|
142
|
+
entrypoints: true
|
|
143
|
+
});
|
|
141
144
|
if (target === "web" || target === "webworker") {
|
|
142
145
|
for (const file of info.entrypoints.main.assets) {
|
|
143
146
|
if ((0, helper_1.isJavaScript)(file.name)) {
|
package/dist/case/common.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
1
|
+
import type { Compiler, RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestCompilerManager, ITestContext, ITestEnv } from "../type";
|
|
3
|
+
export declare function getCompiler(context: ITestContext, name: string): ITestCompilerManager;
|
|
4
|
+
export declare function config(context: ITestContext, name: string, configFiles: string[], defaultOptions?: RspackOptions): Promise<RspackOptions>;
|
|
5
|
+
export declare function compiler(context: ITestContext, name: string): Promise<Compiler>;
|
|
6
|
+
export declare function build(context: ITestContext, name: string): Promise<Compiler>;
|
|
7
|
+
export declare function run(env: ITestEnv, context: ITestContext, name: string, findBundle: (context: ITestContext, options: RspackOptions) => string[] | string | void): Promise<void>;
|
|
8
|
+
export declare function check(env: ITestEnv, context: ITestContext, name: string): Promise<void>;
|
|
9
|
+
export declare function checkSnapshot(env: ITestEnv, context: ITestContext, name: string, snapshot: string, filter?: (file: string) => boolean): Promise<void>;
|
|
9
10
|
export declare function afterExecute(context: ITestContext, name: string): Promise<void>;
|
|
10
|
-
export declare function findMultiCompilerBundle
|
|
11
|
-
export declare function configMultiCompiler
|
|
11
|
+
export declare function findMultiCompilerBundle(context: ITestContext, name: string, multiFindBundle: (index: number, context: ITestContext, options: RspackOptions) => string[] | string | void): string[];
|
|
12
|
+
export declare function configMultiCompiler(context: ITestContext, name: string, configFiles: string[], defaultOptions: (index: number, context: ITestContext) => RspackOptions, overrideOptions: (index: number, context: ITestContext, options: RspackOptions) => void): void;
|
package/dist/case/common.js
CHANGED
|
@@ -19,9 +19,8 @@ const webpack_merge_1 = __importDefault(require("webpack-merge"));
|
|
|
19
19
|
const helper_1 = require("../helper");
|
|
20
20
|
const placeholder_1 = require("../helper/expect/placeholder");
|
|
21
21
|
const checkArrayExpectation_1 = __importDefault(require("../helper/legacy/checkArrayExpectation"));
|
|
22
|
-
const type_1 = require("../type");
|
|
23
22
|
function getCompiler(context, name) {
|
|
24
|
-
return context.getCompiler(name
|
|
23
|
+
return context.getCompiler(name);
|
|
25
24
|
}
|
|
26
25
|
async function config(context, name, configFiles, defaultOptions = {}) {
|
|
27
26
|
const compiler = getCompiler(context, name);
|
|
@@ -138,9 +137,7 @@ async function checkSnapshot(env, context, name, snapshot, filter) {
|
|
|
138
137
|
const compilers = "compilers" in compiler
|
|
139
138
|
? compiler.compilers
|
|
140
139
|
: [compiler];
|
|
141
|
-
const totalStats = "stats" in stats
|
|
142
|
-
? stats.stats
|
|
143
|
-
: [stats];
|
|
140
|
+
const totalStats = "stats" in stats ? stats.stats : [stats];
|
|
144
141
|
const total = compilers.length;
|
|
145
142
|
for (let i = 0; i < compilers.length; i++) {
|
|
146
143
|
const c = compilers[i];
|
package/dist/case/compiler.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compilation, Compiler, RspackOptions, Stats, StatsCompilation } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
2
3
|
export declare function createCompilerCase(name: string, src: string, dist: string, testConfig: string): void;
|
|
3
4
|
export type TCompilerCaseConfig = {
|
|
4
5
|
description: string;
|
|
5
6
|
error?: boolean;
|
|
6
7
|
skip?: boolean;
|
|
7
|
-
options?: (context: ITestContext) =>
|
|
8
|
-
compiler?: (context: ITestContext, compiler:
|
|
9
|
-
build?: (context: ITestContext, compiler:
|
|
8
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
9
|
+
compiler?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
10
|
+
build?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
10
11
|
check?: ({ context, stats, files, compiler, compilation }: {
|
|
11
12
|
context: ITestContext;
|
|
12
|
-
stats?:
|
|
13
|
+
stats?: StatsCompilation;
|
|
13
14
|
files?: Record<string, string>;
|
|
14
|
-
compiler:
|
|
15
|
-
compilation?:
|
|
15
|
+
compiler: Compiler;
|
|
16
|
+
compilation?: Compilation;
|
|
16
17
|
}) => Promise<void>;
|
|
17
|
-
compilerCallback?: (error: Error | null, stats:
|
|
18
|
+
compilerCallback?: (error: Error | null, stats: Stats | null) => void;
|
|
18
19
|
};
|
package/dist/case/config.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestContext, ITestProcessor, TTestConfig } from "../type";
|
|
3
|
+
export type TConfigCaseConfig = Omit<TTestConfig, "validate">;
|
|
3
4
|
export declare function createConfigProcessor(name: string): ITestProcessor;
|
|
4
5
|
export declare function createConfigCase(name: string, src: string, dist: string): void;
|
|
5
|
-
export declare function defaultOptions(index: number, context: ITestContext):
|
|
6
|
-
export declare function overrideOptions(index: number, context: ITestContext, options:
|
|
7
|
-
export declare function findBundle(index: number, context: ITestContext, options:
|
|
6
|
+
export declare function defaultOptions(index: number, context: ITestContext): RspackOptions;
|
|
7
|
+
export declare function overrideOptions(index: number, context: ITestContext, options: RspackOptions): void;
|
|
8
|
+
export declare function findBundle(index: number, context: ITestContext, options: RspackOptions): string | string[];
|
package/dist/case/defaults.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
2
3
|
export declare function createDefaultsCase(name: string, src: string): void;
|
|
3
|
-
export declare function getRspackDefaultConfig(cwd: string, config:
|
|
4
|
+
export declare function getRspackDefaultConfig(cwd: string, config: RspackOptions): RspackOptions;
|
|
4
5
|
export type TDefaultsCaseConfig = {
|
|
5
|
-
options?: (context: ITestContext) =>
|
|
6
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
6
7
|
cwd?: string;
|
|
7
|
-
diff: (diff: jest.JestMatchers<RspackTestDiff>, defaults: jest.JestMatchers<
|
|
8
|
+
diff: (diff: jest.JestMatchers<RspackTestDiff>, defaults: jest.JestMatchers<RspackOptions>) => Promise<void>;
|
|
8
9
|
description: string;
|
|
9
10
|
};
|
|
10
11
|
declare class RspackTestDiff {
|
package/dist/case/defaults.js
CHANGED
|
@@ -88,7 +88,7 @@ async function run(name, processor) {
|
|
|
88
88
|
context.emitError(name, e);
|
|
89
89
|
}
|
|
90
90
|
finally {
|
|
91
|
-
await processor.check?.({ expect, it, beforeEach, afterEach, jest }, context);
|
|
91
|
+
await processor.check?.({ expect, it, beforeEach, afterEach, jest: global.jest || global.rstest }, context);
|
|
92
92
|
await processor.after?.(context);
|
|
93
93
|
}
|
|
94
94
|
}
|
package/dist/case/error.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StatsError } from "@rspack/core";
|
|
2
|
-
import type {
|
|
1
|
+
import type { Compiler, RspackOptions, StatsError } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
3
3
|
export declare function createErrorCase(name: string, src: string, dist: string, testConfig: string): void;
|
|
4
4
|
declare class RspackStatsDiagnostics {
|
|
5
5
|
errors: StatsError[];
|
|
@@ -9,9 +9,9 @@ declare class RspackStatsDiagnostics {
|
|
|
9
9
|
export type TErrorCaseConfig = {
|
|
10
10
|
description: string;
|
|
11
11
|
skip?: boolean;
|
|
12
|
-
options?: (context: ITestContext) =>
|
|
13
|
-
compiler?: (context: ITestContext, compiler:
|
|
14
|
-
build?: (context: ITestContext, compiler:
|
|
12
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
13
|
+
compiler?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
14
|
+
build?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
15
15
|
check?: (stats: RspackStatsDiagnostics) => Promise<void>;
|
|
16
16
|
};
|
|
17
17
|
export {};
|
package/dist/case/hash.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type THashCaseConfig = Pick<TTestConfig
|
|
1
|
+
import type { TTestConfig } from "../type";
|
|
2
|
+
export type THashCaseConfig = Pick<TTestConfig, "validate">;
|
|
3
3
|
export declare function createHashCase(name: string, src: string, dist: string): void;
|
package/dist/case/hook.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Compiler, type RspackOptions } from "@rspack/core";
|
|
1
2
|
import { TestContext, type TTestContextOptions } from "../test/context";
|
|
2
|
-
import type {
|
|
3
|
+
import type { ITestContext, ITestEnv } from "../type";
|
|
3
4
|
export declare function createHookCase(name: string, src: string, dist: string, source: string): void;
|
|
4
5
|
export declare class HookCasesContext extends TestContext {
|
|
5
6
|
protected src: string;
|
|
@@ -29,8 +30,8 @@ export declare class HookCasesContext extends TestContext {
|
|
|
29
30
|
}): Promise<void>;
|
|
30
31
|
}
|
|
31
32
|
export type THookCaseConfig = {
|
|
32
|
-
options?: (context: ITestContext) =>
|
|
33
|
-
compiler?: (context: ITestContext, compiler:
|
|
33
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
34
|
+
compiler?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
34
35
|
check?: (context: ITestContext) => Promise<void>;
|
|
35
36
|
snapshotFileFilter?: (file: string) => boolean;
|
|
36
37
|
description: string;
|
package/dist/case/hot-step.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createHotStepCase(name: string, src: string, dist: string, temp: string, target:
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
export declare function createHotStepCase(name: string, src: string, dist: string, temp: string, target: RspackOptions["target"]): void;
|
package/dist/case/hot-step.js
CHANGED
|
@@ -9,7 +9,6 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
9
9
|
const helper_1 = require("../helper");
|
|
10
10
|
const placeholder_1 = require("../helper/expect/placeholder");
|
|
11
11
|
const creator_1 = require("../test/creator");
|
|
12
|
-
const type_1 = require("../type");
|
|
13
12
|
const common_1 = require("./common");
|
|
14
13
|
const hot_1 = require("./hot");
|
|
15
14
|
const NOOP_SET = new Set();
|
|
@@ -261,7 +260,7 @@ ${runtime.javascript.disposedModules.map(i => `- ${i}`).join("\n")}
|
|
|
261
260
|
: Array.from(entry.runtime);
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
|
-
const compiler = context.getCompiler(name
|
|
263
|
+
const compiler = context.getCompiler(name);
|
|
265
264
|
const compilerOptions = compiler.getOptions();
|
|
266
265
|
matchStepSnapshot(env, context, updateIndex, compilerOptions, statsJson, runtime);
|
|
267
266
|
hashes.push(stats.hash);
|
package/dist/case/hot.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type RspackOptions } from "@rspack/core";
|
|
1
2
|
import { HotUpdatePlugin } from "../helper/hot-update/plugin";
|
|
2
|
-
import type {
|
|
3
|
-
type TTarget =
|
|
3
|
+
import type { ITestContext, ITestEnv, ITestProcessor, ITestRunner } from "../type";
|
|
4
|
+
type TTarget = RspackOptions["target"];
|
|
4
5
|
export declare function createHotProcessor(name: string, src: string, temp: string, target: TTarget, incremental?: boolean): THotProcessor;
|
|
5
|
-
export declare function createHotCase(name: string, src: string, dist: string, temp: string, target:
|
|
6
|
+
export declare function createHotCase(name: string, src: string, dist: string, temp: string, target: RspackOptions["target"]): void;
|
|
6
7
|
type THotProcessor = ITestProcessor & {
|
|
7
8
|
updatePlugin: HotUpdatePlugin;
|
|
8
9
|
};
|
|
9
|
-
export declare function createHotRunner
|
|
10
|
+
export declare function createHotRunner(context: ITestContext, name: string, file: string, env: ITestEnv): ITestRunner;
|
|
10
11
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createHotIncrementalCase(name: string, src: string, dist: string, temp: string, target:
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
export declare function createHotIncrementalCase(name: string, src: string, dist: string, temp: string, target: RspackOptions["target"], webpackCases: boolean): void;
|
|
3
3
|
export type WatchIncrementalOptions = {
|
|
4
4
|
ignoreNotFriendlyForIncrementalWarnings?: boolean;
|
|
5
5
|
};
|
package/dist/case/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type { TDefaultsCaseConfig } from "./defaults";
|
|
|
8
8
|
export { createDefaultsCase, getRspackDefaultConfig } from "./defaults";
|
|
9
9
|
export type { TDiagnosticOptions } from "./diagnostic";
|
|
10
10
|
export { createDiagnosticCase } from "./diagnostic";
|
|
11
|
-
export { createDiffCase } from "./diff";
|
|
12
11
|
export type { TErrorCaseConfig } from "./error";
|
|
13
12
|
export { createErrorCase } from "./error";
|
|
14
13
|
export { createEsmOutputCase } from "./esm-output";
|
package/dist/case/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWatchCase = exports.createTreeShakingCase = exports.createStatsOutputCase = exports.createStatsAPICase = exports.createSerialCase = exports.createProdNormalCase = exports.createNormalCase = exports.createHotNormalCase = exports.createDevNormalCase = exports.createNativeWatcher = exports.createMultiCompilerCase = exports.createWatchIncrementalCase = exports.createHotIncrementalCase = exports.createHotStepCase = exports.createHotCase = exports.createHookCase = exports.createHashCase = exports.createExampleCase = exports.createEsmOutputCase = exports.createErrorCase = exports.
|
|
3
|
+
exports.createWatchCase = exports.createTreeShakingCase = exports.createStatsOutputCase = exports.createStatsAPICase = exports.createSerialCase = exports.createProdNormalCase = exports.createNormalCase = exports.createHotNormalCase = exports.createDevNormalCase = exports.createNativeWatcher = exports.createMultiCompilerCase = exports.createWatchIncrementalCase = exports.createHotIncrementalCase = exports.createHotStepCase = exports.createHotCase = exports.createHookCase = exports.createHashCase = exports.createExampleCase = exports.createEsmOutputCase = exports.createErrorCase = exports.createDiagnosticCase = exports.getRspackDefaultConfig = exports.createDefaultsCase = exports.createConfigCase = exports.createCompilerCase = exports.createCacheCase = exports.createBuiltinCase = void 0;
|
|
4
4
|
var builtin_1 = require("./builtin");
|
|
5
5
|
Object.defineProperty(exports, "createBuiltinCase", { enumerable: true, get: function () { return builtin_1.createBuiltinCase; } });
|
|
6
6
|
var cache_1 = require("./cache");
|
|
@@ -14,8 +14,6 @@ Object.defineProperty(exports, "createDefaultsCase", { enumerable: true, get: fu
|
|
|
14
14
|
Object.defineProperty(exports, "getRspackDefaultConfig", { enumerable: true, get: function () { return defaults_1.getRspackDefaultConfig; } });
|
|
15
15
|
var diagnostic_1 = require("./diagnostic");
|
|
16
16
|
Object.defineProperty(exports, "createDiagnosticCase", { enumerable: true, get: function () { return diagnostic_1.createDiagnosticCase; } });
|
|
17
|
-
var diff_1 = require("./diff");
|
|
18
|
-
Object.defineProperty(exports, "createDiffCase", { enumerable: true, get: function () { return diff_1.createDiffCase; } });
|
|
19
17
|
var error_1 = require("./error");
|
|
20
18
|
Object.defineProperty(exports, "createErrorCase", { enumerable: true, get: function () { return error_1.createErrorCase; } });
|
|
21
19
|
var esm_output_1 = require("./esm-output");
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compilation, Compiler, RspackOptions, Stats, StatsCompilation } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
2
3
|
export declare function createMultiCompilerCase(name: string, src: string, dist: string, testConfig: string): void;
|
|
3
4
|
export type TMultiCompilerCaseConfig = {
|
|
4
5
|
description: string;
|
|
5
6
|
error?: boolean;
|
|
6
7
|
skip?: boolean;
|
|
7
|
-
options?: (context: ITestContext) =>
|
|
8
|
-
compiler?: (context: ITestContext, compiler:
|
|
9
|
-
build?: (context: ITestContext, compiler:
|
|
8
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
9
|
+
compiler?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
10
|
+
build?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
10
11
|
check?: ({ context, stats, files, compiler, compilation }: {
|
|
11
12
|
context: ITestContext;
|
|
12
|
-
stats?:
|
|
13
|
+
stats?: StatsCompilation;
|
|
13
14
|
files?: Record<string, string>;
|
|
14
|
-
compiler:
|
|
15
|
-
compilation?:
|
|
15
|
+
compiler: Compiler;
|
|
16
|
+
compilation?: Compilation;
|
|
16
17
|
}) => Promise<void>;
|
|
17
|
-
compilerCallback?: (error: Error | null, stats:
|
|
18
|
+
compilerCallback?: (error: Error | null, stats: Stats | null) => void;
|
|
18
19
|
};
|
package/dist/case/runner.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StatsCompilation } from "@rspack/core";
|
|
2
|
+
import type { ITestContext, ITestEnv, ITestRunner } from "../type";
|
|
2
3
|
export type THotStepRuntimeLangData = {
|
|
3
4
|
outdatedModules: string[];
|
|
4
5
|
outdatedDependencies: Record<string, string[]>;
|
|
@@ -12,7 +13,7 @@ export type THotStepRuntimeData = {
|
|
|
12
13
|
css: THotStepRuntimeLangData;
|
|
13
14
|
statusPath: string[];
|
|
14
15
|
};
|
|
15
|
-
export declare function cachedStats
|
|
16
|
-
export declare function createRunner
|
|
16
|
+
export declare function cachedStats(context: ITestContext, name: string): () => StatsCompilation;
|
|
17
|
+
export declare function createRunner(context: ITestContext, name: string, file: string, env: ITestEnv): ITestRunner;
|
|
17
18
|
export declare function getMultiCompilerRunnerKey(context: ITestContext, name: string, file: string): string;
|
|
18
|
-
export declare function createMultiCompilerRunner
|
|
19
|
+
export declare function createMultiCompilerRunner(context: ITestContext, name: string, file: string, env: ITestEnv): ITestRunner;
|
package/dist/case/serial.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type TSerialCaseConfig = Omit<TTestConfig
|
|
1
|
+
import type { TTestConfig } from "../type";
|
|
2
|
+
export type TSerialCaseConfig = Omit<TTestConfig, "validate">;
|
|
3
3
|
export declare function createSerialCase(name: string, src: string, dist: string): void;
|
package/dist/case/stats-api.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compiler, RspackOptions, Stats } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
2
3
|
export type TStatsAPICaseConfig = {
|
|
3
4
|
description: string;
|
|
4
|
-
options?: (context: ITestContext) =>
|
|
5
|
+
options?: (context: ITestContext) => RspackOptions;
|
|
5
6
|
snapshotName?: string;
|
|
6
|
-
compiler?: (context: ITestContext, compiler:
|
|
7
|
-
build?: (context: ITestContext, compiler:
|
|
8
|
-
check?: (stats:
|
|
7
|
+
compiler?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
8
|
+
build?: (context: ITestContext, compiler: Compiler) => Promise<void>;
|
|
9
|
+
check?: (stats: Stats, compiler: Compiler) => Promise<void>;
|
|
9
10
|
};
|
|
10
11
|
export declare function createStatsAPICase(name: string, src: string, dist: string, testConfig: string): void;
|
package/dist/case/stats-api.js
CHANGED
|
@@ -52,8 +52,7 @@ function createStatsAPICase(name, src, dist, testConfig) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function options(context, custom) {
|
|
55
|
-
const res = (custom?.(context) ||
|
|
56
|
-
{});
|
|
55
|
+
const res = (custom?.(context) || {});
|
|
57
56
|
res.experiments ??= {};
|
|
58
57
|
res.experiments.css ??= true;
|
|
59
58
|
res.experiments.rspackFuture ??= {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestContext, ITestEnv } from "../type";
|
|
3
|
+
export declare function createStatsProcessor(name: string, defaultOptions: (index: number, context: ITestContext) => RspackOptions, overrideOptions: (index: number, context: ITestContext, options: RspackOptions) => void): {
|
|
3
4
|
before: (context: ITestContext) => Promise<void>;
|
|
4
5
|
config: (context: ITestContext) => Promise<void>;
|
|
5
6
|
compiler: (context: ITestContext) => Promise<void>;
|
package/dist/case/watch.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ITestContext, ITestEnv, ITestRunner } from "../type";
|
|
2
2
|
export declare function createWatchInitialProcessor(name: string, tempDir: string, step: string, watchState: Record<string, any>, { incremental, nativeWatcher }?: {
|
|
3
3
|
incremental?: boolean | undefined;
|
|
4
4
|
nativeWatcher?: boolean | undefined;
|
|
5
5
|
}): {
|
|
6
6
|
before: (context: ITestContext) => Promise<void>;
|
|
7
|
-
config:
|
|
7
|
+
config: (context: ITestContext) => Promise<void>;
|
|
8
8
|
compiler: (context: ITestContext) => Promise<void>;
|
|
9
9
|
build: (context: ITestContext) => Promise<void>;
|
|
10
10
|
run: (env: ITestEnv, context: ITestContext) => Promise<void>;
|
|
11
|
-
check:
|
|
11
|
+
check: (env: ITestEnv, context: ITestContext) => Promise<void>;
|
|
12
12
|
after: (context: ITestContext) => Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
export declare function createWatchStepProcessor(name: string, tempDir: string, step: string, watchState: Record<string, any>, { incremental, nativeWatcher }?: {
|
|
@@ -16,13 +16,13 @@ export declare function createWatchStepProcessor(name: string, tempDir: string,
|
|
|
16
16
|
nativeWatcher?: boolean | undefined;
|
|
17
17
|
}): {
|
|
18
18
|
before: (context: ITestContext) => Promise<void>;
|
|
19
|
-
config:
|
|
19
|
+
config: (context: ITestContext) => Promise<void>;
|
|
20
20
|
compiler: (context: ITestContext) => Promise<void>;
|
|
21
21
|
build: (context: ITestContext) => Promise<void>;
|
|
22
22
|
run: (env: ITestEnv, context: ITestContext) => Promise<void>;
|
|
23
|
-
check:
|
|
23
|
+
check: (env: ITestEnv, context: ITestContext) => Promise<void>;
|
|
24
24
|
after: (context: ITestContext) => Promise<void>;
|
|
25
25
|
};
|
|
26
26
|
export declare function createWatchCase(name: string, src: string, dist: string, temp: string): void;
|
|
27
27
|
export declare function getWatchRunnerKey(context: ITestContext, name: string, file: string): string;
|
|
28
|
-
export declare function createWatchRunner
|
|
28
|
+
export declare function createWatchRunner(context: ITestContext, name: string, file: string, env: ITestEnv): ITestRunner;
|
package/dist/case/watch.js
CHANGED
|
@@ -252,7 +252,8 @@ function overrideOptions(index, context, options, tempDir, nativeWatcher) {
|
|
|
252
252
|
}
|
|
253
253
|
options.experiments.rspackFuture ??= {};
|
|
254
254
|
options.experiments.rspackFuture.bundlerInfo ??= {};
|
|
255
|
-
options.experiments.rspackFuture.bundlerInfo.force ??=
|
|
255
|
+
options.experiments.rspackFuture.bundlerInfo.force ??=
|
|
256
|
+
false;
|
|
256
257
|
// test incremental: "safe" here, we test default incremental in Incremental-*.test.js
|
|
257
258
|
options.experiments.incremental ??= "safe";
|
|
258
259
|
if (!global.printLogger) {
|
package/dist/compiler.d.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import EventEmitter from "node:events";
|
|
2
|
-
import
|
|
2
|
+
import type { Compiler, RspackOptions, Stats } from "@rspack/core";
|
|
3
|
+
import type { ITestCompilerManager } from "./type";
|
|
3
4
|
export declare enum ECompilerEvent {
|
|
4
5
|
Build = "build",
|
|
5
6
|
Option = "option",
|
|
6
7
|
Create = "create",
|
|
7
8
|
Close = "close"
|
|
8
9
|
}
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
protected
|
|
12
|
-
protected
|
|
13
|
-
protected compilerOptions: TCompilerOptions<T>;
|
|
14
|
-
protected compilerInstance: TCompiler<T> | null;
|
|
15
|
-
protected compilerStats: TCompilerStats<T> | null;
|
|
10
|
+
export declare class TestCompilerManager implements ITestCompilerManager {
|
|
11
|
+
protected compilerOptions: RspackOptions;
|
|
12
|
+
protected compilerInstance: Compiler | null;
|
|
13
|
+
protected compilerStats: Stats | null;
|
|
16
14
|
protected emitter: EventEmitter;
|
|
17
|
-
constructor(
|
|
18
|
-
getOptions():
|
|
19
|
-
setOptions(newOptions:
|
|
20
|
-
mergeOptions(newOptions:
|
|
21
|
-
getCompiler():
|
|
22
|
-
createCompiler():
|
|
23
|
-
createCompilerWithCallback(callback: (error: Error | null, stats:
|
|
24
|
-
build(): Promise<
|
|
15
|
+
constructor();
|
|
16
|
+
getOptions(): RspackOptions;
|
|
17
|
+
setOptions(newOptions: RspackOptions): RspackOptions;
|
|
18
|
+
mergeOptions(newOptions: RspackOptions): RspackOptions;
|
|
19
|
+
getCompiler(): Compiler | null;
|
|
20
|
+
createCompiler(): Compiler;
|
|
21
|
+
createCompilerWithCallback(callback: (error: Error | null, stats: Stats | null) => void): Compiler;
|
|
22
|
+
build(): Promise<Stats>;
|
|
25
23
|
watch(timeout?: number): void;
|
|
26
|
-
getStats():
|
|
24
|
+
getStats(): Stats | null;
|
|
27
25
|
getEmitter(): EventEmitter<[never]>;
|
|
28
26
|
close(): Promise<void>;
|
|
29
27
|
}
|
package/dist/compiler.js
CHANGED
|
@@ -3,10 +3,9 @@ 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.TestCompilerManager = exports.
|
|
6
|
+
exports.TestCompilerManager = exports.ECompilerEvent = void 0;
|
|
7
7
|
const node_events_1 = __importDefault(require("node:events"));
|
|
8
8
|
const webpack_merge_1 = __importDefault(require("webpack-merge"));
|
|
9
|
-
const type_1 = require("./type");
|
|
10
9
|
var ECompilerEvent;
|
|
11
10
|
(function (ECompilerEvent) {
|
|
12
11
|
ECompilerEvent["Build"] = "build";
|
|
@@ -14,14 +13,8 @@ var ECompilerEvent;
|
|
|
14
13
|
ECompilerEvent["Create"] = "create";
|
|
15
14
|
ECompilerEvent["Close"] = "close";
|
|
16
15
|
})(ECompilerEvent || (exports.ECompilerEvent = ECompilerEvent = {}));
|
|
17
|
-
exports.COMPILER_FACTORIES = {
|
|
18
|
-
[type_1.ECompilerType.Rspack]: ((options, callback) => require("@rspack/core")(options, callback)),
|
|
19
|
-
[type_1.ECompilerType.Webpack]: ((options, callback) => require("webpack")(options, callback))
|
|
20
|
-
};
|
|
21
16
|
class TestCompilerManager {
|
|
22
|
-
constructor(
|
|
23
|
-
this.type = type;
|
|
24
|
-
this.factories = factories;
|
|
17
|
+
constructor() {
|
|
25
18
|
this.compilerOptions = {};
|
|
26
19
|
this.compilerInstance = null;
|
|
27
20
|
this.compilerStats = null;
|
|
@@ -44,12 +37,12 @@ class TestCompilerManager {
|
|
|
44
37
|
return this.compilerInstance;
|
|
45
38
|
}
|
|
46
39
|
createCompiler() {
|
|
47
|
-
this.compilerInstance =
|
|
40
|
+
this.compilerInstance = require("@rspack/core")(this.compilerOptions);
|
|
48
41
|
this.emitter.emit(ECompilerEvent.Create, this.compilerInstance);
|
|
49
42
|
return this.compilerInstance;
|
|
50
43
|
}
|
|
51
44
|
createCompilerWithCallback(callback) {
|
|
52
|
-
this.compilerInstance =
|
|
45
|
+
this.compilerInstance = require("@rspack/core")(this.compilerOptions, callback);
|
|
53
46
|
this.emitter.emit(ECompilerEvent.Create, this.compilerInstance);
|
|
54
47
|
return this.compilerInstance;
|
|
55
48
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import type { ITestContext } from "../type";
|
|
3
|
+
export declare function readConfigFile(files: string[], context: ITestContext, prevOption?: RspackOptions, functionApply?: (config: (RspackOptions | ((...args: unknown[]) => RspackOptions))[]) => RspackOptions[]): RspackOptions[];
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./case"), exports);
|
|
18
|
-
__exportStar(require("./compare"), exports);
|
|
19
18
|
__exportStar(require("./helper"), exports);
|
|
20
19
|
__exportStar(require("./plugin"), exports);
|
|
21
20
|
__exportStar(require("./runner"), exports);
|
package/dist/plugin/index.d.ts
CHANGED
package/dist/plugin/index.js
CHANGED
|
@@ -15,6 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lazy-compilation-test-plugin"), exports);
|
|
18
|
-
__exportStar(require("./rspack-diff-config-plugin"), exports);
|
|
19
|
-
__exportStar(require("./webpack-diff-config-plugin"), exports);
|
|
20
|
-
__exportStar(require("./webpack-module-placeholder-plugin"), exports);
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { RspackOptions, StatsCompilation } from "@rspack/core";
|
|
2
|
+
import { type IGlobalContext, type IModuleScope, type ITestEnv, type ITestRunner, type TModuleObject, type TRunnerFile, type TRunnerRequirer, type TTestConfig } from "../../type";
|
|
2
3
|
declare global {
|
|
3
4
|
var printLogger: boolean;
|
|
4
5
|
}
|
|
5
|
-
export interface INodeRunnerOptions
|
|
6
|
+
export interface INodeRunnerOptions {
|
|
6
7
|
env: ITestEnv;
|
|
7
|
-
stats?: () =>
|
|
8
|
+
stats?: () => StatsCompilation;
|
|
8
9
|
name: string;
|
|
9
10
|
runInNewContext?: boolean;
|
|
10
|
-
testConfig: TTestConfig
|
|
11
|
+
testConfig: TTestConfig;
|
|
11
12
|
source: string;
|
|
12
13
|
dist: string;
|
|
13
|
-
compilerOptions:
|
|
14
|
+
compilerOptions: RspackOptions;
|
|
14
15
|
cachable?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare class NodeRunner
|
|
17
|
-
protected _options: INodeRunnerOptions
|
|
17
|
+
export declare class NodeRunner implements ITestRunner {
|
|
18
|
+
protected _options: INodeRunnerOptions;
|
|
18
19
|
protected requireCache: any;
|
|
19
20
|
protected globalContext: IGlobalContext | null;
|
|
20
21
|
protected baseModuleScope: IModuleScope | null;
|
|
21
22
|
protected requirers: Map<string, TRunnerRequirer>;
|
|
22
|
-
constructor(_options: INodeRunnerOptions
|
|
23
|
+
constructor(_options: INodeRunnerOptions);
|
|
23
24
|
run(file: string): Promise<unknown>;
|
|
24
25
|
getRequire(): TRunnerRequirer;
|
|
25
26
|
getGlobal(name: string): unknown;
|
|
@@ -81,7 +81,9 @@ class NodeRunner {
|
|
|
81
81
|
this._options.testConfig.moduleScope(this.baseModuleScope, this._options.stats, this._options.compilerOptions);
|
|
82
82
|
}
|
|
83
83
|
this.createRunner();
|
|
84
|
-
const res = this.getRequire()(this._options.dist, file.startsWith("./") ||
|
|
84
|
+
const res = this.getRequire()(node_path_1.default.isAbsolute(file) ? node_path_1.default.dirname(file) : this._options.dist, file.startsWith("./") ||
|
|
85
|
+
file.startsWith("https://test.cases/") ||
|
|
86
|
+
node_path_1.default.isAbsolute(file)
|
|
85
87
|
? file
|
|
86
88
|
: `./${file}`);
|
|
87
89
|
if (typeof res === "object" && "then" in res) {
|