Skip to content

Commit 23b07d1

Browse files
authored
Improve server startup readiness checks and navigation retries
1 parent 185b2c9 commit 23b07d1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/lib/plugins/run-code-blocks/directives/screenshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function compile(steps: string, path: `${string}.png`, args: Args): string {
5858
let script = [
5959
`const puppeteer = require('puppeteer');
6060
const NAVIGATION_TIMEOUT = 180000;
61-
const MAX_NAVIGATION_RETRIES = 8;
61+
const MAX_NAVIGATION_RETRIES = 6;
6262
const RETRYABLE_NAVIGATION_ERRORS = [
6363
'Navigation timeout',
6464
'net::ERR_CONNECTION_REFUSED',

src/lib/plugins/run-code-blocks/directives/server/start.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ interface Args {
2121
captureOutput?: boolean;
2222
}
2323

24-
function extractURL(expect: Option<string>): Option<string> {
24+
function extractURL(expect: Option<string> | undefined): Option<string> {
2525
if (!expect) {
2626
return null;
2727
}
2828

2929
let match = expect.match(/https?:\/\/[^\s"']+/);
3030

3131
if (match) {
32-
return match[0]!;
32+
try {
33+
return new URL(match[0]!).toString();
34+
} catch {
35+
return null;
36+
}
3337
} else {
3438
return null;
3539
}

0 commit comments

Comments
 (0)