Skip to content

Commit faf8cf4

Browse files
43081jfabiospampinato
authored andcommitted
Ported test suite: ignore-in-subdirectories
1 parent 0bc8996 commit faf8cf4

File tree

7 files changed

+107
-0
lines changed

7 files changed

+107
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web1/ignore-me
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var x = 'this should not be formatted';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var x = 'this should not be formatted';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var x = 'this should be formatted';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var x = 'this should be formatted';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`formats files when executing in a subdirectory (stderr) 1`] = `""`;
4+
5+
exports[`formats files when executing in a subdirectory (stderr) 2`] = `""`;
6+
7+
exports[`formats files when executing in a subdirectory (stdout) 1`] = `"should-not-ignore.js"`;
8+
9+
exports[`formats files when executing in a subdirectory (stdout) 2`] = `"should-not-ignore.js"`;
10+
11+
exports[`formats files when executing in a subdirectory (write) 1`] = `[]`;
12+
13+
exports[`formats files when executing in a subdirectory (write) 2`] = `[]`;
14+
15+
exports[`formats files when executing in a subdirectory and using stdin (stderr) 1`] = `""`;
16+
17+
exports[`formats files when executing in a subdirectory and using stdin (write) 1`] = `[]`;
18+
19+
exports[`ignore files when executing in a subdirectory and using stdin (stderr) 1`] = `""`;
20+
21+
exports[`ignore files when executing in a subdirectory and using stdin (write) 1`] = `[]`;
22+
23+
exports[`ignores files when executing in a subdirectory (stderr) 1`] = `""`;
24+
25+
exports[`ignores files when executing in a subdirectory (stderr) 2`] = `""`;
26+
27+
exports[`ignores files when executing in a subdirectory (stdout) 1`] = `""`;
28+
29+
exports[`ignores files when executing in a subdirectory (stdout) 2`] = `""`;
30+
31+
exports[`ignores files when executing in a subdirectory (write) 1`] = `[]`;
32+
33+
exports[`ignores files when executing in a subdirectory (write) 2`] = `[]`;
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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("ignore-in-subdirectories/web1", [
45+
"--ignore-path",
46+
"../.prettierignore",
47+
"--stdin-filepath",
48+
"ignore-me/example.js",
49+
], {
50+
input: "hello_world( );",
51+
}).test({
52+
stdout: "hello_world();",
53+
status: 0,
54+
});
55+
});
56+
57+
describe("formats files when executing in a subdirectory and using stdin", () => {
58+
runCli("ignore-in-subdirectories/web1", [
59+
"--ignore-path",
60+
"../.prettierignore",
61+
"--stdin-filepath",
62+
"example.js",
63+
], {
64+
input: "hello_world( );",
65+
}).test({
66+
stdout: "hello_world();",
67+
status: 0,
68+
});
69+
});

0 commit comments

Comments
 (0)