@@ -26,6 +26,7 @@ import {
26
26
mockGlobalObject ,
27
27
mockObject ,
28
28
MockedFunction ,
29
+ mockGlobalValue ,
29
30
} from "../../MockUtils" ;
30
31
import { SwiftToolchain } from "../../../src/toolchain/toolchain" ;
31
32
import { WorkspaceContext } from "../../../src/WorkspaceContext" ;
@@ -34,6 +35,7 @@ suite("debugger.lldb Tests", () => {
34
35
suite ( "getLLDBLibPath Tests" , ( ) => {
35
36
let mockToolchain : MockedObject < SwiftToolchain > ;
36
37
let mockFindLibLLDB : MockedFunction < ( typeof lldb ) [ "findLibLLDB" ] > ;
38
+ const mockedPlatform = mockGlobalValue ( process , "platform" ) ;
37
39
const mockUtil = mockGlobalModule ( util ) ;
38
40
39
41
setup ( ( ) => {
@@ -50,17 +52,14 @@ suite("debugger.lldb Tests", () => {
50
52
expect ( result . failure ) . to . have . property ( "message" , "Failed to get LLDB" ) ;
51
53
} ) ;
52
54
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 ) ;
64
63
} ) ;
65
64
66
65
test ( "should return failure if findLibLLDB returns falsy values" , async ( ) => {
0 commit comments