2017-09-03 16:31:33 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
|
|
|
|
2017-09-28 12:30:51 +03:00
|
|
|
expect.addSnapshotSerializer(require("../path-serializer"));
|
2017-09-03 16:31:33 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("throw error with invalid config format", () => {
|
|
|
|
runPrettier("cli/config/invalid", ["--config", "file/.prettierrc"]).test({
|
|
|
|
status: "non-zero"
|
|
|
|
});
|
2017-09-03 16:31:33 +03:00
|
|
|
});
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("throw error with invalid config target (directory)", () => {
|
|
|
|
runPrettier("cli/config/invalid", [
|
2017-09-03 16:31:33 +03:00
|
|
|
"--config",
|
|
|
|
"folder/.prettierrc" // this is a directory
|
2017-10-02 19:08:34 +03:00
|
|
|
]).test({
|
|
|
|
status: "non-zero"
|
|
|
|
});
|
2017-09-03 16:31:33 +03:00
|
|
|
});
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("throw error with invalid config option (int)", () => {
|
|
|
|
runPrettier("cli/config/invalid", ["--config", "option/int"]).test({
|
|
|
|
status: "non-zero"
|
|
|
|
});
|
2017-09-03 16:31:33 +03:00
|
|
|
});
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("throw error with invalid config option (trailingComma)", () => {
|
|
|
|
runPrettier("cli/config/invalid", ["--config", "option/trailingComma"]).test({
|
|
|
|
status: "non-zero"
|
|
|
|
});
|
2017-09-03 16:31:33 +03:00
|
|
|
});
|
2017-09-05 01:56:23 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("throw error with invalid config precedence option (configPrecedence)", () => {
|
|
|
|
runPrettier("cli/config/invalid", [
|
2017-09-05 01:56:23 +03:00
|
|
|
"--config-precedence",
|
|
|
|
"option/configPrecedence"
|
2017-10-02 19:08:34 +03:00
|
|
|
]).test({
|
|
|
|
status: "non-zero"
|
|
|
|
});
|
2017-09-05 01:56:23 +03:00
|
|
|
});
|
2017-09-28 20:59:32 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
describe("show warning with unknown option", () => {
|
|
|
|
runPrettier("cli/config/invalid", ["--config", "option/unknown"]).test({
|
|
|
|
status: 0
|
|
|
|
});
|
2017-09-28 20:59:32 +03:00
|
|
|
});
|
2018-01-18 10:26:27 +03:00
|
|
|
|
|
|
|
describe("show warning with kebab-case option key", () => {
|
|
|
|
runPrettier("cli/config/invalid", ["--config", "option/kebab-case"]).test({
|
|
|
|
status: 0
|
|
|
|
});
|
|
|
|
});
|