Skip to content

Commit

Permalink
fix subprocess test
Browse files Browse the repository at this point in the history
  • Loading branch information
jwartofsky-yext committed Sep 11, 2023
1 parent a156b0a commit a765ea2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/pages/src/util/runSubprocess.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import runSubprocess from "./runSubprocess.js";
import path from "node:path";

describe("runSubprocess", () => {
it("runs echo successfully", async () => {
Expand All @@ -8,11 +7,12 @@ describe("runSubprocess", () => {
});

it("returns non-zero when subprocess fails", async () => {
const exitCode = await runSubprocess("echo", ["$((0/0))"]);
if (path.sep === path.posix.sep) {
if (process.platform === "win32") {
const exitCode = await runSubprocess("powershell.exe", ["0/0"]);
expect(exitCode).not.toEqual(0);
} else {
const exitCode = await runSubprocess("echo", ["$((0/0))"]);
expect(exitCode).not.toEqual(0);
}
// commands do not return exit codes on Windows, so we skip this test in that case
expect(true).toEqual(true);
});
});

0 comments on commit a765ea2

Please sign in to comment.