From d88a411c4fc193f442a24e689a5822e41d81fc58 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Mon, 9 Dec 2024 17:49:22 +0900 Subject: [PATCH] test: test shared chunk --- playground/rolldown-dev-mpa/__tests__/basic.spec.ts | 3 ++- playground/rolldown-dev-mpa/src/about/index.js | 3 +++ playground/rolldown-dev-mpa/src/index.js | 3 +++ playground/rolldown-dev-mpa/src/shared.js | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 playground/rolldown-dev-mpa/src/shared.js diff --git a/playground/rolldown-dev-mpa/__tests__/basic.spec.ts b/playground/rolldown-dev-mpa/__tests__/basic.spec.ts index 68b0e1f2f0363a..2e2ab98c141e15 100644 --- a/playground/rolldown-dev-mpa/__tests__/basic.spec.ts +++ b/playground/rolldown-dev-mpa/__tests__/basic.spec.ts @@ -5,8 +5,9 @@ test('basic', async () => { await page.goto('/') await page.getByRole('heading', { name: 'Home' }).click() await page.getByText('Rendered by /index.js').click() + await page.getByText('shared [ok]').click() await page.getByRole('link', { name: 'About' }).click() await page.waitForURL('/about') await page.getByRole('heading', { name: 'About' }).click() - await page.getByText('Rendered by /about/index.js').click() + await page.getByText('shared [ok]').click() }) diff --git a/playground/rolldown-dev-mpa/src/about/index.js b/playground/rolldown-dev-mpa/src/about/index.js index 2ed4b10fa69e81..84863e60802935 100644 --- a/playground/rolldown-dev-mpa/src/about/index.js +++ b/playground/rolldown-dev-mpa/src/about/index.js @@ -1,3 +1,6 @@ +import shared from '../shared' + document.getElementById('root').innerHTML = `

Rendered by /about/index.js: ${Math.random().toString(36).slice(2)}

+
shared: ${shared}
` diff --git a/playground/rolldown-dev-mpa/src/index.js b/playground/rolldown-dev-mpa/src/index.js index a80b0213257e3a..250f54a1f9c8d7 100644 --- a/playground/rolldown-dev-mpa/src/index.js +++ b/playground/rolldown-dev-mpa/src/index.js @@ -1,3 +1,6 @@ +import shared from './shared' + document.getElementById('root').innerHTML = `

Rendered by /index.js: ${Math.random().toString(36).slice(2)}

+
shared: ${shared}
` diff --git a/playground/rolldown-dev-mpa/src/shared.js b/playground/rolldown-dev-mpa/src/shared.js new file mode 100644 index 00000000000000..ca3fb00232166e --- /dev/null +++ b/playground/rolldown-dev-mpa/src/shared.js @@ -0,0 +1 @@ +export default '[ok]'