mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
Fix prettier check in empty files (denoland/deno_std#302)
Original: e5a493e9e8
This commit is contained in:
parent
aae6ea51a4
commit
4347148d50
3 changed files with 7 additions and 3 deletions
|
@ -107,8 +107,8 @@ async function checkFile(
|
|||
const text = await readFileIfExists(filename);
|
||||
|
||||
if (!text) {
|
||||
// The file is deleted. Skip.
|
||||
return;
|
||||
// The file is empty. Skip.
|
||||
return true;
|
||||
}
|
||||
|
||||
const formatted = prettier.check(text, {
|
||||
|
|
|
@ -48,7 +48,11 @@ async function clearTestdataChanges(): Promise<void> {
|
|||
test(async function testPrettierCheckAndFormatFiles() {
|
||||
await clearTestdataChanges();
|
||||
|
||||
const files = [join(testdata, "0.ts"), join(testdata, "1.js")];
|
||||
const files = [
|
||||
join(testdata, "0.ts"),
|
||||
join(testdata, "1.js"),
|
||||
join(testdata, "2.ts")
|
||||
];
|
||||
|
||||
var { code, stdout } = await run([...cmd, "--check", ...files]);
|
||||
assertEquals(code, 1);
|
||||
|
|
0
prettier/testdata/2.ts
vendored
Normal file
0
prettier/testdata/2.ts
vendored
Normal file
Loading…
Reference in a new issue