File tree 2 files changed +12
-11
lines changed 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
- const deasync = require ( 'deasync' ) ; // powerful magic
1
+ main ( ) ;
2
2
3
- const promiseSync = deasync ( ( promise , cb ) => {
4
- console . log ( 'wait for promise, before' ) ;
5
- promise
3
+ async function main ( ) {
4
+
5
+ const importSync = name =>
6
+ // promiseSync(
7
+ import ( name )
6
8
. then ( result => {
7
9
console . log ( 'promise resolved' ) ;
8
- cb ( null , result ) ;
10
+ return result ;
9
11
} )
10
12
. catch ( error => {
11
13
console . log ( 'promise error' ) ;
12
- cb ( error ) ;
13
14
} ) ;
14
- } ) ;
15
-
16
- const importSync = name => promiseSync ( import ( name ) ) ;
15
+ // );
17
16
18
17
// Look, no await needed here!
19
18
console . log ( 'import sync before' ) ;
20
- const jestConfig = importSync ( './jest.config.js' ) . default ;
19
+ const jestConfig = ( await importSync ( './jest.config' ) ) . default ;
21
20
console . log ( 'import sync after' ) ;
22
21
23
22
const testGlobals = { } ;
@@ -102,3 +101,5 @@ module.exports = {
102
101
} ,
103
102
] ,
104
103
} ;
104
+
105
+ }
Original file line number Diff line number Diff line change 1
1
import path from 'path' ;
2
- import server from './test/config/server.js ' ;
2
+ import server from './test/config/server' ;
3
3
4
4
console . log ( 'jest.config' ) ;
5
5
You can’t perform that action at this time.
0 commit comments