Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import path from 'node:path'
import { expect, test } from 'vitest'
import { getRolldownDevRuntimeFiles } from '../../plugins/clientInjections'

// The runtime entry imports its helper file with a relative path. Catch a rolldown layout
// change here, instead of as a 404 in the browser.
// Catch a rolldown layout change here, instead of as a 404 in the browser. The runtime may
// be one file with no imports, or an entry that imports helper files with relative paths.
test('serves every file the rolldown dev runtime imports', () => {
const files = getRolldownDevRuntimeFiles()
let checked = 0
expect(files.get('@rolldown/experimental-runtime.mjs')).toContain(
'DevRuntime',
)
for (const [urlPath, source] of files) {
for (const match of source.matchAll(/\bfrom\s*['"](\.\.?\/[^'"]+)['"]/g)) {
const imported = path.posix.join(path.posix.dirname(urlPath), match[1])
expect(files.has(imported), `${urlPath} imports ${match[1]}`).toBe(true)
checked++
}
}
expect(checked).toBeGreaterThan(0)
})
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (isBuild) {
expect(await client.text()).toContain(`from "${runtimeUrl.pathname}"`)
const runtime = await page.request.get(runtimeUrl.href)
expect(runtime.status()).toBe(200)
expect(await runtime.text()).toContain('class DevRuntime')
expect(await runtime.text()).toContain('DevRuntime')
const loaded: string[] = await page.evaluate(() =>
performance.getEntriesByType('resource').map((entry) => entry.name),
)
Expand Down
Loading