1
1
"use strict" ;
2
- var fs_1 = require ( 'fs' ) ;
2
+ var fs = require ( 'fs' ) ;
3
+ var path_1 = require ( 'path' ) ;
3
4
var process_console_log_1 = require ( 'process-console-log' ) ;
4
5
var import_paths_1 = require ( './import-paths' ) ;
5
6
var helpers_1 = require ( './helpers' ) ;
7
+ var tmpPath = path_1 . join ( __dirname , '..' , '..' , '.tmp' ) ;
6
8
function writeTest ( _a ) {
7
9
var dir = _a . dir , tests = _a . tests , testPath = _a . testPath ;
8
10
var fixImports = import_paths_1 . default ( dir , tests ) ;
@@ -11,14 +13,20 @@ function writeTest(_a) {
11
13
. concat ( helpers_1 . default ( dir ) )
12
14
. concat ( fixImports )
13
15
. concat ( '\n}());' ) ;
16
+ writeTestFile ( testPath , output ) ;
17
+ }
18
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
19
+ exports . default = writeTest ;
20
+ function writeTestFile ( testPath , output ) {
21
+ if ( ! fs . existsSync ( tmpPath ) ) {
22
+ fs . mkdirSync ( tmpPath ) ;
23
+ }
14
24
return new Promise ( function ( resolve , reject ) {
15
- fs_1 . writeFile ( testPath , output , function ( err ) {
25
+ fs . writeFile ( testPath , output , function ( err ) {
16
26
if ( err ) {
17
27
reject ( err ) ;
18
28
}
19
29
resolve ( ) ;
20
30
} ) ;
21
31
} ) ;
22
32
}
23
- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
24
- exports . default = writeTest ;
0 commit comments