@rspack/test-tools 1.5.5 → 1.5.6
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/hot-step.js +1 -1
- package/dist/case/normal.js +1 -1
- package/dist/case/stats-output.js +1 -0
- package/dist/compare/format-code.d.ts +1 -1
- package/dist/compare/format-code.js +6 -1
- package/dist/helper/directory.js +1 -1
- package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -1
- package/dist/helper/legacy/checkArrayExpectation.js +7 -7
- package/dist/processor/basic.js +3 -2
- package/dist/processor/cache.js +3 -1
- package/dist/processor/config.js +3 -1
- package/dist/processor/diagnostic.js +3 -1
- package/dist/processor/hash.js +3 -1
- package/dist/processor/hook.js +3 -1
- package/dist/processor/hot.js +3 -1
- package/dist/processor/normal.js +2 -0
- package/dist/processor/stats.d.ts +2 -2
- package/dist/processor/stats.js +7 -7
- package/dist/processor/watch.js +3 -2
- package/dist/runner/basic.js +4 -3
- package/dist/runner/cache.js +6 -4
- package/dist/runner/hot.js +11 -3
- package/dist/runner/index.d.ts +1 -3
- package/dist/runner/index.js +1 -3
- package/dist/runner/runner/index.d.ts +1 -7
- package/dist/runner/runner/index.js +1 -7
- package/dist/runner/runner/node/index.d.ts +38 -0
- package/dist/runner/runner/node/index.js +396 -0
- package/dist/runner/runner/web/fake.d.ts +11 -13
- package/dist/runner/runner/web/fake.js +3 -21
- package/dist/runner/runner/{web.d.ts → web/index.d.ts} +5 -6
- package/dist/runner/runner/{web.js → web/index.js} +3 -3
- package/dist/runner/runner/web/jsdom.d.ts +8 -8
- package/dist/runner/runner/web/jsdom.js +14 -4
- package/dist/runner/type.d.ts +4 -4
- package/dist/runner/watch.d.ts +1 -1
- package/dist/runner/watch.js +17 -6
- package/dist/test/creator.d.ts +1 -1
- package/dist/test/creator.js +1 -0
- package/dist/test/tester.js +9 -0
- package/dist/type.d.ts +2 -2
- package/package.json +6 -6
- package/dist/runner/hot-step.d.ts +0 -5
- package/dist/runner/hot-step.js +0 -87
- package/dist/runner/normal.d.ts +0 -5
- package/dist/runner/normal.js +0 -20
- package/dist/runner/runner/basic.d.ts +0 -30
- package/dist/runner/runner/basic.js +0 -119
- package/dist/runner/runner/cjs.d.ts +0 -16
- package/dist/runner/runner/cjs.js +0 -180
- package/dist/runner/runner/esm.d.ts +0 -7
- package/dist/runner/runner/esm.js +0 -128
- package/dist/runner/runner/normal.d.ts +0 -9
- package/dist/runner/runner/normal.js +0 -26
- package/dist/runner/runner/watch.d.ts +0 -16
- package/dist/runner/runner/watch.js +0 -27
package/dist/case/hot-step.js
CHANGED
package/dist/case/normal.js
CHANGED
|
@@ -10,6 +10,7 @@ const creator = new creator_1.BasicCaseCreator({
|
|
|
10
10
|
steps: ({ name }) => [
|
|
11
11
|
new stats_1.StatsProcessor({
|
|
12
12
|
name,
|
|
13
|
+
snapshotName: "stats.txt",
|
|
13
14
|
writeStatsOuptut: false,
|
|
14
15
|
compilerType: type_1.ECompilerType.Rspack,
|
|
15
16
|
configFiles: ["rspack.config.js", "webpack.config.js"]
|
|
@@ -11,6 +11,6 @@ export interface IFormatCodeOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export interface IFormatCodeReplacement {
|
|
13
13
|
from: string | RegExp;
|
|
14
|
-
to: string;
|
|
14
|
+
to: string | ((substring: string, ...args: any[]) => string);
|
|
15
15
|
}
|
|
16
16
|
export declare function formatCode(name: string, raw: string, options: IFormatCodeOptions): string;
|
|
@@ -221,7 +221,12 @@ function formatCode(name, raw, options) {
|
|
|
221
221
|
}
|
|
222
222
|
if (options.replacements) {
|
|
223
223
|
for (const { from, to } of options.replacements) {
|
|
224
|
-
|
|
224
|
+
if (typeof to === "string") {
|
|
225
|
+
result = result.replaceAll(from, to);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
result = result.replaceAll(from, to);
|
|
229
|
+
}
|
|
225
230
|
}
|
|
226
231
|
}
|
|
227
232
|
// result of generate() is not stable with comments sometimes
|
package/dist/helper/directory.js
CHANGED
|
@@ -54,7 +54,7 @@ function describeByWalk(testFile, createCase, options = {}) {
|
|
|
54
54
|
describeDirectory(caseName, currentLevel - 1);
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
const name = (0, _1.escapeSep)(node_path_1.default.join(testId
|
|
57
|
+
const name = (0, _1.escapeSep)(node_path_1.default.join(`${testId}Cases`, caseName).split(".").shift());
|
|
58
58
|
describeFn(name, () => {
|
|
59
59
|
const source = node_path_1.default.join(sourceBase, caseName);
|
|
60
60
|
let dist = "";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(testDirectory: any, object: any, kind: any, filename: any, upperCaseKind: any, done: any): Promise<true | undefined>;
|
|
1
|
+
declare function _exports(testDirectory: any, object: any, kind: any, filename: any, upperCaseKind: any, options: any, done: any): Promise<true | undefined>;
|
|
2
2
|
export = _exports;
|
|
@@ -59,16 +59,13 @@ ${tooMuch.map(item => `${explain(item)}`).join("\n\n")}`);
|
|
|
59
59
|
}
|
|
60
60
|
return diff.join("\n\n");
|
|
61
61
|
};
|
|
62
|
-
module.exports = async function checkArrayExpectation(testDirectory, object, kind, filename, upperCaseKind, done) {
|
|
63
|
-
const usePromise = typeof done === "function";
|
|
62
|
+
module.exports = async function checkArrayExpectation(testDirectory, object, kind, filename, upperCaseKind, options, done) {
|
|
64
63
|
done = typeof done === "function" ? done : error => {
|
|
65
64
|
throw error;
|
|
66
65
|
};
|
|
67
66
|
let array = object[`${kind}s`];
|
|
68
|
-
if (Array.isArray(array)) {
|
|
69
|
-
|
|
70
|
-
array = array.filter(item => !/from Terser/.test(item));
|
|
71
|
-
}
|
|
67
|
+
if (Array.isArray(array) && kind === "warning") {
|
|
68
|
+
array = array.filter(item => !/from Terser/.test(item));
|
|
72
69
|
}
|
|
73
70
|
if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) {
|
|
74
71
|
// CHANGE: added file for sorting messages in multi-thread environment
|
|
@@ -77,7 +74,10 @@ module.exports = async function checkArrayExpectation(testDirectory, object, kin
|
|
|
77
74
|
array = sorter(array);
|
|
78
75
|
}
|
|
79
76
|
const expectedFilename = path.join(testDirectory, `${filename}.js`);
|
|
80
|
-
|
|
77
|
+
let expected = require(expectedFilename);
|
|
78
|
+
if (typeof expected === "function") {
|
|
79
|
+
expected = expected(options);
|
|
80
|
+
}
|
|
81
81
|
const diff = diffItems(array, expected, kind);
|
|
82
82
|
if (expected.length < array.length) {
|
|
83
83
|
done(new Error(`More ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
|
package/dist/processor/basic.js
CHANGED
|
@@ -97,6 +97,7 @@ class BasicProcessor {
|
|
|
97
97
|
const warnings = [];
|
|
98
98
|
const compiler = this.getCompiler(context);
|
|
99
99
|
const stats = compiler.getStats();
|
|
100
|
+
const options = compiler.getOptions();
|
|
100
101
|
if (stats) {
|
|
101
102
|
if (testConfig.writeStatsOuptut) {
|
|
102
103
|
node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
|
|
@@ -125,8 +126,8 @@ class BasicProcessor {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
await (0, checkArrayExpectation_1.default)(context.getSource(), { errors }, "error", "errors", "Error");
|
|
129
|
-
await (0, checkArrayExpectation_1.default)(context.getSource(), { warnings }, "warning", "warnings", "Warning");
|
|
129
|
+
await (0, checkArrayExpectation_1.default)(context.getSource(), { errors }, "error", "errors", "Error", options);
|
|
130
|
+
await (0, checkArrayExpectation_1.default)(context.getSource(), { warnings }, "warning", "warnings", "Warning", options);
|
|
130
131
|
// clear error if checked
|
|
131
132
|
if (node_fs_1.default.existsSync(context.getSource("errors.js"))) {
|
|
132
133
|
context.clearError(this._options.name);
|
package/dist/processor/cache.js
CHANGED
package/dist/processor/config.js
CHANGED
package/dist/processor/hash.js
CHANGED
package/dist/processor/hook.js
CHANGED
package/dist/processor/hot.js
CHANGED
package/dist/processor/normal.js
CHANGED
|
@@ -145,6 +145,8 @@ class NormalProcessor extends basic_1.BasicProcessor {
|
|
|
145
145
|
},
|
|
146
146
|
asyncWebAssembly: true,
|
|
147
147
|
topLevelAwait: true,
|
|
148
|
+
inlineConst: true,
|
|
149
|
+
lazyBarrel: true,
|
|
148
150
|
// CHANGE: rspack does not support `backCompat` yet.
|
|
149
151
|
// backCompat: false,
|
|
150
152
|
// CHANGE: Rspack enables `css` by default.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ECompilerType, ITestContext, ITestEnv, TCompilerOptions } from "../type";
|
|
2
2
|
import { type IMultiTaskProcessorOptions, MultiTaskProcessor } from "./multi";
|
|
3
3
|
export interface IStatsProcessorOptions<T extends ECompilerType> extends Omit<IMultiTaskProcessorOptions<T>, "runable"> {
|
|
4
|
-
snapshotName
|
|
4
|
+
snapshotName: string;
|
|
5
5
|
writeStatsOuptut?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare class StatsProcessor<T extends ECompilerType> extends MultiTaskProcessor<T> {
|
|
8
8
|
private stderr;
|
|
9
|
-
private snapshotName
|
|
9
|
+
private snapshotName;
|
|
10
10
|
private writeStatsOuptut?;
|
|
11
11
|
constructor(_statsOptions: IStatsProcessorOptions<T>);
|
|
12
12
|
before(context: ITestContext): Promise<void>;
|
package/dist/processor/stats.js
CHANGED
|
@@ -137,12 +137,10 @@ class StatsProcessor extends multi_1.MultiTaskProcessor {
|
|
|
137
137
|
// CHANGE: Replace bundle size, since bundle sizes may differ between platforms
|
|
138
138
|
.replace(/[0-9]+\.?[0-9]+ KiB/g, "xx KiB");
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
env.expect(new RspackStats(actual)).toMatchSnapshot();
|
|
145
|
-
}
|
|
140
|
+
const snapshotPath = node_path_1.default.isAbsolute(this.snapshotName)
|
|
141
|
+
? this.snapshotName
|
|
142
|
+
: node_path_1.default.resolve(context.getSource(), `./__snapshots__/${this.snapshotName}`);
|
|
143
|
+
env.expect(new RspackStats(actual)).toMatchFileSnapshot(snapshotPath);
|
|
146
144
|
const testConfig = context.getTestConfig();
|
|
147
145
|
if (typeof testConfig?.validate === "function") {
|
|
148
146
|
testConfig.validate(stats, this.stderr.toString());
|
|
@@ -178,7 +176,9 @@ class StatsProcessor extends multi_1.MultiTaskProcessor {
|
|
|
178
176
|
bundlerInfo: {
|
|
179
177
|
force: false
|
|
180
178
|
}
|
|
181
|
-
}
|
|
179
|
+
},
|
|
180
|
+
inlineConst: true,
|
|
181
|
+
lazyBarrel: true
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
}
|
package/dist/processor/watch.js
CHANGED
|
@@ -66,6 +66,7 @@ class WatchProcessor extends multi_1.MultiTaskProcessor {
|
|
|
66
66
|
const warnings = [];
|
|
67
67
|
const compiler = this.getCompiler(context);
|
|
68
68
|
const stats = compiler.getStats();
|
|
69
|
+
const options = compiler.getOptions();
|
|
69
70
|
const checkStats = testConfig.checkStats || (() => true);
|
|
70
71
|
if (stats) {
|
|
71
72
|
if (testConfig.writeStatsOuptut) {
|
|
@@ -125,8 +126,8 @@ class WatchProcessor extends multi_1.MultiTaskProcessor {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { errors }, "error", "errors", "Error");
|
|
129
|
-
await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { warnings }, "warning", "warnings", "Warning");
|
|
129
|
+
await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { errors }, "error", "errors", "Error", options);
|
|
130
|
+
await (0, checkArrayExpectation_1.default)(node_path_1.default.join(context.getSource(), this._watchOptions.stepName), { warnings }, "warning", "warnings", "Warning", options);
|
|
130
131
|
// clear error if checked
|
|
131
132
|
if (node_fs_1.default.existsSync(context.getSource("errors.js"))) {
|
|
132
133
|
context.clearError(this._options.name);
|
package/dist/runner/basic.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BasicRunnerFactory = void 0;
|
|
4
4
|
const type_1 = require("../type");
|
|
5
|
-
const
|
|
5
|
+
const node_1 = require("./runner/node");
|
|
6
6
|
const web_1 = require("./runner/web");
|
|
7
7
|
class BasicRunnerFactory {
|
|
8
8
|
constructor(name, context) {
|
|
@@ -40,6 +40,8 @@ class BasicRunnerFactory {
|
|
|
40
40
|
}
|
|
41
41
|
createRunner(file, stats, compilerOptions, env) {
|
|
42
42
|
const runnerOptions = {
|
|
43
|
+
runInNewContext: false,
|
|
44
|
+
cachable: true,
|
|
43
45
|
env,
|
|
44
46
|
stats,
|
|
45
47
|
name: this.name,
|
|
@@ -53,11 +55,10 @@ class BasicRunnerFactory {
|
|
|
53
55
|
return new web_1.WebRunner({
|
|
54
56
|
...runnerOptions,
|
|
55
57
|
runInNewContext: true,
|
|
56
|
-
cachable: true,
|
|
57
58
|
dom: this.context.getValue(this.name, "documentType") || type_1.EDocumentType.Fake
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
|
-
return new
|
|
61
|
+
return new node_1.NodeRunner(runnerOptions);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
exports.BasicRunnerFactory = BasicRunnerFactory;
|
package/dist/runner/cache.js
CHANGED
|
@@ -52,9 +52,10 @@ class CacheRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
|
52
52
|
const jsonStats = stats.toJson({
|
|
53
53
|
// errorDetails: true
|
|
54
54
|
});
|
|
55
|
+
const compilerOptions = compiler.getOptions();
|
|
55
56
|
const updateIndex = updatePlugin.getUpdateIndex();
|
|
56
|
-
await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error");
|
|
57
|
-
await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning");
|
|
57
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error", compilerOptions);
|
|
58
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning", compilerOptions);
|
|
58
59
|
const updatedModules = await m.hot.check(options || true);
|
|
59
60
|
if (!updatedModules) {
|
|
60
61
|
throw new Error("No update available");
|
|
@@ -72,9 +73,10 @@ class CacheRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
|
72
73
|
const jsonStats = stats.toJson({
|
|
73
74
|
// errorDetails: true
|
|
74
75
|
});
|
|
76
|
+
const compilerOptions = compiler.getOptions();
|
|
75
77
|
const updateIndex = updatePlugin.getUpdateIndex();
|
|
76
|
-
await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error");
|
|
77
|
-
await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning");
|
|
78
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${updateIndex}`, "Error", compilerOptions);
|
|
79
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${updateIndex}`, "Warning", compilerOptions);
|
|
78
80
|
env.it(`NEXT_START run with compilerIndex==${compilerIndex + 1}`, async () => {
|
|
79
81
|
if (compilerIndex > MAX_COMPILER_INDEX) {
|
|
80
82
|
throw new Error("NEXT_START has been called more than the maximum times");
|
package/dist/runner/hot.js
CHANGED
|
@@ -26,8 +26,15 @@ class HotRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
|
26
26
|
const jsonStats = stats.toJson({
|
|
27
27
|
// errorDetails: true
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const compilerOptions = compiler.getOptions();
|
|
30
|
+
const checker = this.context.getValue(this.name, jsonStats.errors?.length
|
|
31
|
+
? "hotUpdateStepErrorChecker"
|
|
32
|
+
: "hotUpdateStepChecker");
|
|
33
|
+
if (checker) {
|
|
34
|
+
checker(hotUpdateContext, stats, runner.getGlobal("__HMR_UPDATED_RUNTIME__"));
|
|
35
|
+
}
|
|
36
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "error", `errors${hotUpdateContext.updateIndex}`, "Error", compilerOptions);
|
|
37
|
+
await (0, checkArrayExpectation_1.default)(source, jsonStats, "warning", `warnings${hotUpdateContext.updateIndex}`, "Warning", compilerOptions);
|
|
31
38
|
if (usePromise) {
|
|
32
39
|
// old callback style hmr cases
|
|
33
40
|
callback(null, jsonStats);
|
|
@@ -54,7 +61,7 @@ class HotRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
|
54
61
|
}
|
|
55
62
|
return jsonStats;
|
|
56
63
|
};
|
|
57
|
-
|
|
64
|
+
const runner = new web_1.WebRunner({
|
|
58
65
|
dom: this.context.getValue(this.name, "documentType") || type_1.EDocumentType.JSDOM,
|
|
59
66
|
env,
|
|
60
67
|
stats: this.createStatsGetter(),
|
|
@@ -78,6 +85,7 @@ class HotRunnerFactory extends basic_1.BasicRunnerFactory {
|
|
|
78
85
|
dist,
|
|
79
86
|
compilerOptions
|
|
80
87
|
});
|
|
88
|
+
return runner;
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
exports.HotRunnerFactory = HotRunnerFactory;
|
package/dist/runner/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export * from "./basic";
|
|
2
2
|
export * from "./cache";
|
|
3
3
|
export * from "./hot";
|
|
4
|
-
export * from "./hot-step";
|
|
5
4
|
export * from "./multiple";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./runner";
|
|
5
|
+
export * from "./runner/node";
|
|
8
6
|
export * from "./type";
|
|
9
7
|
export * from "./watch";
|
package/dist/runner/index.js
CHANGED
|
@@ -17,9 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./basic"), exports);
|
|
18
18
|
__exportStar(require("./cache"), exports);
|
|
19
19
|
__exportStar(require("./hot"), exports);
|
|
20
|
-
__exportStar(require("./hot-step"), exports);
|
|
21
20
|
__exportStar(require("./multiple"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./runner"), exports);
|
|
21
|
+
__exportStar(require("./runner/node"), exports);
|
|
24
22
|
__exportStar(require("./type"), exports);
|
|
25
23
|
__exportStar(require("./watch"), exports);
|
|
@@ -14,11 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./cjs"), exports);
|
|
19
|
-
__exportStar(require("./esm"), exports);
|
|
20
|
-
__exportStar(require("./normal"), exports);
|
|
21
|
-
__exportStar(require("./watch"), exports);
|
|
17
|
+
__exportStar(require("./node"), exports);
|
|
22
18
|
__exportStar(require("./web"), exports);
|
|
23
|
-
__exportStar(require("./web/fake"), exports);
|
|
24
|
-
__exportStar(require("./web/jsdom"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ECompilerType, ITestEnv, ITestRunner, TCompilerOptions, TCompilerStatsCompilation, TTestConfig } from "../../../type";
|
|
2
|
+
import { type IGlobalContext, type IModuleScope, type TModuleObject, type TRunnerFile, type TRunnerRequirer } from "../../type";
|
|
3
|
+
declare global {
|
|
4
|
+
var printLogger: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface INodeRunnerOptions<T extends ECompilerType> {
|
|
7
|
+
env: ITestEnv;
|
|
8
|
+
stats?: () => TCompilerStatsCompilation<T>;
|
|
9
|
+
name: string;
|
|
10
|
+
runInNewContext?: boolean;
|
|
11
|
+
testConfig: TTestConfig<T>;
|
|
12
|
+
source: string;
|
|
13
|
+
dist: string;
|
|
14
|
+
compilerOptions: TCompilerOptions<T>;
|
|
15
|
+
cachable?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class NodeRunner<T extends ECompilerType = ECompilerType.Rspack> implements ITestRunner {
|
|
18
|
+
protected _options: INodeRunnerOptions<T>;
|
|
19
|
+
protected requireCache: any;
|
|
20
|
+
protected globalContext: IGlobalContext | null;
|
|
21
|
+
protected baseModuleScope: IModuleScope | null;
|
|
22
|
+
protected requirers: Map<string, TRunnerRequirer>;
|
|
23
|
+
constructor(_options: INodeRunnerOptions<T>);
|
|
24
|
+
run(file: string): Promise<unknown>;
|
|
25
|
+
getRequire(): TRunnerRequirer;
|
|
26
|
+
getGlobal(name: string): unknown;
|
|
27
|
+
protected createGlobalContext(): IGlobalContext;
|
|
28
|
+
protected createBaseModuleScope(): IModuleScope;
|
|
29
|
+
protected createModuleScope(requireFn: TRunnerRequirer, m: TModuleObject, file: TRunnerFile): IModuleScope;
|
|
30
|
+
protected getFile(modulePath: string[] | string, currentDirectory: string): TRunnerFile | null;
|
|
31
|
+
protected preExecute(code: string, file: TRunnerFile): void;
|
|
32
|
+
protected postExecute(m: Object, file: TRunnerFile): void;
|
|
33
|
+
protected createRunner(): void;
|
|
34
|
+
protected createMissRequirer(): TRunnerRequirer;
|
|
35
|
+
protected createJsonRequirer(): TRunnerRequirer;
|
|
36
|
+
protected createCjsRequirer(): TRunnerRequirer;
|
|
37
|
+
protected createEsmRequirer(): TRunnerRequirer;
|
|
38
|
+
}
|