Skip to content

Commit 63fb56b

Browse files
Fix unit test that gets skipped if not on Windows (#1128)
1 parent 2e584d1 commit 63fb56b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/unit-tests/debugger/lldb.test.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
mockGlobalObject,
2727
mockObject,
2828
MockedFunction,
29+
mockGlobalValue,
2930
} from "../../MockUtils";
3031
import { SwiftToolchain } from "../../../src/toolchain/toolchain";
3132
import { WorkspaceContext } from "../../../src/WorkspaceContext";
@@ -34,6 +35,7 @@ suite("debugger.lldb Tests", () => {
3435
suite("getLLDBLibPath Tests", () => {
3536
let mockToolchain: MockedObject<SwiftToolchain>;
3637
let mockFindLibLLDB: MockedFunction<(typeof lldb)["findLibLLDB"]>;
38+
const mockedPlatform = mockGlobalValue(process, "platform");
3739
const mockUtil = mockGlobalModule(util);
3840

3941
setup(() => {
@@ -50,17 +52,14 @@ suite("debugger.lldb Tests", () => {
5052
expect(result.failure).to.have.property("message", "Failed to get LLDB");
5153
});
5254

53-
test("should return failure when execFile throws an error on windows", async function () {
54-
if (process.platform !== "win32") {
55-
this.skip();
56-
} else {
57-
mockToolchain.getLLDB.resolves("/path/to/lldb");
58-
mockUtil.execFile.rejects(new Error("execFile failed"));
59-
const result = await lldb.getLLDBLibPath(instance(mockToolchain));
60-
// specific behaviour: return success and failure both undefined
61-
expect(result.failure).to.equal(undefined);
62-
expect(result.success).to.equal(undefined);
63-
}
55+
test("should return failure when execFile throws an error on windows", async () => {
56+
mockedPlatform.setValue("win32");
57+
mockToolchain.getLLDB.resolves("/path/to/lldb");
58+
mockUtil.execFile.rejects(new Error("execFile failed"));
59+
const result = await lldb.getLLDBLibPath(instance(mockToolchain));
60+
// specific behaviour: return success and failure both undefined
61+
expect(result.failure).to.equal(undefined);
62+
expect(result.success).to.equal(undefined);
6463
});
6564

6665
test("should return failure if findLibLLDB returns falsy values", async () => {

0 commit comments

Comments
 (0)