Files
test-repo/tests_integration/__tests__/plugin-options.js
T
Ika 84c603623d feat: support external options (#3775)
* refactor: wrap

* refactor: replace

* refactor: replace

* refactor: replace

* refactor: extract

* refactor: logger

* refactor

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* feat(support): add `showInternal` option

* refactor: use internal

* refactor

* refactor: extract

* refactor: extract

* refactor

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: reorder

* refactor: remove unnecessary

* refactor: reorder

* refactor: move

* refactor

* refactor

* refactor

* refactor: remove unnecessary

* feat: external options from CLI

* refactor: push/pop plugins

* feat: external options from config file

* refactor: remove unnecessary

* refactor

* refactor

* refactor

* fix: use `json-stable-stringify`

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: move

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: move

* refactor: extract

* docs: add comments

* refactor: sort

* refactor: sort

* refactor: rename

* refactor: remove unnecessary

* style: remove trailing whitespace
2018-01-28 00:24:25 +08:00

56 lines
1.2 KiB
JavaScript

"use strict";
const runPrettier = require("../runPrettier");
const snapshotDiff = require("snapshot-diff");
describe("show external options with `--help`", () => {
const originalStdout = runPrettier("plugins/options", ["--help"]).stdout;
const pluggedStdout = runPrettier("plugins/options", [
"--help",
"--plugin=./plugin"
]).stdout;
expect(snapshotDiff(originalStdout, pluggedStdout)).toMatchSnapshot();
});
describe("show detailed external option with `--help foo-option`", () => {
runPrettier("plugins/options", [
"--plugin=./plugin",
"--help",
"foo-option"
]).test({
status: 0
});
});
describe("external options from CLI should work", () => {
runPrettier(
"plugins/options",
[
"--plugin=./plugin",
"--stdin-filepath",
"example.foo",
"--foo-option",
"baz"
],
{ input: "hello-world" }
).test({
stdout: "foo:baz",
stderr: "",
status: 0,
write: []
});
});
describe("external options from config file should work", () => {
runPrettier(
"plugins/options",
["--config=./config.json", "--stdin-filepath", "example.foo"],
{ input: "hello-world" }
).test({
stdout: "foo:baz",
stderr: "",
status: 0,
write: []
});
});