1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.NodeModulesTestEngineHost = void 0;
|
11 | const node_module_engine_host_1 = require("./node-module-engine-host");
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | class NodeModulesTestEngineHost extends node_module_engine_host_1.NodeModulesEngineHost {
|
17 | constructor() {
|
18 | super(...arguments);
|
19 | this._collections = new Map();
|
20 | this._tasks = [];
|
21 | }
|
22 | get tasks() {
|
23 | return this._tasks;
|
24 | }
|
25 | clearTasks() {
|
26 | this._tasks = [];
|
27 | }
|
28 | registerCollection(name, path) {
|
29 | this._collections.set(name, path);
|
30 | }
|
31 | transformContext(context) {
|
32 | const oldAddTask = context.addTask;
|
33 | context.addTask = (task, dependencies) => {
|
34 | this._tasks.push(task.toConfiguration());
|
35 | return oldAddTask.call(context, task, dependencies);
|
36 | };
|
37 | return context;
|
38 | }
|
39 | _resolveCollectionPath(name, requester) {
|
40 | const maybePath = this._collections.get(name);
|
41 | if (maybePath) {
|
42 | return maybePath;
|
43 | }
|
44 | return super._resolveCollectionPath(name, requester);
|
45 | }
|
46 | }
|
47 | exports.NodeModulesTestEngineHost = NodeModulesTestEngineHost;
|