testeranto 0.48.0 → 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/src/Project.ts
CHANGED
|
@@ -96,7 +96,6 @@ export class ITProject {
|
|
|
96
96
|
const testPath = `${process.cwd()}/${config.tests}`;
|
|
97
97
|
const featurePath = `${process.cwd()}/${config.features}`;
|
|
98
98
|
|
|
99
|
-
// q to quit, x to kill
|
|
100
99
|
process.stdin.on('keypress', (str, key) => {
|
|
101
100
|
if (key.name === 'q') {
|
|
102
101
|
this.initiateShutdown("'q' command")
|
|
@@ -108,9 +107,6 @@ export class ITProject {
|
|
|
108
107
|
process.exit(-1)
|
|
109
108
|
}
|
|
110
109
|
});
|
|
111
|
-
// process.on('SIGINT', () => this.initiateShutdown("CTRL+C"));
|
|
112
|
-
// process.on('SIGQUIT', () => this.initiateShutdown("Keyboard quit"));
|
|
113
|
-
// process.on('SIGTERM', () => this.initiateShutdown("'kill' command"));
|
|
114
110
|
|
|
115
111
|
import(testPath).then((tests) => {
|
|
116
112
|
this.tests = tests.default;
|
|
@@ -118,7 +114,6 @@ export class ITProject {
|
|
|
118
114
|
import(featurePath).then((features) => {
|
|
119
115
|
this.features = features.default;
|
|
120
116
|
|
|
121
|
-
// Make html files for webtests. Is this necessary?
|
|
122
117
|
Promise.resolve(Promise.all(
|
|
123
118
|
[
|
|
124
119
|
...this.getSecondaryEndpointsPoints("web")
|
|
@@ -184,18 +179,16 @@ export class ITProject {
|
|
|
184
179
|
},
|
|
185
180
|
plugins: [
|
|
186
181
|
...(config.nodePlugins || []),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// }
|
|
198
|
-
// },
|
|
182
|
+
{
|
|
183
|
+
name: 'rebuild-notify',
|
|
184
|
+
setup(build) {
|
|
185
|
+
build.onEnd(result => {
|
|
186
|
+
console.log(`node build ended with ${result.errors.length} errors`);
|
|
187
|
+
console.log(result)
|
|
188
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
},
|
|
199
192
|
],
|
|
200
193
|
};
|
|
201
194
|
const esbuildConfigWeb: BuildOptions = {
|
|
@@ -209,14 +202,15 @@ export class ITProject {
|
|
|
209
202
|
},
|
|
210
203
|
|
|
211
204
|
external: [
|
|
205
|
+
"tests.test.js",
|
|
206
|
+
"features.test.js",
|
|
212
207
|
// "url",
|
|
208
|
+
// "react",
|
|
213
209
|
"electron",
|
|
214
210
|
"path",
|
|
215
211
|
"fs",
|
|
216
|
-
// "react",
|
|
217
212
|
"stream",
|
|
218
|
-
|
|
219
|
-
"features.test.js"],
|
|
213
|
+
],
|
|
220
214
|
platform: "browser",
|
|
221
215
|
|
|
222
216
|
outbase: config.outbase,
|
|
@@ -238,19 +232,16 @@ export class ITProject {
|
|
|
238
232
|
},
|
|
239
233
|
plugins: [
|
|
240
234
|
...(config.webPlugins || []),
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// })
|
|
252
|
-
// }
|
|
253
|
-
// },
|
|
235
|
+
{
|
|
236
|
+
name: 'rebuild-notify',
|
|
237
|
+
setup(build) {
|
|
238
|
+
build.onEnd(result => {
|
|
239
|
+
console.log(`web build ended with ${result.errors.length} errors`);
|
|
240
|
+
console.log(result)
|
|
241
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
},
|
|
254
245
|
],
|
|
255
246
|
};
|
|
256
247
|
|
|
@@ -299,24 +290,33 @@ export class ITProject {
|
|
|
299
290
|
`)
|
|
300
291
|
|
|
301
292
|
Promise.all([
|
|
302
|
-
esbuild.context(esbuildConfigNode)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
293
|
+
esbuild.context(esbuildConfigNode)
|
|
294
|
+
.then(async (nodeContext) => {
|
|
295
|
+
await nodeContext.watch();
|
|
296
|
+
}),
|
|
297
|
+
|
|
298
|
+
esbuild.context(esbuildConfigWeb)
|
|
299
|
+
.then(async (esbuildWeb) => {
|
|
300
|
+
await esbuildWeb.watch();
|
|
301
|
+
})
|
|
302
|
+
|
|
308
303
|
]).then(() => {
|
|
304
|
+
|
|
309
305
|
if (config.devMode === false) {
|
|
310
306
|
console.log("Your tests were built but not run because devMode was false. Exiting gracefully");
|
|
311
307
|
process.exit(0);
|
|
308
|
+
|
|
312
309
|
} else {
|
|
310
|
+
|
|
313
311
|
pm2.connect(async (err) => {
|
|
312
|
+
|
|
314
313
|
if (err) {
|
|
315
314
|
console.error(err);
|
|
316
315
|
process.exit(-1);
|
|
317
316
|
} else {
|
|
318
317
|
console.log(`pm2 is connected`);
|
|
319
318
|
}
|
|
319
|
+
|
|
320
320
|
// run a websocket as an alternative to node IPC
|
|
321
321
|
webSocketServer = new WebSocketServer({
|
|
322
322
|
port: 8080,
|
|
@@ -325,36 +325,19 @@ export class ITProject {
|
|
|
325
325
|
|
|
326
326
|
webSocketServer.on('open', () => {
|
|
327
327
|
console.log('open');
|
|
328
|
-
// process.exit()
|
|
329
328
|
});
|
|
330
329
|
|
|
331
330
|
webSocketServer.on('close', (data) => {
|
|
332
331
|
console.log('webSocketServer close: %s', data);
|
|
333
|
-
// process.exit()
|
|
334
332
|
});
|
|
335
333
|
|
|
336
334
|
webSocketServer.on('listening', () => {
|
|
337
335
|
console.log("webSocketServer listening", webSocketServer.address());
|
|
338
|
-
// process.exit()
|
|
339
336
|
});
|
|
340
337
|
|
|
341
338
|
webSocketServer.on('connection', (webSocket: WebSocket) => {
|
|
342
|
-
console.log('webSocketServer connection');
|
|
343
|
-
|
|
344
339
|
webSocket.on('message', (webSocketData) => {
|
|
345
|
-
// console.log('webSocket message: %s', webSocketData);
|
|
346
340
|
const payload = JSON.parse(webSocketData.valueOf().toString() as any);
|
|
347
|
-
|
|
348
|
-
// console.log('webSocket payload', JSON.stringify(payload.data.testResourceConfiguration.name, null, 2));
|
|
349
|
-
// as {
|
|
350
|
-
// type: string,
|
|
351
|
-
// data: ITTestResourceRequirement & {
|
|
352
|
-
// testResourceConfiguration: {
|
|
353
|
-
// name: string;
|
|
354
|
-
// }
|
|
355
|
-
// }
|
|
356
|
-
// };
|
|
357
|
-
|
|
358
341
|
const messageType = payload.type;
|
|
359
342
|
|
|
360
343
|
if (messageType === "testeranto:hola") {
|
|
@@ -401,7 +384,6 @@ export class ITProject {
|
|
|
401
384
|
|
|
402
385
|
pm2.launchBus((err, pm2_bus) => {
|
|
403
386
|
pm2_bus.on("testeranto:hola", (packet: { data: { requirement: ITTestResourceRequirement } }) => {
|
|
404
|
-
console.log("hola IPC", packet);
|
|
405
387
|
this.requestResource(
|
|
406
388
|
packet.data.requirement,
|
|
407
389
|
'ipc'
|