testeranto 0.47.34 → 0.48.0
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/common/Project.js +40 -35
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Project.js +40 -35
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/Types.d.ts +2 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Project.ts +41 -45
- package/src/Types.ts +2 -1
package/src/Project.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import WebSocket, { WebSocketServer } from 'ws';
|
|
2
1
|
import esbuild, { BuildOptions } from "esbuild";
|
|
3
2
|
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
5
3
|
import fsExists from "fs.promises.exists";
|
|
4
|
+
import path from "path";
|
|
6
5
|
import pm2 from "pm2";
|
|
7
6
|
import readline from 'readline';
|
|
7
|
+
import WebSocket, { WebSocketServer } from 'ws';
|
|
8
8
|
|
|
9
9
|
import { TesterantoFeatures } from "./Features";
|
|
10
10
|
import { IBaseConfig, IRunTime, ITestTypes } from "./Types";
|
|
11
11
|
import { ITTestResourceRequirement } from './core';
|
|
12
12
|
|
|
13
13
|
readline.emitKeypressEvents(process.stdin);
|
|
14
|
-
|
|
15
|
-
if (process.stdin.isTTY)
|
|
16
|
-
process.stdin.setRawMode(true);
|
|
14
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
17
15
|
|
|
18
16
|
const TIMEOUT = 2000;
|
|
19
17
|
const OPEN_PORT = "";
|
|
@@ -90,6 +88,7 @@ export class ITProject {
|
|
|
90
88
|
this.clearScreen = config.clearScreen;
|
|
91
89
|
this.devMode = config.devMode;
|
|
92
90
|
|
|
91
|
+
// mark each port as open
|
|
93
92
|
Object.values(config.ports).forEach((port) => {
|
|
94
93
|
this.ports[port] = OPEN_PORT;
|
|
95
94
|
});
|
|
@@ -97,10 +96,7 @@ export class ITProject {
|
|
|
97
96
|
const testPath = `${process.cwd()}/${config.tests}`;
|
|
98
97
|
const featurePath = `${process.cwd()}/${config.features}`;
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
process.on('SIGQUIT', () => this.initiateShutdown("Keyboard quit"));
|
|
102
|
-
process.on('SIGTERM', () => this.initiateShutdown("'kill' command"));
|
|
103
|
-
|
|
99
|
+
// q to quit, x to kill
|
|
104
100
|
process.stdin.on('keypress', (str, key) => {
|
|
105
101
|
if (key.name === 'q') {
|
|
106
102
|
this.initiateShutdown("'q' command")
|
|
@@ -112,6 +108,9 @@ export class ITProject {
|
|
|
112
108
|
process.exit(-1)
|
|
113
109
|
}
|
|
114
110
|
});
|
|
111
|
+
// process.on('SIGINT', () => this.initiateShutdown("CTRL+C"));
|
|
112
|
+
// process.on('SIGQUIT', () => this.initiateShutdown("Keyboard quit"));
|
|
113
|
+
// process.on('SIGTERM', () => this.initiateShutdown("'kill' command"));
|
|
115
114
|
|
|
116
115
|
import(testPath).then((tests) => {
|
|
117
116
|
this.tests = tests.default;
|
|
@@ -119,6 +118,7 @@ export class ITProject {
|
|
|
119
118
|
import(featurePath).then((features) => {
|
|
120
119
|
this.features = features.default;
|
|
121
120
|
|
|
121
|
+
// Make html files for webtests. Is this necessary?
|
|
122
122
|
Promise.resolve(Promise.all(
|
|
123
123
|
[
|
|
124
124
|
...this.getSecondaryEndpointsPoints("web")
|
|
@@ -162,14 +162,13 @@ export class ITProject {
|
|
|
162
162
|
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
163
163
|
},
|
|
164
164
|
target: "esnext",
|
|
165
|
-
|
|
166
|
-
// packages: "external",
|
|
167
165
|
format: "esm",
|
|
168
166
|
splitting: true,
|
|
169
167
|
outExtension: { '.js': '.mjs' },
|
|
170
168
|
platform: "node",
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
external: [
|
|
170
|
+
"tests.test.js",
|
|
171
|
+
"features.test.js", "react"],
|
|
173
172
|
|
|
174
173
|
outbase: config.outbase,
|
|
175
174
|
outdir: config.outdir,
|
|
@@ -184,22 +183,22 @@ export class ITProject {
|
|
|
184
183
|
'.jpg': 'binary',
|
|
185
184
|
},
|
|
186
185
|
plugins: [
|
|
187
|
-
...(config.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
186
|
+
...(config.nodePlugins || []),
|
|
187
|
+
// this should npt be necessary
|
|
188
|
+
// {
|
|
189
|
+
// name: 'rebuild-notify',
|
|
190
|
+
// setup(build) {
|
|
191
|
+
// build.onEnd(result => {
|
|
192
|
+
// console.log(`node build ended with ${result.errors.length} errors`);
|
|
193
|
+
// console.log(result)
|
|
194
|
+
// result.errors.length !== 0 && process.exit(-1);
|
|
195
|
+
// // HERE: somehow restart the server from here, e.g., by sending a signal that you trap and react to inside the server.
|
|
196
|
+
// })
|
|
197
|
+
// }
|
|
198
|
+
// },
|
|
199
199
|
],
|
|
200
200
|
};
|
|
201
201
|
const esbuildConfigWeb: BuildOptions = {
|
|
202
|
-
// packages: "external",
|
|
203
202
|
target: "esnext",
|
|
204
203
|
format: "esm",
|
|
205
204
|
splitting: true,
|
|
@@ -216,7 +215,8 @@ export class ITProject {
|
|
|
216
215
|
"fs",
|
|
217
216
|
// "react",
|
|
218
217
|
"stream",
|
|
219
|
-
"tests.test.js",
|
|
218
|
+
"tests.test.js",
|
|
219
|
+
"features.test.js"],
|
|
220
220
|
platform: "browser",
|
|
221
221
|
|
|
222
222
|
outbase: config.outbase,
|
|
@@ -237,19 +237,20 @@ export class ITProject {
|
|
|
237
237
|
'.jpg': 'binary',
|
|
238
238
|
},
|
|
239
239
|
plugins: [
|
|
240
|
-
...(config.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
240
|
+
...(config.webPlugins || []),
|
|
241
|
+
|
|
242
|
+
// This should not be necessary
|
|
243
|
+
// {
|
|
244
|
+
// name: 'rebuild-notify',
|
|
245
|
+
// setup(build) {
|
|
246
|
+
// build.onEnd(result => {
|
|
247
|
+
// console.log(`web build ended with ${result.errors.length} errors`);
|
|
248
|
+
// console.log(result)
|
|
249
|
+
// result.errors.length !== 0 && process.exit(-1);
|
|
250
|
+
// // HERE: somehow restart the server from here, e.g., by sending a signal that you trap and react to inside the server.
|
|
251
|
+
// })
|
|
252
|
+
// }
|
|
253
|
+
// },
|
|
253
254
|
],
|
|
254
255
|
};
|
|
255
256
|
|
|
@@ -537,14 +538,12 @@ export class ITProject {
|
|
|
537
538
|
}
|
|
538
539
|
|
|
539
540
|
private shutdown() {
|
|
540
|
-
|
|
541
541
|
let i = 0;
|
|
542
542
|
new Promise((res, reh) => {
|
|
543
543
|
console.log("final results: ");
|
|
544
544
|
const procsTable: any[] = [];
|
|
545
545
|
pm2.list((err, procs) => {
|
|
546
546
|
procs.forEach((proc, ndx) => {
|
|
547
|
-
|
|
548
547
|
const exitCode = this.exitCodes[proc.name as string]
|
|
549
548
|
if (exitCode !== 0) {
|
|
550
549
|
i++;
|
|
@@ -562,11 +561,8 @@ export class ITProject {
|
|
|
562
561
|
})
|
|
563
562
|
})
|
|
564
563
|
}).then((failures: number) => {
|
|
565
|
-
console.log("Stopping PM2");
|
|
566
564
|
pm2.stop("all", (e) => console.error(e));
|
|
567
|
-
// pm2.killDaemon((e) => console.error(e));
|
|
568
565
|
pm2.disconnect();
|
|
569
|
-
|
|
570
566
|
console.log(`gracefully exiting with ${failures} failures`)
|
|
571
567
|
process.exit(failures);
|
|
572
568
|
})
|