@@ -5,6 +5,7 @@ const build_stats = require("./utils/poller/build_stats.js");
5
5
const { access } = require ( "fs" ) ;
6
6
var fs = require ( "fs" ) ;
7
7
const StreamZip = require ( "node-stream-zip" ) ;
8
+ const path = require ( "path" ) ;
8
9
9
10
function download_artefact ( username , access_key , env , test_id , file_path ) {
10
11
return new Promise ( function ( resolve , reject ) {
@@ -15,7 +16,7 @@ function download_artefact(username, access_key, env, test_id, file_path) {
15
16
}
16
17
let old_path = file_path ;
17
18
//Create an empty file
18
- file_path += "/ artefacts.zip";
19
+ file_path = path . join ( file_path , " artefacts.zip") ;
19
20
const stream = fs . createWriteStream ( file_path ) ;
20
21
stream . end ( ) ;
21
22
request (
@@ -122,7 +123,11 @@ function generate_report(args) {
122
123
reject ( "Session not found" ) ;
123
124
return ;
124
125
}
125
- let directory = "./lambdatest-artefacts/" + args [ "session_id" ] ;
126
+ let directory = path . join (
127
+ "." ,
128
+ "lambdatest-artefacts" ,
129
+ args [ "session_id" ]
130
+ ) ;
126
131
//Reject if there are no tests in sessions
127
132
if ( build_info [ "data" ] . length == 0 ) {
128
133
reject ( "No tests in this session" ) ;
@@ -138,15 +143,12 @@ function generate_report(args) {
138
143
access_key ,
139
144
env ,
140
145
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" ] ,
149
150
build_info [ "data" ] [ i ] [ "test_id" ]
151
+ )
150
152
)
151
153
. then ( function ( resp ) {
152
154
//Files downloaded
0 commit comments