File tree 3 files changed +16
-6
lines changed
packages/@aws-cdk/integ-runner/test
3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
1
import * as child_process from 'child_process' ;
2
+ import * as builtinFs from 'fs' ;
2
3
import { Manifest } from '@aws-cdk/cloud-assembly-schema' ;
3
4
import { AVAILABILITY_ZONE_FALLBACK_CONTEXT_KEY } from '@aws-cdk/cx-api' ;
4
5
import * as fs from 'fs-extra' ;
@@ -24,7 +25,9 @@ beforeEach(() => {
24
25
} ) ;
25
26
jest . spyOn ( fs , 'moveSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
26
27
removeSyncMock = jest . spyOn ( fs , 'removeSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
27
- jest . spyOn ( fs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
28
+
29
+ // fs-extra delegates to the built-in one, this also catches calls done directly
30
+ jest . spyOn ( builtinFs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
28
31
} ) ;
29
32
30
33
afterEach ( ( ) => {
Original file line number Diff line number Diff line change 1
1
import * as child_process from 'child_process' ;
2
+ import * as builtinFs from 'fs' ;
2
3
import * as path from 'path' ;
3
4
import * as fs from 'fs-extra' ;
4
5
import { IntegSnapshotRunner , IntegTest } from '../../lib/runner' ;
@@ -24,8 +25,10 @@ beforeEach(() => {
24
25
jest . spyOn ( process . stdout , 'write' ) . mockImplementation ( ( ) => { return true ; } ) ;
25
26
jest . spyOn ( fs , 'moveSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
26
27
jest . spyOn ( fs , 'removeSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
27
- jest . spyOn ( fs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
28
- jest . spyOn ( fs , 'rmdirSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
28
+
29
+ // fs-extra delegates to the built-in one, this also catches calls done directly
30
+ jest . spyOn ( builtinFs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
31
+ jest . spyOn ( builtinFs , 'rmdirSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
29
32
} ) ;
30
33
31
34
afterEach ( ( ) => {
Original file line number Diff line number Diff line change 1
1
import * as child_process from 'child_process' ;
2
+ import * as builtinFs from 'fs' ;
2
3
import * as path from 'path' ;
3
4
import * as fs from 'fs-extra' ;
4
5
import * as workerpool from 'workerpool' ;
@@ -13,10 +14,13 @@ beforeAll(() => {
13
14
beforeEach ( ( ) => {
14
15
jest . spyOn ( fs , 'moveSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
15
16
jest . spyOn ( fs , 'emptyDirSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
16
- jest . spyOn ( fs , 'unlinkSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
17
17
jest . spyOn ( fs , 'removeSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
18
- jest . spyOn ( fs , 'rmdirSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
19
- jest . spyOn ( fs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
18
+
19
+ // fs-extra delegates to the built-in one, this also catches calls done directly
20
+ jest . spyOn ( builtinFs , 'rmdirSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
21
+ jest . spyOn ( builtinFs , 'writeFileSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
22
+ jest . spyOn ( builtinFs , 'unlinkSync' ) . mockImplementation ( ( ) => { return true ; } ) ;
23
+
20
24
spawnSyncMock = jest . spyOn ( child_process , 'spawnSync' )
21
25
. mockReturnValueOnce ( {
22
26
status : 0 ,
You can’t perform that action at this time.
0 commit comments