Skip to content

Commit b9a2d62

Browse files
authored
fix: archiver import (#1176)
1 parent c8a3c7b commit b9a2d62

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/cli/src/services/util.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,18 @@ export async function bundlePlayWrightProject (
210210
const output = fsSync.createWriteStream(outputFile)
211211

212212
// Dynamic import for CommonJs so it doesn't break when using checkly/playwright-reporter archiver
213-
const { default: archiver } = await import('archiver')
214-
const archive = archiver('tar', {
215-
gzip: true,
216-
gzipOptions: {
217-
level: 9,
218-
},
219-
})
213+
// The custom Checkly fork of archiver exports TarArchive class instead of a default function
214+
const archiverModule: any = await import('archiver')
215+
let archive: Archiver
216+
if (archiverModule.TarArchive) {
217+
// Using Checkly's custom fork which exports TarArchive class
218+
archive = new archiverModule.TarArchive({ gzip: true, gzipOptions: { level: 9 } })
219+
} else if (archiverModule.default) {
220+
// Using standard archiver which has a default factory function
221+
archive = archiverModule.default('tar', { gzip: true, gzipOptions: { level: 9 } })
222+
} else {
223+
throw new Error('Unable to initialize archiver: neither TarArchive nor default export found')
224+
}
220225
archive.pipe(output)
221226

222227
const pwConfigParsed = new PlaywrightConfig(filePath, pwtConfig)

0 commit comments

Comments
 (0)