|
| 1 | +import { runCli } from "../utils"; |
| 2 | + |
| 3 | +describe("ignores files when executing in a subdirectory", () => { |
| 4 | + runCli("ignore-in-subdirectories/web1", [ |
| 5 | + "ignore-me/should-ignore.js", |
| 6 | + "--ignore-path", |
| 7 | + "../.prettierignore", |
| 8 | + "-l", |
| 9 | + ]).test({ |
| 10 | + status: 0, |
| 11 | + }); |
| 12 | + |
| 13 | + runCli("ignore-in-subdirectories/web1", [ |
| 14 | + "ignore-me/subdirectory/should-ignore.js", |
| 15 | + "--ignore-path", |
| 16 | + "../.prettierignore", |
| 17 | + "-l", |
| 18 | + ]).test({ |
| 19 | + status: 0, |
| 20 | + }); |
| 21 | +}); |
| 22 | + |
| 23 | +describe("formats files when executing in a subdirectory", () => { |
| 24 | + runCli("ignore-in-subdirectories/web1", [ |
| 25 | + "should-not-ignore.js", |
| 26 | + "--ignore-path", |
| 27 | + "../.prettierignore", |
| 28 | + "-l", |
| 29 | + ]).test({ |
| 30 | + status: 1, |
| 31 | + }); |
| 32 | + |
| 33 | + runCli("ignore-in-subdirectories/web2", [ |
| 34 | + "should-not-ignore.js", |
| 35 | + "--ignore-path", |
| 36 | + "../.prettierignore", |
| 37 | + "-l", |
| 38 | + ]).test({ |
| 39 | + status: 1, |
| 40 | + }); |
| 41 | +}); |
| 42 | + |
| 43 | +describe("ignore files when executing in a subdirectory and using stdin", () => { |
| 44 | + runCli( |
| 45 | + "ignore-in-subdirectories/web1", |
| 46 | + [ |
| 47 | + "--ignore-path", |
| 48 | + "../.prettierignore", |
| 49 | + "--stdin-filepath", |
| 50 | + "ignore-me/example.js", |
| 51 | + ], |
| 52 | + { |
| 53 | + input: "hello_world( );", |
| 54 | + }, |
| 55 | + ).test({ |
| 56 | + stdout: "hello_world();", |
| 57 | + status: 0, |
| 58 | + }); |
| 59 | +}); |
| 60 | + |
| 61 | +describe("formats files when executing in a subdirectory and using stdin", () => { |
| 62 | + runCli( |
| 63 | + "ignore-in-subdirectories/web1", |
| 64 | + ["--ignore-path", "../.prettierignore", "--stdin-filepath", "example.js"], |
| 65 | + { |
| 66 | + input: "hello_world( );", |
| 67 | + }, |
| 68 | + ).test({ |
| 69 | + stdout: "hello_world();", |
| 70 | + status: 0, |
| 71 | + }); |
| 72 | +}); |
0 commit comments