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"
},
+5
View File
@@ -17999,6 +17999,11 @@ tr46@^2.0.2:
dependencies:
punycode "^2.1.1"
tree-kill@^1.2.2:
version "1.2.2"
resolved "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"