From 25a52c397bde8dc951955d4640bb15e56ea2e34b Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:54:30 +0000 Subject: [PATCH 1/3] force exit --- .changeset/silver-peaches-lie.md | 5 +++++ packages/cli/src/cmds/entrypoint.ts | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/silver-peaches-lie.md diff --git a/.changeset/silver-peaches-lie.md b/.changeset/silver-peaches-lie.md new file mode 100644 index 00000000..e6867eca --- /dev/null +++ b/.changeset/silver-peaches-lie.md @@ -0,0 +1,5 @@ +--- +"@moonwall/cli": patch +--- + +Force exit on failure diff --git a/packages/cli/src/cmds/entrypoint.ts b/packages/cli/src/cmds/entrypoint.ts index 91373ee6..0ca5b550 100755 --- a/packages/cli/src/cmds/entrypoint.ts +++ b/packages/cli/src/cmds/entrypoint.ts @@ -104,9 +104,13 @@ yargs(hideBin(process.argv)) async (args) => { if (args.envName) { process.env.MOON_RUN_SCRIPTS = "true"; - (await testCmd(args.envName.toString(), { testNamePattern: args.GrepTest })) - ? process.exit(0) - : process.exit(1); + if (await testCmd(args.envName.toString(), { testNamePattern: args.GrepTest })) { + console.log("✅ All tests passed"); + process.exit(0); + } else { + console.log("❌ Some tests failed"); + process.kill(process.pid, 'SIGTERM'); + } } else { console.log("❌ No environment specified"); console.log(`👉 Run 'pnpm moonwall --help' for more information`); From 7853ba0c0ea36baaf9cadeb83dbe1aeda040f8a0 Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:56:49 +0000 Subject: [PATCH 2/3] fmt --- packages/cli/src/cmds/entrypoint.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/cmds/entrypoint.ts b/packages/cli/src/cmds/entrypoint.ts index 0ca5b550..df898a72 100755 --- a/packages/cli/src/cmds/entrypoint.ts +++ b/packages/cli/src/cmds/entrypoint.ts @@ -109,7 +109,7 @@ yargs(hideBin(process.argv)) process.exit(0); } else { console.log("❌ Some tests failed"); - process.kill(process.pid, 'SIGTERM'); + process.kill(process.pid, "SIGTERM"); } } else { console.log("❌ No environment specified"); From 968194588f26a2a7e5ece70bfc6a8a230b965037 Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:05:04 +0000 Subject: [PATCH 3/3] fix tests --- packages/cli/src/cmds/runTests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cli/src/cmds/runTests.ts b/packages/cli/src/cmds/runTests.ts index a5ff5d55..166b4bb6 100644 --- a/packages/cli/src/cmds/runTests.ts +++ b/packages/cli/src/cmds/runTests.ts @@ -36,7 +36,6 @@ export async function testCmd(envName: string, additionalArgs?: object): Promise const failed = vitest!.state.getFiles().filter((file) => file.result!.state === "fail"); if (failed.length > 0) { - process.stderr.write("Tests failed\n"); return false; } else { return true;