cli: use tree-kill to kill serve task in e2e test

This commit is contained in:
Patrik Oldsberg
2020-07-02 14:41:18 +02:00
parent 7cd04c77fa
commit c499656a69
3 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -16,6 +16,7 @@
const os = require('os');
const fs = require('fs-extra');
const killTree = require('tree-kill');
const { resolve: resolvePath, join: joinPath } = require('path');
const Browser = require('zombie');
const {
@@ -217,7 +218,6 @@ async function createPlugin(pluginName, appDir) {
async function testAppServe(pluginName, appDir) {
const startApp = spawnPiped(['yarn', 'start'], {
cwd: appDir,
detached: true,
});
Browser.localhost('localhost', 3000);
@@ -236,7 +236,7 @@ async function testAppServe(pluginName, appDir) {
throw new Error(`App serve test failed, ${error}`);
} finally {
// Kill entire process group, otherwise we'll end up with hanging serve processes
process.kill(-startApp.pid, 'SIGTERM');
killTree(startApp.pid);
}
await waitForExit(startApp);
+1
View File
@@ -112,6 +112,7 @@
"@types/webpack-dev-server": "^3.10.0",
"del": "^5.1.0",
"nodemon": "^2.0.2",
"tree-kill": "^1.2.2",
"ts-node": "^8.6.2",
"zombie": "^6.1.4"
},