48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
"use strict";
|
|
|
|
const runPrettier = require("../runPrettier");
|
|
|
|
expect.addSnapshotSerializer(require("../path-serializer"));
|
|
|
|
test("throw error with invalid config format", () => {
|
|
const output = runPrettier("cli/config/invalid", [
|
|
"--config",
|
|
"file/.prettierrc"
|
|
]);
|
|
expect(output.stderr).toMatchSnapshot();
|
|
expect(output.status).not.toBe(0);
|
|
});
|
|
|
|
test("throw error with invalid config target (directory)", () => {
|
|
const output = runPrettier("cli/config/invalid", [
|
|
"--config",
|
|
"folder/.prettierrc" // this is a directory
|
|
]);
|
|
expect(output.stderr).toMatchSnapshot();
|
|
expect(output.status).not.toBe(0);
|
|
});
|
|
|
|
test("throw error with invalid config option (int)", () => {
|
|
const output = runPrettier("cli/config/invalid", ["--config", "option/int"]);
|
|
expect(output.stderr).toMatchSnapshot();
|
|
expect(output.status).not.toBe(0);
|
|
});
|
|
|
|
test("throw error with invalid config option (trailingComma)", () => {
|
|
const output = runPrettier("cli/config/invalid", [
|
|
"--config",
|
|
"option/trailingComma"
|
|
]);
|
|
expect(output.stderr).toMatchSnapshot();
|
|
expect(output.status).not.toBe(0);
|
|
});
|
|
|
|
test("throw error with invalid config precedence option (configPrecedence)", () => {
|
|
const output = runPrettier("cli/config/invalid", [
|
|
"--config-precedence",
|
|
"option/configPrecedence"
|
|
]);
|
|
expect(output.stderr).toMatchSnapshot();
|
|
expect(output.status).not.toBe(0);
|
|
});
|