cli: use tree-kill to kill serve task in e2e test
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user