Skip to content

Commit c8e9c36

Browse files
authored
Ported test suite: ignore-in-subdirectories
1 parent 0bc8996 commit c8e9c36

File tree

7 files changed

+110
-0
lines changed

7 files changed

+110
-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`] = `[]`;
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

Comments
 (0)