diff --git a/packages/ui/client/composables/client/static.ts b/packages/ui/client/composables/client/static.ts index fb839d0fdba5..24156a30507b 100644 --- a/packages/ui/client/composables/client/static.ts +++ b/packages/ui/client/composables/client/static.ts @@ -98,18 +98,9 @@ export function createStaticClient(): VitestClient { async function registerMetadata() { const res = await fetch(window.METADATA_PATH!) - const contentType = res.headers.get('content-type')?.toLowerCase() || '' - if ( - contentType.includes('application/gzip') - || contentType.includes('application/x-gzip') - ) { - const compressed = new Uint8Array(await res.arrayBuffer()) - const decompressed = strFromU8(decompressSync(compressed)) - metadata = parse(decompressed) as HTMLReportMetadata - } - else { - metadata = parse(await res.text()) as HTMLReportMetadata - } + const compressed = new Uint8Array(await res.arrayBuffer()) + const decompressed = strFromU8(decompressSync(compressed)) + metadata = parse(decompressed) as HTMLReportMetadata const event = new Event('open') ctx.ws.dispatchEvent(event) } diff --git a/packages/ui/node/reporter.ts b/packages/ui/node/reporter.ts index dbc9275db3d7..5b6c74bd71fa 100644 --- a/packages/ui/node/reporter.ts +++ b/packages/ui/node/reporter.ts @@ -162,7 +162,7 @@ export default class HTMLReporter implements Reporter { } async writeReport(report: string): Promise { - const metaFile = resolve(this.reporterDir, 'html.meta.json.gz') + const metaFile = resolve(this.reporterDir, 'html.meta.bin') const promiseGzip = promisify(gzip) const data = await promiseGzip(report, { diff --git a/packages/ui/vite.config.ts b/packages/ui/vite.config.ts index 3cc665d84922..0b15da850462 100644 --- a/packages/ui/vite.config.ts +++ b/packages/ui/vite.config.ts @@ -60,7 +60,7 @@ export default defineConfig({ // name: 'debug-html-report', // apply: 'serve', // transformIndexHtml(html) { - // return html.replace('', ``) + // return html.replace('', ``) // }, // }, diff --git a/test/reporters/tests/html.test.ts b/test/reporters/tests/html.test.ts index 86ae382d417d..cc4417808361 100644 --- a/test/reporters/tests/html.test.ts +++ b/test/reporters/tests/html.test.ts @@ -25,7 +25,7 @@ describe('html reporter', async () => { expect(stderr).toBe('') - const metaJsonGzipped = fs.readFileSync(resolve(root, `${basePath}/html.meta.json.gz`)) + const metaJsonGzipped = fs.readFileSync(resolve(root, `${basePath}/html.meta.bin`)) const metaJson = zlib.gunzipSync(metaJsonGzipped).toString('utf-8') const indexHtml = fs.readFileSync(resolve(root, `${basePath}/index.html`), { encoding: 'utf-8' }) const resultJson = parse(metaJson.replace(new RegExp(vitestRoot, 'g'), '')) @@ -50,7 +50,7 @@ describe('html reporter', async () => { expect(task.result.logs).not.toBeDefined() expect(resultJson).toMatchSnapshot(`tests are passing`) - expect(indexHtml).toMatch('window.METADATA_PATH="html.meta.json.gz"') + expect(indexHtml).toMatch('window.METADATA_PATH="html.meta.bin"') }, 120000) it('resolves to "failing" status for test file "json-fail"', async () => { @@ -68,7 +68,7 @@ describe('html reporter', async () => { expect(stderr).toBe('') - const metaJsonGzipped = fs.readFileSync(resolve(root, `${basePath}/html.meta.json.gz`)) + const metaJsonGzipped = fs.readFileSync(resolve(root, `${basePath}/html.meta.bin`)) const metaJson = zlib.gunzipSync(metaJsonGzipped).toString('utf-8') const indexHtml = fs.readFileSync(resolve(root, `${basePath}/index.html`), { encoding: 'utf-8' }) const resultJson = parse(metaJson.replace(new RegExp(vitestRoot, 'g'), '')) @@ -97,7 +97,7 @@ describe('html reporter', async () => { task.logs[0].time = 0 expect(resultJson).toMatchSnapshot(`tests are failing`) - expect(indexHtml).toMatch('window.METADATA_PATH="html.meta.json.gz"') + expect(indexHtml).toMatch('window.METADATA_PATH="html.meta.bin"') }, 120000) })