2018-02-27 14:20:02 +01:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
|
|
|
|
|
|
|
|
|
describe("plugin default options should work", () => {
|
|
|
|
|
runPrettier(
|
|
|
|
|
"plugins/defaultOptions",
|
2020-01-14 18:54:26 +08:00
|
|
|
[
|
|
|
|
|
"--stdin-filepath",
|
|
|
|
|
"example.foo",
|
|
|
|
|
"--plugin=./plugin",
|
|
|
|
|
"--no-editorconfig"
|
|
|
|
|
],
|
2018-02-27 14:20:02 +01:00
|
|
|
{ input: "hello-world" }
|
|
|
|
|
).test({
|
2019-09-12 08:52:48 -07:00
|
|
|
stdout: JSON.stringify({
|
|
|
|
|
tabWidth: 8,
|
|
|
|
|
bracketSpacing: false
|
|
|
|
|
}),
|
2018-02-27 14:20:02 +01:00
|
|
|
stderr: "",
|
|
|
|
|
status: 0,
|
|
|
|
|
write: []
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("overriding plugin default options should work", () => {
|
|
|
|
|
runPrettier(
|
|
|
|
|
"plugins/defaultOptions",
|
|
|
|
|
["--stdin-filepath", "example.foo", "--plugin=./plugin", "--tab-width=4"],
|
|
|
|
|
{ input: "hello-world" }
|
|
|
|
|
).test({
|
2019-09-12 08:52:48 -07:00
|
|
|
stdout: JSON.stringify({
|
|
|
|
|
tabWidth: 4,
|
|
|
|
|
bracketSpacing: false
|
|
|
|
|
}),
|
2018-02-27 14:20:02 +01:00
|
|
|
stderr: "",
|
|
|
|
|
status: 0,
|
|
|
|
|
write: []
|
|
|
|
|
});
|
|
|
|
|
});
|