2017-06-06 18:24:56 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
2017-11-03 10:06:25 +03:00
|
|
|
const prettier = require("../../tests_config/require_prettier");
|
2017-06-06 18:24:56 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("infers postcss parser", () => {
|
|
|
|
runPrettier("cli/with-parser-inference", ["*"]).test({
|
|
|
|
status: 0
|
|
|
|
});
|
2017-06-06 18:24:56 +03:00
|
|
|
});
|
|
|
|
|
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");
|
|
|
|
});
|
|
|
|
|
|
|
|
test("babylon from Jakefile", () => {
|
|
|
|
expect(
|
|
|
|
prettier.format("let foo = ( x = 1 ) => x", { filepath: "x/y/Jakefile" })
|
|
|
|
).toEqual("let foo = (x = 1) => x;\n");
|
|
|
|
});
|
|
|
|
});
|