Skip to content

Commit

Permalink
Addressing PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jculvey committed Jul 20, 2023
1 parent b7f4160 commit 890e51f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
7 changes: 2 additions & 5 deletions packages/create-cloudflare/e2e-tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import { version } from "../package.json";
import { keys, runC3 } from "./helpers";

describe("E2E: Basic C3 functionality", () => {
let tmpDirPath: string;
let projectPath: string;
const tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "c3-tests")));
const projectPath = join(tmpDirPath, "basic-tests");

beforeEach(() => {
tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "c3-tests")));

projectPath = join(tmpDirPath, "basic-tests");
rmSync(projectPath, { recursive: true, force: true });
});

Expand Down
8 changes: 4 additions & 4 deletions packages/create-cloudflare/e2e-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const runC3 = async ({
promptHandlers = [],
}: RunnerConfig) => {
const proc = spawn("node", ["./dist/cli.js", ...argv]);
const output: string[] = [];
const stdout: string[] = [];
const stderr: string[] = [];

await new Promise((resolve, rejects) => {
Expand All @@ -34,7 +34,7 @@ export const runC3 = async ({
const currentDialog = promptHandlers[0];

lines.forEach((line) => {
output.push(line);
stdout.push(line);

if (currentDialog && currentDialog.matcher.test(line)) {
currentDialog.input.forEach((keystroke) => {
Expand Down Expand Up @@ -71,7 +71,7 @@ export const runC3 = async ({
});

return {
output: output.join("\n").trim(),
stderr: stderr.join("\n").trim(),
output: stdout.join("\n").trim(),
errors: stderr.join("\n").trim(),
};
};
7 changes: 2 additions & 5 deletions packages/create-cloudflare/e2e-tests/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ Areas for future improvement:
*/

describe("E2E: Web frameworks", () => {
let tmpDirPath: string;
let projectPath: string;
const tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "c3-tests")));
const projectPath = join(tmpDirPath, "pages-tests");

beforeEach(() => {
tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "c3-tests")));

projectPath = join(tmpDirPath, "pages-tests");
rmSync(projectPath, { recursive: true, force: true });
});

Expand Down
7 changes: 2 additions & 5 deletions packages/create-cloudflare/e2e-tests/workers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ Areas for future improvement:
*/

describe("E2E: Workers templates", () => {
let tmpDirPath: string;
let projectPath: string;
const tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "workers-tests")));
const projectPath = join(tmpDirPath, "pages-tests");

beforeEach(() => {
tmpDirPath = realpathSync(mkdtempSync(join(tmpdir(), "workers-tests")));

projectPath = join(tmpDirPath, "pages-tests");
rmSync(projectPath, { recursive: true, force: true });
});

Expand Down
2 changes: 1 addition & 1 deletion packages/create-cloudflare/src/helpers/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const runCommand = async (

let output = ``;

if (opts?.captureOutput ?? opts.silent) {
if (opts.captureOutput ?? opts.silent) {
cmd.stdout?.on("data", (data) => {
output += data;
});
Expand Down

0 comments on commit 890e51f

Please sign in to comment.