@@ -234,7 +234,7 @@ export async function bundlePlayWrightProject (
234234 outputFile,
235235 browsers : pwConfigParsed . getBrowsers ( ) ,
236236 playwrightVersion,
237- relativePlaywrightConfigPath : path . relative ( dir , filePath ) ,
237+ relativePlaywrightConfigPath : Session . relativePosixPath ( filePath ) ,
238238 cacheHash,
239239 } )
240240 } )
@@ -286,24 +286,49 @@ export async function loadPlaywrightProjectFiles (
286286 const ignoredFiles = [ '**/node_modules/**' , '.git/**' ]
287287 const parser = new Parser ( { } )
288288 const { files, errors } = await parser . getFilesAndDependencies ( pwConfigParsed )
289- const mode = 0o755 // Default mode for files in the archive
290289 if ( errors . length ) {
291290 throw new Error ( `Error loading playwright project files: ${ errors . map ( ( e : string ) => e ) . join ( ', ' ) } ` )
292291 }
292+ const root = Session . basePath !
293+ const prefix = Session . relativePosixPath ( dir )
294+ const entryDefaults = {
295+ mode : 0o755 , // Default mode for files in the archive
296+ }
293297 for ( const file of files ) {
294- const relativePath = path . relative ( dir , file )
295- archive . file ( file , { name : relativePath , mode } )
298+ archive . file ( file , {
299+ ...entryDefaults ,
300+ name : Session . relativePosixPath ( file ) ,
301+ } )
296302 }
297303 const lockFileDirName = path . dirname ( lockFile )
298- archive . file ( lockFile , { name : path . basename ( lockFile ) , mode } )
299- archive . file ( path . join ( lockFileDirName , 'package.json' ) , { name : 'package.json' , mode } )
304+ const packageJsonFile = path . join ( lockFileDirName , 'package.json' )
305+ archive . file ( lockFile , {
306+ ...entryDefaults ,
307+ name : Session . relativePosixPath ( lockFile ) ,
308+ } )
309+ archive . file ( packageJsonFile , {
310+ ...entryDefaults ,
311+ name : Session . relativePosixPath ( packageJsonFile ) ,
312+ } )
300313 // handle workspaces
301- archive . glob ( '**/package.json' , { cwd : path . join ( dir , '/' ) , ignore : ignoredFiles } , { mode } )
314+ archive . glob ( '**/package.json' , {
315+ cwd : dir ,
316+ ignore : ignoredFiles ,
317+ } , {
318+ ...entryDefaults ,
319+ prefix,
320+ } )
302321 for ( const includePattern of include ) {
303- archive . glob ( includePattern , { cwd : path . join ( dir , '/' ) } , { mode } )
322+ archive . glob ( includePattern , { cwd : dir } , {
323+ ...entryDefaults ,
324+ prefix,
325+ } )
304326 }
305327 for ( const filePath of extraFiles ) {
306- archive . file ( path . resolve ( dir , filePath ) , { name : filePath , mode } )
328+ archive . file ( path . resolve ( root , filePath ) , {
329+ ...entryDefaults ,
330+ name : Session . relativePosixPath ( filePath ) ,
331+ } )
307332 }
308333}
309334
0 commit comments