Skip to content
Closed
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
8 changes: 5 additions & 3 deletions packages/rsc/e2e/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ export function useFixture(options: {
let cleanup: (() => Promise<void>) | undefined;
let baseURL!: string;

const cwd = path.resolve(options.root);

test.beforeAll(async () => {
if (options.mode === "dev") {
const proc = runCli({
command: options.command ?? `pnpm dev`,
label: `${options.root}:dev`,
cwd: options.root,
cwd,
});
const port = await proc.findPort();
// TODO: use `test.extend` to set `baseURL`?
Expand All @@ -81,14 +83,14 @@ export function useFixture(options: {
const proc = runCli({
command: options.buildCommand ?? `pnpm build`,
label: `${options.root}:build`,
cwd: options.root,
cwd,
});
await proc.done;
}
const proc = runCli({
command: options.command ?? `pnpm preview`,
label: `${options.root}:preview`,
cwd: options.root,
cwd,
});
const port = await proc.findPort();
baseURL = `http://localhost:${port}`;
Expand Down
Loading