nowledge-mem: the layout test gives a slow Chrome launch 90 s under CI (#1076)
A layout test whose Chrome launch is slow under CI's full suite gets a 90 s launch bound when CI is set (25 s locally), and the test's own timeout follows the bound plus 10 s for cleanup. Fixes #1071.
Reviewed at df016967. Run (WSL, Bun 1.4.2, CI=1): bun test packages/nowledge-mem 161 pass, 2 skip (no Chrome on that box, so the layout test itself skipped); the author ran a fake Chrome that answers at 26 s, red at 25 s on d24fd5d and green with CI=1. Not tried: a real Chrome on ubuntu CI, which this PR's merge run is.
Co-authored-by: yetihan <yetihan@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,10 @@ import { runInNewContext } from "node:vm"
|
||||
|
||||
const chrome = process.platform === "linux" &&
|
||||
(Bun.which("google-chrome") || Bun.which("google-chrome-stable") || Bun.which("chromium") || Bun.which("chromium-browser"))
|
||||
const LAUNCH_BOUND = 25000
|
||||
const CI_LAUNCH_BOUND = 90000
|
||||
const LAUNCH_BOUND = process.env.CI ? CI_LAUNCH_BOUND : 25000
|
||||
// Leave room for the launch bound plus process cleanup and stderr collection.
|
||||
const TEST_TIMEOUT = LAUNCH_BOUND + 10000
|
||||
|
||||
test.skipIf(!chrome)("narrow settings footer keeps translated actions inside the dialog", async () => {
|
||||
const read = (name) => Bun.file(new URL(`./page/${name}`, import.meta.url)).text()
|
||||
@@ -51,8 +54,10 @@ test.skipIf(!chrome)("narrow settings footer keeps translated actions inside the
|
||||
})
|
||||
// The results are read as soon as Chrome prints them, and Chrome is then
|
||||
// stopped: the test needs the dumped DOM, not Chrome's own exit (#972).
|
||||
// A launch that prints nothing by the bound is stopped too, and the test
|
||||
// fails with what Chrome wrote to stderr instead of a bare timeout.
|
||||
// Local launches stay tightly bounded. CI's full test suite can slow
|
||||
// Chrome startup without affecting layout assertions, so it gets a larger
|
||||
// bound; a launch that still prints nothing by it is stopped and fails
|
||||
// with what Chrome wrote to stderr instead of a bare timeout.
|
||||
const err = new Response(proc.stderr).text()
|
||||
const found = /<pre id="results">([^<]+)<\/pre>/
|
||||
let out = ""
|
||||
@@ -83,4 +88,4 @@ test.skipIf(!chrome)("narrow settings footer keeps translated actions inside the
|
||||
} finally {
|
||||
await rm(temp, { recursive: true, force: true })
|
||||
}
|
||||
}, 30000)
|
||||
}, TEST_TIMEOUT)
|
||||
|
||||
Reference in New Issue
Block a user