@rspack-canary/test-tools 1.5.6-canary-95c56d3d-20250917183900 → 1.5.6-canary-54864f9e-20250919065011
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/helper/directory.js +1 -1
- package/dist/processor/stats.d.ts +2 -2
- package/dist/processor/stats.js +4 -6
- package/dist/runner/basic.js +4 -3
- package/dist/runner/hot.js +8 -1
- 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 +4 -4
- 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
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CommonJsRunner = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const node_vm_1 = __importDefault(require("node:vm"));
|
|
10
|
-
const basic_1 = require("./basic");
|
|
11
|
-
class CommonJsRunner extends basic_1.BasicRunner {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.requireCache = Object.create(null);
|
|
15
|
-
}
|
|
16
|
-
createGlobalContext() {
|
|
17
|
-
return {
|
|
18
|
-
console: {
|
|
19
|
-
log: (...args) => {
|
|
20
|
-
if (printLogger) {
|
|
21
|
-
console.log(...args);
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
warn: (...args) => {
|
|
25
|
-
if (printLogger) {
|
|
26
|
-
console.warn(...args);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
error: (...args) => {
|
|
30
|
-
console.error(...args);
|
|
31
|
-
},
|
|
32
|
-
info: (...args) => {
|
|
33
|
-
if (printLogger) {
|
|
34
|
-
console.info(...args);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
debug: (...args) => {
|
|
38
|
-
if (printLogger) {
|
|
39
|
-
console.info(...args);
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
trace: (...args) => {
|
|
43
|
-
if (printLogger) {
|
|
44
|
-
console.info(...args);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
assert: (...args) => {
|
|
48
|
-
console.assert(...args);
|
|
49
|
-
},
|
|
50
|
-
clear: () => {
|
|
51
|
-
console.clear();
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
setTimeout: ((cb, ms, ...args) => {
|
|
55
|
-
const timeout = setTimeout(cb, ms, ...args);
|
|
56
|
-
timeout.unref();
|
|
57
|
-
return timeout;
|
|
58
|
-
}),
|
|
59
|
-
clearTimeout: clearTimeout
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
createBaseModuleScope() {
|
|
63
|
-
const baseModuleScope = {
|
|
64
|
-
console: this.globalContext.console,
|
|
65
|
-
setTimeout: this.globalContext.setTimeout,
|
|
66
|
-
clearTimeout: this.globalContext.clearTimeout,
|
|
67
|
-
nsObj: (m) => {
|
|
68
|
-
Object.defineProperty(m, Symbol.toStringTag, {
|
|
69
|
-
value: "Module"
|
|
70
|
-
});
|
|
71
|
-
return m;
|
|
72
|
-
},
|
|
73
|
-
process,
|
|
74
|
-
URL,
|
|
75
|
-
Blob,
|
|
76
|
-
Symbol,
|
|
77
|
-
__MODE__: this._options.compilerOptions.mode,
|
|
78
|
-
__SNAPSHOT__: node_path_1.default.join(this._options.source, "__snapshot__"),
|
|
79
|
-
...this._options.env
|
|
80
|
-
};
|
|
81
|
-
return baseModuleScope;
|
|
82
|
-
}
|
|
83
|
-
createModuleScope(requireFn, m, file) {
|
|
84
|
-
const requirer = requireFn.bind(null, node_path_1.default.dirname(file.path));
|
|
85
|
-
requirer.webpackTestSuiteRequire = true;
|
|
86
|
-
return {
|
|
87
|
-
...this.baseModuleScope,
|
|
88
|
-
require: requirer,
|
|
89
|
-
module: m,
|
|
90
|
-
exports: m.exports,
|
|
91
|
-
__dirname: node_path_1.default.dirname(file.path),
|
|
92
|
-
__filename: file.path,
|
|
93
|
-
_globalAssign: {
|
|
94
|
-
expect: this._options.env.expect
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
createRunner() {
|
|
99
|
-
this.requirers.set("miss", this.createMissRequirer());
|
|
100
|
-
this.requirers.set("entry", this.createCjsRequirer());
|
|
101
|
-
this.requirers.set("json", this.createJsonRequirer());
|
|
102
|
-
}
|
|
103
|
-
createMissRequirer() {
|
|
104
|
-
return (currentDirectory, modulePath, context = {}) => {
|
|
105
|
-
const modulePathStr = modulePath;
|
|
106
|
-
const modules = this._options.testConfig.modules;
|
|
107
|
-
if (modules && modulePathStr in modules) {
|
|
108
|
-
return modules[modulePathStr];
|
|
109
|
-
}
|
|
110
|
-
return require(modulePathStr.startsWith("node:")
|
|
111
|
-
? modulePathStr.slice(5)
|
|
112
|
-
: modulePathStr);
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
createJsonRequirer() {
|
|
116
|
-
return (currentDirectory, modulePath, context = {}) => {
|
|
117
|
-
if (Array.isArray(modulePath)) {
|
|
118
|
-
throw new Error("Array module path is not supported in hot cases");
|
|
119
|
-
}
|
|
120
|
-
const file = context.file || this.getFile(modulePath, currentDirectory);
|
|
121
|
-
if (!file) {
|
|
122
|
-
return this.requirers.get("miss")(currentDirectory, modulePath);
|
|
123
|
-
}
|
|
124
|
-
return JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(this._options.dist, modulePath), "utf-8"));
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
createCjsRequirer() {
|
|
128
|
-
return (currentDirectory, modulePath, context = {}) => {
|
|
129
|
-
if (modulePath === "@rspack/test-tools") {
|
|
130
|
-
return require("@rspack/test-tools");
|
|
131
|
-
}
|
|
132
|
-
const file = context.file || this.getFile(modulePath, currentDirectory);
|
|
133
|
-
if (!file) {
|
|
134
|
-
return this.requirers.get("miss")(currentDirectory, modulePath);
|
|
135
|
-
}
|
|
136
|
-
if (file.path.endsWith(".json")) {
|
|
137
|
-
return this.requirers.get("json")(currentDirectory, modulePath, context);
|
|
138
|
-
}
|
|
139
|
-
if (file.path in this.requireCache) {
|
|
140
|
-
return this.requireCache[file.path].exports;
|
|
141
|
-
}
|
|
142
|
-
const m = {
|
|
143
|
-
exports: {},
|
|
144
|
-
webpackTestSuiteModule: true
|
|
145
|
-
};
|
|
146
|
-
this.requireCache[file.path] = m;
|
|
147
|
-
const currentModuleScope = this.createModuleScope(this.getRequire(), m, file);
|
|
148
|
-
if (this._options.testConfig.moduleScope) {
|
|
149
|
-
this._options.testConfig.moduleScope(currentModuleScope, this._options.stats, this._options.compilerOptions);
|
|
150
|
-
}
|
|
151
|
-
if (!this._options.runInNewContext) {
|
|
152
|
-
file.content = `Object.assign(global, _globalAssign);\n ${file.content}`;
|
|
153
|
-
}
|
|
154
|
-
if (file.content.includes("__STATS__") && this._options.stats) {
|
|
155
|
-
currentModuleScope.__STATS__ = this._options.stats();
|
|
156
|
-
}
|
|
157
|
-
if (file.content.includes("__STATS_I__")) {
|
|
158
|
-
const statsIndex = this._options.stats?.()?.__index__;
|
|
159
|
-
if (typeof statsIndex === "number") {
|
|
160
|
-
currentModuleScope.__STATS_I__ = statsIndex;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const args = Object.keys(currentModuleScope);
|
|
164
|
-
const argValues = args.map(arg => currentModuleScope[arg]);
|
|
165
|
-
const code = `(function(${args.join(", ")}) {
|
|
166
|
-
${file.content}
|
|
167
|
-
})`;
|
|
168
|
-
this.preExecute(code, file);
|
|
169
|
-
const fn = this._options.runInNewContext
|
|
170
|
-
? node_vm_1.default.runInNewContext(code, this.globalContext, file.path)
|
|
171
|
-
: node_vm_1.default.runInThisContext(code, file.path);
|
|
172
|
-
fn.call(this._options.testConfig.nonEsmThis
|
|
173
|
-
? this._options.testConfig.nonEsmThis(modulePath)
|
|
174
|
-
: m.exports, ...argValues);
|
|
175
|
-
this.postExecute(m, file);
|
|
176
|
-
return m.exports;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
exports.CommonJsRunner = CommonJsRunner;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ECompilerType } from "../../type";
|
|
2
|
-
import { type TRunnerRequirer } from "../type";
|
|
3
|
-
import { CommonJsRunner } from "./cjs";
|
|
4
|
-
export declare class EsmRunner<T extends ECompilerType = ECompilerType.Rspack> extends CommonJsRunner<T> {
|
|
5
|
-
protected createRunner(): void;
|
|
6
|
-
protected createEsmRequirer(): TRunnerRequirer;
|
|
7
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.EsmRunner = void 0;
|
|
40
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
41
|
-
const node_url_1 = require("node:url");
|
|
42
|
-
const node_vm_1 = __importStar(require("node:vm"));
|
|
43
|
-
const asModule_1 = __importDefault(require("../../helper/legacy/asModule"));
|
|
44
|
-
const type_1 = require("../type");
|
|
45
|
-
const cjs_1 = require("./cjs");
|
|
46
|
-
class EsmRunner extends cjs_1.CommonJsRunner {
|
|
47
|
-
createRunner() {
|
|
48
|
-
super.createRunner();
|
|
49
|
-
this.requirers.set("cjs", this.getRequire());
|
|
50
|
-
this.requirers.set("esm", this.createEsmRequirer());
|
|
51
|
-
this.requirers.set("entry", (currentDirectory, modulePath, context) => {
|
|
52
|
-
const file = this.getFile(modulePath, currentDirectory);
|
|
53
|
-
if (!file) {
|
|
54
|
-
return this.requirers.get("miss")(currentDirectory, modulePath);
|
|
55
|
-
}
|
|
56
|
-
if (file.path.endsWith(".mjs") &&
|
|
57
|
-
this._options.compilerOptions.experiments?.outputModule) {
|
|
58
|
-
return this.requirers.get("esm")(currentDirectory, modulePath, {
|
|
59
|
-
...context,
|
|
60
|
-
file
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return this.requirers.get("cjs")(currentDirectory, modulePath, {
|
|
64
|
-
...context,
|
|
65
|
-
file
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
createEsmRequirer() {
|
|
70
|
-
const esmContext = node_vm_1.default.createContext(this.baseModuleScope, {
|
|
71
|
-
name: "context for esm"
|
|
72
|
-
});
|
|
73
|
-
const esmCache = new Map();
|
|
74
|
-
const esmIdentifier = this._options.name;
|
|
75
|
-
return (currentDirectory, modulePath, context = {}) => {
|
|
76
|
-
if (!node_vm_1.SourceTextModule) {
|
|
77
|
-
throw new Error("Running this test requires '--experimental-vm-modules'.\nRun with 'node --experimental-vm-modules node_modules/jest-cli/bin/jest'.");
|
|
78
|
-
}
|
|
79
|
-
const _require = this.getRequire();
|
|
80
|
-
const file = context.file || this.getFile(modulePath, currentDirectory);
|
|
81
|
-
if (!file) {
|
|
82
|
-
return this.requirers.get("miss")(currentDirectory, modulePath);
|
|
83
|
-
}
|
|
84
|
-
if (file.content.includes("__STATS__")) {
|
|
85
|
-
esmContext.__STATS__ = this._options.stats?.();
|
|
86
|
-
}
|
|
87
|
-
let esm = esmCache.get(file.path);
|
|
88
|
-
if (!esm) {
|
|
89
|
-
esm = new node_vm_1.SourceTextModule(file.content, {
|
|
90
|
-
identifier: `${esmIdentifier}-${file.path}`,
|
|
91
|
-
// no attribute
|
|
92
|
-
url: `${(0, node_url_1.pathToFileURL)(file.path).href}?${esmIdentifier}`,
|
|
93
|
-
context: esmContext,
|
|
94
|
-
initializeImportMeta: (meta, _) => {
|
|
95
|
-
meta.url = (0, node_url_1.pathToFileURL)(file.path).href;
|
|
96
|
-
},
|
|
97
|
-
importModuleDynamically: async (specifier, module) => {
|
|
98
|
-
const result = await _require(node_path_1.default.dirname(file.path), specifier, {
|
|
99
|
-
esmMode: type_1.EEsmMode.Evaluated
|
|
100
|
-
});
|
|
101
|
-
return await (0, asModule_1.default)(result, module.context);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
esmCache.set(file.path, esm);
|
|
105
|
-
}
|
|
106
|
-
if (context.esmMode === type_1.EEsmMode.Unlinked)
|
|
107
|
-
return esm;
|
|
108
|
-
return (async () => {
|
|
109
|
-
await esm.link(async (specifier, referencingModule) => {
|
|
110
|
-
return await (0, asModule_1.default)(await _require(node_path_1.default.dirname(referencingModule.identifier
|
|
111
|
-
? referencingModule.identifier.slice(esmIdentifier.length + 1)
|
|
112
|
-
: (0, node_url_1.fileURLToPath)(referencingModule.url)), specifier, {
|
|
113
|
-
esmMode: type_1.EEsmMode.Unlinked
|
|
114
|
-
}), referencingModule.context, true);
|
|
115
|
-
});
|
|
116
|
-
if (esm.instantiate)
|
|
117
|
-
esm.instantiate();
|
|
118
|
-
await esm.evaluate();
|
|
119
|
-
if (context.esmMode === type_1.EEsmMode.Evaluated) {
|
|
120
|
-
return esm;
|
|
121
|
-
}
|
|
122
|
-
const ns = esm.namespace;
|
|
123
|
-
return ns.default && ns.default instanceof Promise ? ns.default : ns;
|
|
124
|
-
})();
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.EsmRunner = EsmRunner;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ECompilerType } from "../../type";
|
|
2
|
-
import type { IBasicModuleScope, TBasicRunnerFile, TRunnerRequirer } from "../type";
|
|
3
|
-
import { EsmRunner } from "./esm";
|
|
4
|
-
export declare class NormalRunner<T extends ECompilerType = ECompilerType.Rspack> extends EsmRunner<T> {
|
|
5
|
-
protected createBaseModuleScope(): IBasicModuleScope;
|
|
6
|
-
protected createModuleScope(requireFn: TRunnerRequirer, m: {
|
|
7
|
-
exports: unknown;
|
|
8
|
-
}, file: TBasicRunnerFile): IBasicModuleScope;
|
|
9
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NormalRunner = void 0;
|
|
4
|
-
const node_url_1 = require("node:url");
|
|
5
|
-
const esm_1 = require("./esm");
|
|
6
|
-
class NormalRunner extends esm_1.EsmRunner {
|
|
7
|
-
createBaseModuleScope() {
|
|
8
|
-
const baseModuleScope = Object.assign(super.createBaseModuleScope(), {
|
|
9
|
-
process,
|
|
10
|
-
URL: node_url_1.URL,
|
|
11
|
-
Buffer,
|
|
12
|
-
setImmediate
|
|
13
|
-
});
|
|
14
|
-
return baseModuleScope;
|
|
15
|
-
}
|
|
16
|
-
createModuleScope(requireFn, m, file) {
|
|
17
|
-
const moduleScope = super.createModuleScope(requireFn, m, file);
|
|
18
|
-
delete moduleScope.define;
|
|
19
|
-
moduleScope._globalAssign = {
|
|
20
|
-
...(moduleScope._globalAssign || {}),
|
|
21
|
-
expect: this._options.env.expect
|
|
22
|
-
};
|
|
23
|
-
return moduleScope;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.NormalRunner = NormalRunner;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ECompilerType } from "../../type";
|
|
2
|
-
import type { IBasicModuleScope, TBasicRunnerFile, TRunnerRequirer } from "../type";
|
|
3
|
-
import type { IBasicRunnerOptions } from "./basic";
|
|
4
|
-
import { FakeDocumentWebRunner } from "./web/fake";
|
|
5
|
-
interface IWatchRunnerOptions<T extends ECompilerType = ECompilerType.Rspack> extends IBasicRunnerOptions<T> {
|
|
6
|
-
stepName: string;
|
|
7
|
-
isWeb: boolean;
|
|
8
|
-
state: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
export declare class WatchRunner<T extends ECompilerType = ECompilerType.Rspack> extends FakeDocumentWebRunner<T> {
|
|
11
|
-
protected _watchOptions: IWatchRunnerOptions<T>;
|
|
12
|
-
constructor(_watchOptions: IWatchRunnerOptions<T>);
|
|
13
|
-
protected createModuleScope(requireFn: TRunnerRequirer, m: any, file: TBasicRunnerFile): IBasicModuleScope;
|
|
14
|
-
run(file: string): Promise<unknown>;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WatchRunner = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const fake_1 = require("./web/fake");
|
|
9
|
-
class WatchRunner extends fake_1.FakeDocumentWebRunner {
|
|
10
|
-
constructor(_watchOptions) {
|
|
11
|
-
super(_watchOptions);
|
|
12
|
-
this._watchOptions = _watchOptions;
|
|
13
|
-
}
|
|
14
|
-
createModuleScope(requireFn, m, file) {
|
|
15
|
-
const moduleScope = super.createModuleScope(requireFn, m, file);
|
|
16
|
-
moduleScope.__dirname = node_path_1.default.dirname(file.path);
|
|
17
|
-
moduleScope.document = this.globalContext.document;
|
|
18
|
-
moduleScope.STATE = this._watchOptions.state;
|
|
19
|
-
moduleScope.WATCH_STEP = this._watchOptions.stepName;
|
|
20
|
-
moduleScope.__STATS__ = this._options.stats;
|
|
21
|
-
return moduleScope;
|
|
22
|
-
}
|
|
23
|
-
run(file) {
|
|
24
|
-
return super.run(file);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.WatchRunner = WatchRunner;
|