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
11 changes: 10 additions & 1 deletion src/controller/tests/controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* ERR_INVALID_STATE on concurrent same-slot ops); the specs await sequentially.
* - Ephemeral storage is the default; each test gets a fresh view disposed via
* `await using`. Chrome is spawned once per Bun process; each view is a tab.
* - `beforeAll` warms the backend with one throwaway view (60s hook budget):
* the first view in a process pays cold Chrome startup, which can exceed a
* test's 20s budget on a cold CI runner — pay it once, outside any test.
*/
import { afterAll, beforeAll, describe, expect, test } from 'bun:test'
import { type FixtureServer, startServer } from './fixtures/serve.ts'
Expand Down Expand Up @@ -63,7 +66,13 @@ const getFixture = (): FixtureServer => {

beforeAll(async () => {
fixture = startServer(0)
})
// Warm the chrome backend: the first WebView in a process pays cold browser
// startup, which can exceed a test's 20s budget on a cold CI runner. Pay it
// here, outside any test budget, so every spec runs against a warm browser.
const view = new Bun.WebView({ backend: { type: 'chrome', url: false } })
await view.navigate(`http://localhost:${fixture.port}/health`)
view.close()
}, 60_000)

afterAll(async () => {
if (fixture) {
Expand Down
9 changes: 8 additions & 1 deletion src/controller/tests/transport-seam.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ const waitFor = async <T>(read: () => Promise<T | undefined>, timeoutMs = 8000):
beforeAll(async () => {
server = await startTransportServer(0)
port = server.port
})
// Warm the chrome backend: the first WebView in a process pays cold browser
// startup, which can exceed a test's 20s budget on a cold CI runner (the
// flaky `constructs and accepts` timeout). Pay it here, outside any test
// budget, so every spec runs against a warm browser.
const view = new Bun.WebView({ backend: { type: 'chrome', url: false } })
await view.navigate(`http://localhost:${port}/health`)
view.close()
}, 60_000)

afterAll(async () => {
if (server) {
Expand Down
Loading