@rspack-canary/test-tools 1.5.7-canary-a3406c0a-20250922173625 → 1.5.8-canary-6c1a40e3-20250925175235
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 +2 -2
- package/dist/case/builtin.js +37 -28
- package/dist/case/cache.d.ts +1 -1
- package/dist/case/cache.js +135 -42
- package/dist/case/common.d.ts +10 -0
- package/dist/case/common.js +237 -0
- package/dist/case/compiler.d.ts +7 -4
- package/dist/case/compiler.js +144 -109
- package/dist/case/config.d.ts +3 -2
- package/dist/case/config.js +47 -39
- package/dist/case/defaults.d.ts +2 -2
- package/dist/case/defaults.js +28 -18
- package/dist/case/diagnostic.d.ts +1 -1
- package/dist/case/diagnostic.js +52 -43
- package/dist/case/diff.d.ts +17 -1
- package/dist/case/diff.js +170 -22
- package/dist/case/error.d.ts +14 -4
- package/dist/case/error.js +51 -21
- package/dist/case/hash.d.ts +1 -1
- package/dist/case/hash.js +41 -34
- package/dist/case/hook.d.ts +4 -5
- package/dist/case/hook.js +78 -70
- package/dist/case/hot-step.d.ts +1 -1
- package/dist/case/hot-step.js +9 -5
- package/dist/case/hot.d.ts +5 -5
- package/dist/case/hot.js +142 -55
- package/dist/case/incremental.d.ts +1 -1
- package/dist/case/incremental.js +19 -34
- package/dist/case/native-watcher.js +10 -23
- package/dist/case/normal.js +46 -31
- package/dist/case/runner.d.ts +18 -0
- package/dist/case/runner.js +108 -0
- package/dist/case/serial.d.ts +1 -1
- package/dist/case/serial.js +7 -15
- package/dist/case/stats-api.js +52 -22
- package/dist/case/stats-output.js +133 -137
- package/dist/case/treeshaking.js +33 -22
- package/dist/case/watch.d.ts +27 -0
- package/dist/case/watch.js +321 -21
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/runner/index.d.ts +2 -7
- package/dist/runner/index.js +2 -7
- package/dist/runner/{runner/node → node}/index.d.ts +1 -2
- package/dist/runner/{runner/node → node}/index.js +2 -2
- package/dist/runner/{runner/web → web}/fake.d.ts +1 -2
- package/dist/runner/{runner/web → web}/fake.js +7 -7
- package/dist/runner/{runner/web → web}/index.d.ts +2 -2
- package/dist/runner/{runner/web → web}/index.js +1 -1
- package/dist/runner/{runner/web → web}/jsdom.d.ts +1 -2
- package/dist/runner/{runner/web → web}/jsdom.js +4 -4
- package/dist/test/context.d.ts +3 -5
- package/dist/test/context.js +22 -12
- package/dist/test/creator.d.ts +13 -12
- package/dist/test/creator.js +52 -43
- package/dist/test/tester.js +4 -1
- package/dist/type.d.ts +41 -10
- package/dist/type.js +7 -1
- package/package.json +6 -6
- package/dist/processor/basic.d.ts +0 -27
- package/dist/processor/basic.js +0 -157
- package/dist/processor/diff.d.ts +0 -30
- package/dist/processor/diff.js +0 -140
- package/dist/processor/index.d.ts +0 -6
- package/dist/processor/index.js +0 -22
- package/dist/processor/multi.d.ts +0 -19
- package/dist/processor/multi.js +0 -75
- package/dist/processor/simple.d.ts +0 -24
- package/dist/processor/simple.js +0 -51
- package/dist/processor/snapshot.d.ts +0 -12
- package/dist/processor/snapshot.js +0 -67
- package/dist/processor/watch.d.ts +0 -30
- package/dist/processor/watch.js +0 -252
- package/dist/runner/basic.d.ts +0 -10
- package/dist/runner/basic.js +0 -64
- package/dist/runner/cache.d.ts +0 -5
- package/dist/runner/cache.js +0 -92
- package/dist/runner/hot.d.ts +0 -5
- package/dist/runner/hot.js +0 -91
- package/dist/runner/multiple.d.ts +0 -11
- package/dist/runner/multiple.js +0 -52
- package/dist/runner/runner/index.d.ts +0 -2
- package/dist/runner/runner/index.js +0 -18
- package/dist/runner/type.d.ts +0 -42
- package/dist/runner/type.js +0 -9
- package/dist/runner/watch.d.ts +0 -7
- package/dist/runner/watch.js +0 -71
- package/dist/test/simple.d.ts +0 -5
- package/dist/test/simple.js +0 -43
package/dist/runner/watch.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type ECompilerType, type ITestEnv, type ITestRunner, type TCompilerOptions, type TCompilerStatsCompilation } from "../type";
|
|
2
|
-
import { BasicRunnerFactory } from "./basic";
|
|
3
|
-
export declare class WatchRunnerFactory<T extends ECompilerType> extends BasicRunnerFactory<T> {
|
|
4
|
-
protected getRunnerKey(file: string): string;
|
|
5
|
-
protected createStatsGetter(): () => TCompilerStatsCompilation<T>;
|
|
6
|
-
protected createRunner(file: string, stats: () => TCompilerStatsCompilation<T>, compilerOptions: TCompilerOptions<T>, env: ITestEnv): ITestRunner;
|
|
7
|
-
}
|
package/dist/runner/watch.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WatchRunnerFactory = void 0;
|
|
4
|
-
const type_1 = require("../type");
|
|
5
|
-
const basic_1 = require("./basic");
|
|
6
|
-
const runner_1 = require("./runner");
|
|
7
|
-
class WatchRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
8
|
-
getRunnerKey(file) {
|
|
9
|
-
const stepName = this.context.getValue(this.name, "watchStepName");
|
|
10
|
-
return `${this.name}-${stepName}`;
|
|
11
|
-
}
|
|
12
|
-
createStatsGetter() {
|
|
13
|
-
const compiler = this.context.getCompiler(this.name);
|
|
14
|
-
const stepName = this.context.getValue(this.name, "watchStepName");
|
|
15
|
-
const statsGetter = (() => {
|
|
16
|
-
const cached = {};
|
|
17
|
-
return () => {
|
|
18
|
-
if (cached[stepName]) {
|
|
19
|
-
return cached[stepName];
|
|
20
|
-
}
|
|
21
|
-
cached[stepName] = compiler.getStats().toJson({
|
|
22
|
-
errorDetails: true
|
|
23
|
-
});
|
|
24
|
-
return cached[stepName];
|
|
25
|
-
};
|
|
26
|
-
})();
|
|
27
|
-
return statsGetter;
|
|
28
|
-
}
|
|
29
|
-
createRunner(file, stats, compilerOptions, env) {
|
|
30
|
-
this.context.getCompiler(this.name);
|
|
31
|
-
const stepName = this.context.getValue(this.name, "watchStepName");
|
|
32
|
-
if (!stepName) {
|
|
33
|
-
throw new Error("Can not get watch step name from context");
|
|
34
|
-
}
|
|
35
|
-
const state = this.context.getValue(this.name, "watchState");
|
|
36
|
-
if (!state) {
|
|
37
|
-
throw new Error("Can not get watch state from context");
|
|
38
|
-
}
|
|
39
|
-
const isWeb = Array.isArray(compilerOptions)
|
|
40
|
-
? compilerOptions.some(option => {
|
|
41
|
-
return option.target === "web" || option.target === "webworker";
|
|
42
|
-
})
|
|
43
|
-
: compilerOptions.target === "web" ||
|
|
44
|
-
compilerOptions.target === "webworker";
|
|
45
|
-
const testConfig = this.context.getTestConfig();
|
|
46
|
-
const documentType = this.context.getValue(this.name, "documentType") || type_1.EDocumentType.Fake;
|
|
47
|
-
return new runner_1.WebRunner({
|
|
48
|
-
dom: documentType,
|
|
49
|
-
env,
|
|
50
|
-
stats,
|
|
51
|
-
name: this.name,
|
|
52
|
-
runInNewContext: isWeb,
|
|
53
|
-
cachable: false,
|
|
54
|
-
testConfig: {
|
|
55
|
-
...(testConfig || {}),
|
|
56
|
-
moduleScope: (ms, stats, options) => {
|
|
57
|
-
ms.STATE = state;
|
|
58
|
-
ms.WATCH_STEP = stepName;
|
|
59
|
-
if (typeof testConfig.moduleScope === "function") {
|
|
60
|
-
return testConfig.moduleScope(ms, stats, options);
|
|
61
|
-
}
|
|
62
|
-
return ms;
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
source: this.context.getSource(),
|
|
66
|
-
dist: this.context.getDist(),
|
|
67
|
-
compilerOptions
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.WatchRunnerFactory = WatchRunnerFactory;
|
package/dist/test/simple.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ITestContext, ITestEnv, ITestProcessor } from "../type";
|
|
2
|
-
export declare function getSimpleProcessorRunner(src: string, dist: string, options?: {
|
|
3
|
-
env?: () => ITestEnv;
|
|
4
|
-
context?: (src: string, dist: string) => ITestContext;
|
|
5
|
-
}): (name: string, processor: ITestProcessor) => Promise<void>;
|
package/dist/test/simple.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSimpleProcessorRunner = getSimpleProcessorRunner;
|
|
4
|
-
const context_1 = require("./context");
|
|
5
|
-
const CONTEXT_MAP = new Map();
|
|
6
|
-
function getSimpleProcessorRunner(src, dist, options = {}) {
|
|
7
|
-
const createEnv = options.env || (() => ({ expect, it, beforeEach, afterEach, jest }));
|
|
8
|
-
const createContext = options.context ||
|
|
9
|
-
((src, dist) => new context_1.TestContext({ src, dist }));
|
|
10
|
-
const key = `src: ${src}, dist: ${dist}`;
|
|
11
|
-
if (!CONTEXT_MAP.has(key)) {
|
|
12
|
-
const context = createContext(src, dist);
|
|
13
|
-
const runner = async function run(name, processor) {
|
|
14
|
-
try {
|
|
15
|
-
await processor.beforeAll?.(context);
|
|
16
|
-
await processor.before?.(context);
|
|
17
|
-
await processor.config?.(context);
|
|
18
|
-
await processor.compiler?.(context);
|
|
19
|
-
await processor.build?.(context);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
context.emitError(name, e);
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
if (!context.hasError()) {
|
|
26
|
-
await processor.run?.(createEnv(), context);
|
|
27
|
-
}
|
|
28
|
-
await processor.check?.(createEnv(), context);
|
|
29
|
-
await processor.after?.(context);
|
|
30
|
-
await processor.afterAll?.(context);
|
|
31
|
-
}
|
|
32
|
-
if (context.hasError()) {
|
|
33
|
-
const errors = context
|
|
34
|
-
.getError()
|
|
35
|
-
.map(i => `${i.stack}`.split("\n").join("\t\n"))
|
|
36
|
-
.join("\n\n");
|
|
37
|
-
throw new Error(`Case "${name}" failed:\n${errors}`);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
CONTEXT_MAP.set(key, runner);
|
|
41
|
-
}
|
|
42
|
-
return CONTEXT_MAP.get(key);
|
|
43
|
-
}
|