@rspack/test-tools 1.1.1 → 1.1.3
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,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DefaultsConfigProcessor = void 0;
|
|
4
|
+
const node_util_1 = require("node:util");
|
|
7
5
|
const jest_diff_1 = require("jest-diff");
|
|
8
|
-
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
9
6
|
const simple_1 = require("./simple");
|
|
10
7
|
const CURRENT_CWD = process.cwd();
|
|
11
8
|
class RspackTestDiff {
|
|
@@ -43,7 +40,7 @@ class DefaultsConfigProcessor extends simple_1.SimpleTaskProcessor {
|
|
|
43
40
|
async check(env, context) {
|
|
44
41
|
const compiler = this.getCompiler(context);
|
|
45
42
|
const config = DefaultsConfigProcessor.getDefaultConfig(this._defaultsConfigOptions.cwd || CURRENT_CWD, compiler.getOptions());
|
|
46
|
-
const diff = (0,
|
|
43
|
+
const diff = (0, node_util_1.stripVTControlCharacters)((0, jest_diff_1.diff)(this.defaultConfig, config, { expand: false, contextLines: 0 }));
|
|
47
44
|
await this._defaultsConfigOptions.diff(env.expect(new RspackTestDiff(diff)), env.expect(this.defaultConfig));
|
|
48
45
|
}
|
|
49
46
|
async before(context) { }
|
|
@@ -19,7 +19,7 @@ export declare class WatchProcessor<T extends ECompilerType> extends MultiTaskPr
|
|
|
19
19
|
check(env: ITestEnv, context: ITestContext): Promise<void>;
|
|
20
20
|
config(context: ITestContext): Promise<void>;
|
|
21
21
|
static overrideOptions<T extends ECompilerType>({ tempDir, name, experiments, optimization }: IWatchProcessorOptions<T>): (index: number, context: ITestContext, options: TCompilerOptions<ECompilerType>) => void;
|
|
22
|
-
static findBundle<T extends ECompilerType>(index: number, context: ITestContext, options: TCompilerOptions<T>): string | string[];
|
|
22
|
+
static findBundle<T extends ECompilerType>(this: IWatchProcessorOptions<T>, index: number, context: ITestContext, options: TCompilerOptions<T>): string | string[];
|
|
23
23
|
}
|
|
24
24
|
export interface IWatchStepProcessorOptions<T extends ECompilerType> extends Omit<IWatchProcessorOptions<T>, "experiments" | "optimization"> {
|
|
25
25
|
}
|
package/dist/processor/watch.js
CHANGED
|
@@ -171,7 +171,7 @@ class WatchProcessor extends multi_1.MultiTaskProcessor {
|
|
|
171
171
|
static findBundle(index, context, options) {
|
|
172
172
|
const testConfig = context.getTestConfig();
|
|
173
173
|
if (typeof testConfig.findBundle === "function") {
|
|
174
|
-
return testConfig.findBundle(index, options);
|
|
174
|
+
return testConfig.findBundle(index, options, this.stepName);
|
|
175
175
|
}
|
|
176
176
|
return "./bundle.js";
|
|
177
177
|
}
|
package/dist/type.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export type TTestConfig<T extends ECompilerType> = {
|
|
|
139
139
|
afterExecute?: () => void;
|
|
140
140
|
moduleScope?: (ms: IBasicModuleScope, stats?: TCompilerStatsCompilation<T>) => IBasicModuleScope;
|
|
141
141
|
checkStats?: (stepName: string, stats: TCompilerStatsCompilation<T>) => boolean;
|
|
142
|
-
findBundle?: (index: number, options: TCompilerOptions<T
|
|
142
|
+
findBundle?: (index: number, options: TCompilerOptions<T>, stepName?: string) => string | string[];
|
|
143
143
|
bundlePath?: string[];
|
|
144
144
|
nonEsmThis?: (p: string | string[]) => Object;
|
|
145
145
|
modules?: Record<string, Object>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/test-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"path-serializer": "0.1.2",
|
|
52
52
|
"pretty-format": "29.7.0",
|
|
53
53
|
"rimraf": "3.0.2",
|
|
54
|
-
"strip-ansi": "6.0.1",
|
|
55
54
|
"webpack": "^5.94.0",
|
|
56
55
|
"webpack-merge": "5.9.0",
|
|
57
56
|
"webpack-sources": "3.2.3"
|
|
@@ -102,8 +101,8 @@
|
|
|
102
101
|
"terser": "5.36.0",
|
|
103
102
|
"typescript": "^5.6.3",
|
|
104
103
|
"wast-loader": "^1.12.1",
|
|
105
|
-
"@rspack/
|
|
106
|
-
"@rspack/
|
|
104
|
+
"@rspack/core": "1.1.3",
|
|
105
|
+
"@rspack/cli": "1.1.3"
|
|
107
106
|
},
|
|
108
107
|
"peerDependencies": {
|
|
109
108
|
"@rspack/core": ">=1.0.0"
|