File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,30 @@ function gulpProtractorCucumberHtmlReport(opts) {
27
27
28
28
return through . obj ( function ( file , enc , cb ) {
29
29
if ( file . isNull ( ) ) {
30
- return cb ( null , file ) ;
30
+ cb ( null , file ) ;
31
31
}
32
32
33
33
if ( file . isBuffer ( ) ) {
34
34
var testResults = JSON . parse ( file . contents ) ;
35
35
36
- fs . writeFileSync ( opts . dest + '/' + opts . filename , formatter . generateReport ( testResults , opts . templates ) ) ;
36
+ fs . open ( opts . dest + '/' + opts . filename , 'w+' , function ( err , fd ) {
37
+ if ( err ) {
38
+ fs . mkdirsSync ( opts . dest ) ;
39
+ fd = fs . openSync ( opts . dest + '/' + opts . filename , 'w+' ) ;
40
+ }
41
+ fs . writeSync ( fd , formatter . generateReport ( testResults , opts . templates ) ) ;
42
+ fs . copySync ( currentDir + '/templates/assets' , opts . dest + '/assets/' ) ;
37
43
38
- fs . copySync ( currentDir + '/templates/assets' , opts . dest + '/assets/' ) ;
44
+ gutil . log ( PLUGIN_NAME + ':' , 'File \'' + opts . filename + '\' has been created in \'' + opts . dest + '\' directory' ) ;
45
+
46
+ cb ( null , file )
47
+ } ) ;
39
48
40
- gutil . log ( 'File ' + opts . filename + ' has been created in \'' + opts . dest + '\' directory' ) ;
41
49
} else {
42
50
throw new PluginError ( PLUGIN_NAME , '[Error] Currently only buffers are supported' ) ;
43
51
}
44
-
45
- return cb ( null , file ) ;
46
52
} ) ;
47
53
}
48
54
49
55
// Exporting the plugin main function
50
- module . exports = gulpProtractorCucumberHtmlReport ;
56
+ module . exports = gulpProtractorCucumberHtmlReport ;
You can’t perform that action at this time.
0 commit comments