Skip to content

Commit

Permalink
test(middleware-code-coverage): kill child process after ava is done
Browse files Browse the repository at this point in the history
  • Loading branch information
flovogt committed Mar 4, 2024
1 parent eda8954 commit 4435323
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/middleware-code-coverage/test/integration/boot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import test from "ava";
import {default as test, registerCompletionHandler} from "ava";
import path from "node:path";
import {fileURLToPath} from "node:url";
import getPort from "get-port";
Expand Down Expand Up @@ -70,11 +70,12 @@ function exec(command, args=[]) {
}

function startUI5Server(configPath, port) {
// Starting the app this way allows AVA to directly manage and kill subprocesses like "ui5 serve".
// Using App's 'npm start' script would start a (detached) subprocess and that
// would require more efforts to find and kill it.
const child = exec("ui5", ["serve", "--config", configPath, "--port", port]);

registerCompletionHandler(() => {
process.exit();
});

return new Promise( (resolve, reject) => {
const onError = (errMessage = "Start of UI5 Server failed.") => {
reject(new Error(errMessage));
Expand Down

0 comments on commit 4435323

Please sign in to comment.