-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
with-parser-inference.js
48 lines (40 loc) · 1.25 KB
/
with-parser-inference.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
const prettier = require("prettier-local");
const runPrettier = require("../runPrettier.js");
describe("infers postcss parser", () => {
runPrettier("cli/with-parser-inference", ["--end-of-line", "lf", "*"]).test({
status: 0,
});
});
describe("infers postcss parser with --check", () => {
runPrettier("cli/with-parser-inference", ["--check", "*"]).test({
status: 0,
});
});
describe("infers postcss parser with --list-different", () => {
runPrettier("cli/with-parser-inference", ["--list-different", "*"]).test({
status: 0,
});
});
describe("infers parser from filename", () => {
test("json from .prettierrc", () => {
expect(
prettier.format(" { } ", { filepath: "x/y/.prettierrc" })
).toEqual("{}\n");
});
test("json from .stylelintrc", () => {
expect(
prettier.format(" { } ", { filepath: "x/y/.stylelintrc" })
).toEqual("{}\n");
});
test("yaml from .stylelintrc", () => {
expect(
prettier.format(" extends: '' ", { filepath: "x/y/.stylelintrc" })
).toEqual('extends: ""\n');
});
test("babel from Jakefile", () => {
expect(
prettier.format("let foo = ( x = 1 ) => x", { filepath: "x/y/Jakefile" })
).toEqual("let foo = (x = 1) => x;\n");
});
});