test: add ignore-path tests#25
Conversation
Adds the `ignore-path` tests from prettier. Also fixes a bug where non-existent ignore files should be treated as if we loaded an empty file (currently they throw).
| return await fs.readFile(filePath, "utf8"); | ||
| } catch { | ||
| // Treat a missing file as if it was empty (no ignores) | ||
| return ""; |
There was a problem hiding this comment.
im not a huge fan of creating these empty strings, but if we don't, ignoreManual will end up empty and we'll apply default gitignore etc
prettier doesn't do that, it treats a non-existent file as if it existed (i.e. it turns off the defaults)
There was a problem hiding this comment.
Arguably the behavior in v4 is better, like you point the CLI to something that doesn't exist and we should just silently fail? 🤔 Pretty weird, but ok we can align with that.
I'll change it to be a one-liner in an amending commit though, as that kinda breaks how the code flows visually, which I hate.
|
I see we deleted a test where |
|
Thanks! |
|
It looks like 2 out of 3 tests are not passing. If some tests are not skipped I'm assuming they were passing, were these passing on your end? Maybe I broke something. |
|
Ah wait I forgot to compile the thing again 🤣 all good! |
Adds the
ignore-pathtests from prettier.Also fixes a bug where non-existent ignore files should be treated as if we loaded an empty file (currently they throw).
Part of #19