2017-06-06 18:24:56 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
2018-05-27 14:36:12 +03:00
|
|
|
const prettier = require("prettier/local");
|
2017-06-06 18:24:56 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("infers postcss parser", () => {
|
2018-11-14 15:55:50 +03:00
|
|
|
runPrettier("cli/with-parser-inference", ["--end-of-line", "lf", "*"]).test({
|
2017-10-02 19:08:34 +03:00
|
|
|
status: 0
|
|
|
|
});
|
2017-06-06 18:24:56 +03:00
|
|
|
});
|
|
|
|
|
2018-12-19 17:03:30 +03:00
|
|
|
describe("infers postcss parser with --check", () => {
|
|
|
|
runPrettier("cli/with-parser-inference", ["--check", "*"]).test({
|
|
|
|
status: 0
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("infers postcss parser with --list-different", () => {
|
|
|
|
runPrettier("cli/with-parser-inference", ["--list-different", "*"]).test({
|
|
|
|
status: 0
|
|
|
|
});
|
2017-06-06 18:24:56 +03:00
|
|
|
});
|
2017-11-03 10:06:25 +03:00
|
|
|
|
|
|
|
describe("infers parser from filename", () => {
|
|
|
|
test("json from .prettierrc", () => {
|
|
|
|
expect(
|
|
|
|
prettier.format(" { } ", { filepath: "x/y/.prettierrc" })
|
|
|
|
).toEqual("{}\n");
|
|
|
|
});
|
|
|
|
|
2018-12-27 16:05:19 +03:00
|
|
|
test("babel from Jakefile", () => {
|
2017-11-03 10:06:25 +03:00
|
|
|
expect(
|
|
|
|
prettier.format("let foo = ( x = 1 ) => x", { filepath: "x/y/Jakefile" })
|
|
|
|
).toEqual("let foo = (x = 1) => x;\n");
|
|
|
|
});
|
|
|
|
});
|