Skip to content

Commit

Permalink
C3: Improve readability of framework e2e tests (#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
jculvey authored Aug 24, 2023
1 parent bced8b3 commit c053403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/create-cloudflare/e2e-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ export type RunnerConfig = {
};
promptHandlers?: PromptHandler[];
argv?: string[];
outputPrefix?: string;
};

export const runC3 = async ({
argv = [],
promptHandlers = [],
outputPrefix = "",
}: RunnerConfig) => {
const proc = spawn("node", ["./dist/cli.js", ...argv]);
const stdout: string[] = [];
Expand All @@ -47,7 +49,7 @@ export const runC3 = async ({
lines.forEach((line) => {
// Uncomment to debug test output
if (filterLine(line)) {
console.log(line);
console.log(`${outputPrefix} ${line}`);
}
stdout.push(line);

Expand Down
6 changes: 5 additions & 1 deletion packages/create-cloudflare/e2e-tests/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ describe(`E2E: Web frameworks`, () => {

args.push(...argv);

const { output } = await runC3({ argv: args, promptHandlers });
const { output } = await runC3({
argv: args,
promptHandlers,
outputPrefix: `[${framework}]`,
});

// Relevant project files should have been created
expect(projectPath).toExist();
Expand Down

0 comments on commit c053403

Please sign in to comment.