@@ -4,15 +4,21 @@ jest.unmock('../src/JestExt')
44jest . mock ( '../src/DebugCodeLens' , ( ) => ( {
55 DebugCodeLensProvider : class MockCodeLensProvider { } ,
66} ) )
7+ jest . mock ( 'os' )
78
89import { JestExt } from '../src/JestExt'
910import { ProjectWorkspace , Settings } from 'jest-editor-support'
11+ import { platform } from 'os'
1012import { window , workspace , debug } from 'vscode'
1113import { hasDocument , isOpenInMultipleEditors } from '../src/editor'
1214import { failingAssertionStyle } from '../src/decorations'
1315
1416describe ( 'JestExt' , ( ) => {
1517 const mockSettings = ( Settings as any ) as jest . Mock < any >
18+ const mockSettingsObject = {
19+ getConfig : callback => callback ( ) ,
20+ jestVersionMajor : 22 ,
21+ }
1622 const getConfiguration = workspace . getConfiguration as jest . Mock < any >
1723 let projectWorkspace : ProjectWorkspace
1824 const channelStub = { appendLine : ( ) => { } } as any
@@ -27,8 +33,8 @@ describe('JestExt', () => {
2733 } )
2834
2935 it ( 'should show error message if jest version i < 18' , ( ) => {
30- mockSettings . mockImplementation ( ( ) => ( {
31- getConfig : callback => callback ( ) ,
36+ mockSettings . mockImplementationOnce ( ( ) => ( {
37+ ... mockSettingsObject ,
3238 jestVersionMajor : 17 ,
3339 } ) )
3440 new JestExt ( null , projectWorkspace , channelStub , extensionSettings )
@@ -37,14 +43,20 @@ describe('JestExt', () => {
3743 } )
3844
3945 it . skip ( 'should not show error message if jest version is 20' , ( ) => {
40- mockSettings . mockImplementation ( ( ) => ( {
41- getConfig : callback => callback ( ) ,
42- jestVersionMajor : 20 ,
43- } ) )
46+ mockSettings . mockImplementationOnce ( ( ) => mockSettingsObject )
4447 new JestExt ( null , projectWorkspace , channelStub , extensionSettings )
4548 expect ( window . showErrorMessage ) . not . toBeCalled ( )
4649 } )
4750
51+ it ( 'should create `Settings` with `shell` set on Windows' , ( ) => {
52+ mockSettings . mockImplementationOnce ( ( _ , options ) => {
53+ expect ( options . shell ) . toBe ( true )
54+ return mockSettingsObject
55+ } )
56+ ; ( ( platform as any ) as jest . Mock < any > ) . mockReturnValueOnce ( 'win32' )
57+ new JestExt ( null , projectWorkspace , channelStub , extensionSettings )
58+ } )
59+
4860 describe ( 'resetInlineErrorDecorators()' , ( ) => {
4961 let sut : JestExt
5062 const editor : any = {
0 commit comments