11"use strict" ;
2- var fs_1 = require ( 'fs' ) ;
2+ var fs = require ( 'fs' ) ;
3+ var path_1 = require ( 'path' ) ;
34var process_console_log_1 = require ( 'process-console-log' ) ;
45var import_paths_1 = require ( './import-paths' ) ;
56var helpers_1 = require ( './helpers' ) ;
7+ var tmpPath = path_1 . join ( __dirname , '..' , '..' , '.tmp' ) ;
68function writeTest ( _a ) {
79 var dir = _a . dir , tests = _a . tests , testPath = _a . testPath ;
810 var fixImports = import_paths_1 . default ( dir , tests ) ;
@@ -11,14 +13,20 @@ function writeTest(_a) {
1113 . concat ( helpers_1 . default ( dir ) )
1214 . concat ( fixImports )
1315 . 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+ }
1424 return new Promise ( function ( resolve , reject ) {
15- fs_1 . writeFile ( testPath , output , function ( err ) {
25+ fs . writeFile ( testPath , output , function ( err ) {
1626 if ( err ) {
1727 reject ( err ) ;
1828 }
1929 resolve ( ) ;
2030 } ) ;
2131 } ) ;
2232}
23- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
24- exports . default = writeTest ;
0 commit comments