Skip to content

Commit

Permalink
chore: update some tests that relies on rollup's behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Nov 29, 2024
1 parent 68e6581 commit 4753f60
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion playground/worker/__tests__/es/worker-es.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
4 changes: 2 additions & 2 deletions playground/worker/__tests__/iife/worker-iife.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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"`,
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down

0 comments on commit 4753f60

Please sign in to comment.