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 end of line for testcase
  • Loading branch information
axetroy committed Apr 11, 2019
commit 868b5f320525b93c5ca88cd3f2f512901af92400
7 changes: 4 additions & 3 deletions prettier/main_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { join } from "../fs/path.ts";
import { EOL } from "../fs/path/constants.ts";
import { assertEquals } from "../testing/asserts.ts";
import { test } from "../testing/mod.ts";
import { xrun } from "./util.ts";
Expand Down Expand Up @@ -217,13 +218,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)\r\n");
assertEquals(await getSourceCode(file0), "console.log (0)" + EOL);
// the output will be formatted code
assertEquals(stdout, "console.log(0);\r\n");
assertEquals(stdout, "console.log(0);" + EOL);

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

Expand Down