Skip to content

Commit aa994de

Browse files
committed
wip
1 parent 40e37c9 commit aa994de

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

integration/helpers/stream.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ export async function match(
77
/** Measured in ms */
88
timeout?: number;
99
} = {},
10-
): Promise<string> {
10+
): Promise<RegExpMatchArray> {
1111
// Prepare error outside of promise so that stacktrace points to caller of `matchLine`
12-
const timeout = new Error(`Timed out - Could not find pattern: ${pattern}`);
13-
return new Promise<string>(async (resolve, reject) => {
14-
setTimeout(() => reject(timeout), options.timeout ?? 10_000);
12+
const timeoutError = new Error(
13+
`Timed out - Could not find pattern: ${pattern}`,
14+
);
15+
return new Promise(async (resolve, reject) => {
16+
const timeout = setTimeout(
17+
() => reject(timeoutError),
18+
options.timeout ?? 10_000,
19+
);
1520
stream.on("data", (data) => {
1621
const line: string = data.toString();
1722
const matches = line.match(pattern);
1823
if (matches) {
19-
resolve(matches[0]);
24+
resolve(matches);
25+
clearTimeout(timeout);
2026
}
2127
});
2228
});

integration/vite-hmr-hdr-test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { expect } from "@playwright/test";
33
import getPort from "get-port";
44
import dedent from "dedent";
55

6+
import * as Express from "./helpers/express";
67
import { test } from "./helpers/fixtures";
78
import * as Stream from "./helpers/stream";
89
import { viteMajorTemplates, getTemplates } from "./helpers/templates";
9-
import * as Express from "./helpers/express";
1010

1111
const tsx = dedent;
1212
const mdx = dedent;
@@ -71,6 +71,7 @@ templates.forEach((template) => {
7171

7272
const port = await getPort();
7373
const url = `http://localhost:${port}`;
74+
7475
const server = $("node server.mjs", {
7576
env: {
7677
PORT: String(port),

0 commit comments

Comments
 (0)