From 4753f6095a350472b712856e6c75098652ae8ad6 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:12:35 +0900 Subject: [PATCH] chore: update some tests that relies on rollup's behavior --- playground/worker/__tests__/es/worker-es.spec.ts | 2 +- playground/worker/__tests__/iife/worker-iife.spec.ts | 4 ++-- .../__tests__/relative-base/worker-relative-base.spec.ts | 2 +- .../sourcemap-hidden/worker-sourcemap-hidden.spec.ts | 2 +- .../sourcemap-inline/worker-sourcemap-inline.spec.ts | 2 +- .../worker/__tests__/sourcemap/worker-sourcemap.spec.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/playground/worker/__tests__/es/worker-es.spec.ts b/playground/worker/__tests__/es/worker-es.spec.ts index a04d64b0be3364..659a838eaeddae 100644 --- a/playground/worker/__tests__/es/worker-es.spec.ts +++ b/playground/worker/__tests__/es/worker-es.spec.ts @@ -105,7 +105,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(/import[^.]/) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk expect(content).toMatch(`new Worker("/es/assets`) expect(content).toMatch(`new SharedWorker("/es/assets`) diff --git a/playground/worker/__tests__/iife/worker-iife.spec.ts b/playground/worker/__tests__/iife/worker-iife.spec.ts index 856cb2aea43aa4..eb5c5a02cce6e1 100644 --- a/playground/worker/__tests__/iife/worker-iife.spec.ts +++ b/playground/worker/__tests__/iife/worker-iife.spec.ts @@ -92,7 +92,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk expect(content).toMatch(`new Worker("/iife/assets`) expect(content).toMatch(`new SharedWorker("/iife/assets`) @@ -191,7 +191,7 @@ test.runIf(isServe)('sourcemap is correct after env is injected', async () => { const content = await (await response).text() const { mappings } = decodeSourceMapUrl(content) expect(mappings).toMatchInlineSnapshot( - `";;AAAA,SAAS,OAAO,kBAAkB,8BAA8B;AAChE,SAAS,MAAM,WAAW,2BAA2B;AACrD,SAAS,wBAAwB,uBAAuB;AACxD,OAAO,aAAa,YAAY;AAChC,MAAM,UAAU,OAAO,KAAK;AAE5B,KAAK,YAAY,CAAC,MAAM;AACtB,KAAI,EAAE,SAAS,QAAQ;AACrB,OAAK,YAAY;GAAE;GAAK;GAAM;GAAkB;GAAS;GAAS;EAAM,EAAC;CAC1E;AACD,KAAI,EAAE,SAAS,gBAAgB;AAC7B,OAAK,YAAY;GACf,KAAK;GACL;GACA;GACA;GACA;GACA;EACD,EAAC;CACH;AACF;AACD,KAAK,YAAY;CACf;CACA;CACA;CACA;CACA;CACA;CACA;AACD,EAAC;AAGF,QAAQ,IAAI,eAAe"`, + `";;AAAA,SAAS,OAAO,kBAAkB,8BAA8B;AAChE,OAAO,YAAY,6BAA6B;AAChD,SAAS,MAAM,WAAW,2BAA2B;AACrD,SAAS,wBAAwB,uBAAuB;AACxD,OAAO,aAAa,YAAY;AAChC,MAAM,UAAU,OAAO,KAAK;AAE5B,KAAK,YAAY,CAAC,MAAM;AACtB,KAAI,EAAE,SAAS,QAAQ;AACrB,OAAK,YAAY;GACf;GACA;GACA;GACA;GACA;GACA;GACA;EACD,EAAC;CACH;AACD,KAAI,EAAE,SAAS,gBAAgB;AAC7B,OAAK,YAAY;GACf,KAAK;GACL;GACA;GACA;GACA;GACA;GACA;EACD,EAAC;CACH;AACF;AACD,KAAK,YAAY;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,EAAC;AAGF,QAAQ,IAAI,eAAe"`, ) }) diff --git a/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts b/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts index 5ff924c8d9f76a..6121f331937275 100644 --- a/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts +++ b/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts @@ -76,7 +76,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(/import(?!\.)/) // accept import.meta.url - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk expect(content).toMatch(`new Worker(""+new URL("../worker-entries/`) expect(content).toMatch(`new SharedWorker(""+new URL("../worker-entries/`) diff --git a/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts b/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts index 1f407ee24cd5a3..568ca547b8185b 100644 --- a/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts +++ b/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts @@ -84,7 +84,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports expect(sharedWorkerContent).not.toMatch(`import`) diff --git a/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts b/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts index 8e6e040cfded04..fd0da04b89f249 100644 --- a/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts +++ b/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts @@ -65,7 +65,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports expect(sharedWorkerContent).not.toMatch(`import`) diff --git a/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts b/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts index 3bff04a5c8d79a..d13ffd85ce9ed8 100644 --- a/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts +++ b/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts @@ -87,7 +87,7 @@ describe.runIf(isBuild)('build', () => { // worker should have all imports resolved and no exports expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports expect(sharedWorkerContent).not.toMatch(`import`)