Skip to content

Commit d649bb2

Browse files
committed
Test for presence of shadowenv binary before running Shadowenv suite
Not all non-Shopify developer environments have a version of shadowenv installed. In those circumstances, skip the suite with a console warning. Part of Shopify#2877
1 parent 3b5a9ff commit d649bb2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

vscode/src/test/suite/ruby/shadowenv.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import fs from "fs";
33
import assert from "assert";
44
import path from "path";
55
import os from "os";
6+
import { execSync } from "child_process";
67

78
import { beforeEach, afterEach } from "mocha";
89
import * as vscode from "vscode";
@@ -14,13 +15,21 @@ import { LOG_CHANNEL, asyncExec } from "../../../common";
1415
import { RUBY_VERSION } from "../../rubyVersion";
1516
import * as common from "../../../common";
1617

17-
suite("Shadowenv", () => {
18+
suite("Shadowenv", async () => {
1819
if (os.platform() === "win32") {
1920
// eslint-disable-next-line no-console
2021
console.log("Skipping Shadowenv tests on Windows");
2122
return;
2223
}
2324

25+
try {
26+
execSync("shadowenv --version >/dev/null 2>&1");
27+
} catch {
28+
// eslint-disable-next-line no-console
29+
console.log("Skipping Shadowenv tests because no `shadowenv` found");
30+
return;
31+
}
32+
2433
let rootPath: string;
2534
let workspacePath: string;
2635
let workspaceFolder: vscode.WorkspaceFolder;

0 commit comments

Comments
 (0)