File tree 1 file changed +12
-1
lines changed
__tests__/all-defaults-with-json
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
import path from "path" ;
2
- import { promises as fsAsync } from "fs" ;
2
+ import fs , { promises as fsAsync } from "fs" ;
3
3
import prettier from "prettier" ;
4
4
import * as assert from "assert" ;
5
5
import postcss from "postcss" ;
@@ -18,6 +18,15 @@ const plugins = [
18
18
} ) ,
19
19
] ;
20
20
21
+ const waitForFile = ( path : string ) =>
22
+ new Promise < void > ( async ( resolve ) => {
23
+ while ( ! fs . existsSync ( path ) ) {
24
+ await new Promise ( ( a ) => setTimeout ( a , 50 ) ) ;
25
+ }
26
+ await new Promise ( ( a ) => setTimeout ( a , 0 ) ) ;
27
+ resolve ( ) ;
28
+ } ) ;
29
+
21
30
describe ( "Default with json" , ( ) => {
22
31
it ( "should transform css and module json" , async ( ) => {
23
32
/** Path to the input css file */
@@ -64,6 +73,8 @@ describe("Default with json", () => {
64
73
} )
65
74
) ;
66
75
76
+ await waitForFile ( path . join ( __dirname , "./dist/modules.json" ) ) ;
77
+
67
78
const generateJSON = JSON . parse (
68
79
await fsAsync . readFile (
69
80
path . join ( __dirname , "./dist/modules.json" ) ,
You can’t perform that action at this time.
0 commit comments