testeranto 0.47.34 → 0.48.1
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 +16 -33
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Project.js +16 -33
- 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 +28 -50
- package/src/Types.ts +2 -1
package/dist/module/Project.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { WebSocketServer } from 'ws';
|
|
2
1
|
import esbuild 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 { WebSocketServer } from 'ws';
|
|
8
8
|
readline.emitKeypressEvents(process.stdin);
|
|
9
9
|
if (process.stdin.isTTY)
|
|
10
10
|
process.stdin.setRawMode(true);
|
|
@@ -93,14 +93,12 @@ export class ITProject {
|
|
|
93
93
|
};
|
|
94
94
|
this.clearScreen = config.clearScreen;
|
|
95
95
|
this.devMode = config.devMode;
|
|
96
|
+
// mark each port as open
|
|
96
97
|
Object.values(config.ports).forEach((port) => {
|
|
97
98
|
this.ports[port] = OPEN_PORT;
|
|
98
99
|
});
|
|
99
100
|
const testPath = `${process.cwd()}/${config.tests}`;
|
|
100
101
|
const featurePath = `${process.cwd()}/${config.features}`;
|
|
101
|
-
process.on('SIGINT', () => this.initiateShutdown("CTRL+C"));
|
|
102
|
-
process.on('SIGQUIT', () => this.initiateShutdown("Keyboard quit"));
|
|
103
|
-
process.on('SIGTERM', () => this.initiateShutdown("'kill' command"));
|
|
104
102
|
process.stdin.on('keypress', (str, key) => {
|
|
105
103
|
if (key.name === 'q') {
|
|
106
104
|
this.initiateShutdown("'q' command");
|
|
@@ -155,12 +153,14 @@ export class ITProject {
|
|
|
155
153
|
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
156
154
|
},
|
|
157
155
|
target: "esnext",
|
|
158
|
-
// packages: "external",
|
|
159
156
|
format: "esm",
|
|
160
157
|
splitting: true,
|
|
161
158
|
outExtension: { '.js': '.mjs' },
|
|
162
159
|
platform: "node",
|
|
163
|
-
external: [
|
|
160
|
+
external: [
|
|
161
|
+
"tests.test.js",
|
|
162
|
+
"features.test.js", "react"
|
|
163
|
+
],
|
|
164
164
|
outbase: config.outbase,
|
|
165
165
|
outdir: config.outdir,
|
|
166
166
|
jsx: 'transform',
|
|
@@ -174,7 +174,7 @@ export class ITProject {
|
|
|
174
174
|
'.jpg': 'binary',
|
|
175
175
|
},
|
|
176
176
|
plugins: [
|
|
177
|
-
...(config.
|
|
177
|
+
...(config.nodePlugins || []),
|
|
178
178
|
{
|
|
179
179
|
name: 'rebuild-notify',
|
|
180
180
|
setup(build) {
|
|
@@ -182,14 +182,12 @@ export class ITProject {
|
|
|
182
182
|
console.log(`node build ended with ${result.errors.length} errors`);
|
|
183
183
|
console.log(result);
|
|
184
184
|
result.errors.length !== 0 && process.exit(-1);
|
|
185
|
-
// HERE: somehow restart the server from here, e.g., by sending a signal that you trap and react to inside the server.
|
|
186
185
|
});
|
|
187
186
|
}
|
|
188
187
|
},
|
|
189
188
|
],
|
|
190
189
|
};
|
|
191
190
|
const esbuildConfigWeb = {
|
|
192
|
-
// packages: "external",
|
|
193
191
|
target: "esnext",
|
|
194
192
|
format: "esm",
|
|
195
193
|
splitting: true,
|
|
@@ -198,13 +196,14 @@ export class ITProject {
|
|
|
198
196
|
react: path.resolve("./node_modules/react")
|
|
199
197
|
},
|
|
200
198
|
external: [
|
|
199
|
+
"tests.test.js",
|
|
200
|
+
"features.test.js",
|
|
201
201
|
// "url",
|
|
202
|
+
// "react",
|
|
202
203
|
"electron",
|
|
203
204
|
"path",
|
|
204
205
|
"fs",
|
|
205
|
-
// "react",
|
|
206
206
|
"stream",
|
|
207
|
-
"tests.test.js", "features.test.js"
|
|
208
207
|
],
|
|
209
208
|
platform: "browser",
|
|
210
209
|
outbase: config.outbase,
|
|
@@ -224,7 +223,7 @@ export class ITProject {
|
|
|
224
223
|
'.jpg': 'binary',
|
|
225
224
|
},
|
|
226
225
|
plugins: [
|
|
227
|
-
...(config.
|
|
226
|
+
...(config.webPlugins || []),
|
|
228
227
|
{
|
|
229
228
|
name: 'rebuild-notify',
|
|
230
229
|
setup(build) {
|
|
@@ -232,7 +231,6 @@ export class ITProject {
|
|
|
232
231
|
console.log(`web build ended with ${result.errors.length} errors`);
|
|
233
232
|
console.log(result);
|
|
234
233
|
result.errors.length !== 0 && process.exit(-1);
|
|
235
|
-
// HERE: somehow restart the server from here, e.g., by sending a signal that you trap and react to inside the server.
|
|
236
234
|
});
|
|
237
235
|
}
|
|
238
236
|
},
|
|
@@ -281,10 +279,12 @@ export class ITProject {
|
|
|
281
279
|
</html>
|
|
282
280
|
`);
|
|
283
281
|
Promise.all([
|
|
284
|
-
esbuild.context(esbuildConfigNode)
|
|
282
|
+
esbuild.context(esbuildConfigNode)
|
|
283
|
+
.then(async (nodeContext) => {
|
|
285
284
|
await nodeContext.watch();
|
|
286
285
|
}),
|
|
287
|
-
esbuild.context(esbuildConfigWeb)
|
|
286
|
+
esbuild.context(esbuildConfigWeb)
|
|
287
|
+
.then(async (esbuildWeb) => {
|
|
288
288
|
await esbuildWeb.watch();
|
|
289
289
|
})
|
|
290
290
|
]).then(() => {
|
|
@@ -308,30 +308,16 @@ export class ITProject {
|
|
|
308
308
|
});
|
|
309
309
|
webSocketServer.on('open', () => {
|
|
310
310
|
console.log('open');
|
|
311
|
-
// process.exit()
|
|
312
311
|
});
|
|
313
312
|
webSocketServer.on('close', (data) => {
|
|
314
313
|
console.log('webSocketServer close: %s', data);
|
|
315
|
-
// process.exit()
|
|
316
314
|
});
|
|
317
315
|
webSocketServer.on('listening', () => {
|
|
318
316
|
console.log("webSocketServer listening", webSocketServer.address());
|
|
319
|
-
// process.exit()
|
|
320
317
|
});
|
|
321
318
|
webSocketServer.on('connection', (webSocket) => {
|
|
322
|
-
console.log('webSocketServer connection');
|
|
323
319
|
webSocket.on('message', (webSocketData) => {
|
|
324
|
-
// console.log('webSocket message: %s', webSocketData);
|
|
325
320
|
const payload = JSON.parse(webSocketData.valueOf().toString());
|
|
326
|
-
// console.log('webSocket payload', JSON.stringify(payload.data.testResourceConfiguration.name, null, 2));
|
|
327
|
-
// as {
|
|
328
|
-
// type: string,
|
|
329
|
-
// data: ITTestResourceRequirement & {
|
|
330
|
-
// testResourceConfiguration: {
|
|
331
|
-
// name: string;
|
|
332
|
-
// }
|
|
333
|
-
// }
|
|
334
|
-
// };
|
|
335
321
|
const messageType = payload.type;
|
|
336
322
|
if (messageType === "testeranto:hola") {
|
|
337
323
|
const name = payload.data.requirement.name;
|
|
@@ -369,7 +355,6 @@ export class ITProject {
|
|
|
369
355
|
clearInterval(bootInterval);
|
|
370
356
|
pm2.launchBus((err, pm2_bus) => {
|
|
371
357
|
pm2_bus.on("testeranto:hola", (packet) => {
|
|
372
|
-
console.log("hola IPC", packet);
|
|
373
358
|
this.requestResource(packet.data.requirement, 'ipc');
|
|
374
359
|
});
|
|
375
360
|
pm2_bus.on("testeranto:adios", (payload) => {
|
|
@@ -485,9 +470,7 @@ export class ITProject {
|
|
|
485
470
|
});
|
|
486
471
|
});
|
|
487
472
|
}).then((failures) => {
|
|
488
|
-
console.log("Stopping PM2");
|
|
489
473
|
pm2.stop("all", (e) => console.error(e));
|
|
490
|
-
// pm2.killDaemon((e) => console.error(e));
|
|
491
474
|
pm2.disconnect();
|
|
492
475
|
console.log(`gracefully exiting with ${failures} failures`);
|
|
493
476
|
process.exit(failures);
|