From 89eba84a4182ea475b878c83b617416117498818 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 9 May 2021 14:53:16 -0700 Subject: [PATCH] test: support test.utils.command-exists on Windows `cat` is a common utility on Unix systems, however, it is not universally available. On Windows systems, resort to `cmd` (%COMSPEC%) as the shell interpreter is guaranteed to be present. It stands to reason that `sh` would be a viable alternative to `cat` as that is the default (POSIX) shell interpreter on Unix systems and should be present on any SuS or POSIX complaint system. --- test/utils/command-exists.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/utils/command-exists.test.js b/test/utils/command-exists.test.js index 95ca5f3b..97205db5 100644 --- a/test/utils/command-exists.test.js +++ b/test/utils/command-exists.test.js @@ -2,7 +2,11 @@ const commandExists = require("../../src/utils/command-exists"); describe("commandExists()", () => { test("should return `true` for existing command", async () => { - await expect(commandExists("cat")).resolves.toEqual(true); + if (process.platform === "win32") { + await expect(commandExists("cmd")).resolves.toEqual(true); + } else { + await expect(commandExists("cat")).resolves.toEqual(true); + } }); test("should return `false` for non-existent command", async () => {