File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
- import * as fs from 'fs/promises' ;
2
1
import * as Path from 'path' ;
2
+ // Import syntax only works in Node > 12
3
+ const fs = require ( 'fs' ) . promises ;
3
4
4
5
/**
5
6
* Collects the paths to all available modules and components.
Original file line number Diff line number Diff line change 1
- import * as fs from 'fs/promises' ;
2
1
import * as Path from 'path' ;
3
2
import { mocked } from 'ts-jest/utils' ;
4
3
import { ModuleStateBuilder } from '../lib/ModuleStateBuilder' ;
5
4
6
- jest . mock ( 'fs/promises' ) ;
5
+ // Import syntax only works in Node > 12
6
+ const fs = require ( 'fs' ) . promises ;
7
+
8
+ jest . mock ( 'fs' , ( ) => ( {
9
+ promises : {
10
+ realpath : jest . fn ( ) ,
11
+ stat : jest . fn ( ) ,
12
+ readdir : jest . fn ( ) ,
13
+ readFile : jest . fn ( ) ,
14
+ } ,
15
+ } ) ) ;
7
16
8
17
describe ( 'ModuleStateBuilder' , ( ) => {
9
18
let builder : ModuleStateBuilder ;
You can’t perform that action at this time.
0 commit comments