Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prettier): output to stdout instead of write file by default unless specified --write flag #332

Merged
merged 14 commits into from
May 21, 2019
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
axetroy committed Apr 10, 2019
commit e12182c648d0e1dfe8137b53551cc1be2eace96d
6 changes: 3 additions & 3 deletions prettier/main_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ test(async function testPrettierPrintToStdout() {

const { stdout } = await run([...cmd, file0]);
// the source file will not change without `--write` flags
assertEquals(await getSourceCode(file0), "console.log (0)\n");
assertEquals(await getSourceCode(file0), "console.log (0)\r\n");
// the output will be formatted code
assertEquals(stdout, "console.log(0);\n");
assertEquals(stdout, "console.log(0);\r\n");

const { stdout: formattedCode } = await run([...cmd, file1]);
// the source file will not change without `--write` flags
assertEquals(await getSourceCode(file1), "console.log(0);\n");
assertEquals(await getSourceCode(file1), "console.log(0);\r\n");
// the output will be empty string. because the formatted content is same with before
assertEquals(formattedCode, "");

Expand Down