@@ -5,6 +5,7 @@ const build_stats = require("./utils/poller/build_stats.js");
55const { access } = require ( "fs" ) ;
66var fs = require ( "fs" ) ;
77const StreamZip = require ( "node-stream-zip" ) ;
8+ const path = require ( "path" ) ;
89
910function download_artefact ( username , access_key , env , test_id , file_path ) {
1011 return new Promise ( function ( resolve , reject ) {
@@ -15,7 +16,7 @@ function download_artefact(username, access_key, env, test_id, file_path) {
1516 }
1617 let old_path = file_path ;
1718 //Create an empty file
18- file_path += "/ artefacts.zip";
19+ file_path = path . join ( file_path , " artefacts.zip") ;
1920 const stream = fs . createWriteStream ( file_path ) ;
2021 stream . end ( ) ;
2122 request (
@@ -122,7 +123,11 @@ function generate_report(args) {
122123 reject ( "Session not found" ) ;
123124 return ;
124125 }
125- let directory = "./lambdatest-artefacts/" + args [ "session_id" ] ;
126+ let directory = path . join (
127+ "." ,
128+ "lambdatest-artefacts" ,
129+ args [ "session_id" ]
130+ ) ;
126131 //Reject if there are no tests in sessions
127132 if ( build_info [ "data" ] . length == 0 ) {
128133 reject ( "No tests in this session" ) ;
@@ -138,15 +143,12 @@ function generate_report(args) {
138143 access_key ,
139144 env ,
140145 build_info [ "data" ] [ i ] [ "test_id" ] ,
141- directory +
142- "/" +
143- build_info [ "data" ] [ i ] [ "browser" ] +
144- "-" +
145- build_info [ "data" ] [ i ] [ "version" ] +
146- "-" +
147- build_info [ "data" ] [ i ] [ "platform" ] +
148- "/" +
146+ path . join (
147+ directory ,
148+ build_info [ "data" ] [ i ] [ "browser" ] ,
149+ build_info [ "data" ] [ i ] [ "version" ] ,
149150 build_info [ "data" ] [ i ] [ "test_id" ]
151+ )
150152 )
151153 . then ( function ( resp ) {
152154 //Files downloaded
0 commit comments