forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arg-parsing.js
50 lines (42 loc) · 1.17 KB
/
arg-parsing.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use strict";
const runPrettier = require("../runPrettier");
describe("boolean flags do not swallow the next argument", () => {
runPrettier("cli/arg-parsing", ["--single-quote", "file.js"]).test({
status: 0
});
});
describe("negated options work", () => {
runPrettier("cli/arg-parsing", ["--no-semi", "file.js"]).test({
status: 0
});
});
describe("unknown options are warned", () => {
runPrettier("cli/arg-parsing", ["file.js", "--unknown"]).test({
status: 0
});
});
describe("unknown negated options are warned", () => {
runPrettier("cli/arg-parsing", ["file.js", "--no-unknown"]).test({
status: 0
});
});
describe("deprecated options are warned", () => {
runPrettier("cli/arg-parsing", ["file.js", "--flow-parser"]).test({
status: 0
});
});
describe("deprecated option values are warned", () => {
runPrettier("cli/arg-parsing", ["file.js", "--trailing-comma"]).test({
status: 0
});
});
describe("allow overriding flags", () => {
runPrettier(
"cli/arg-parsing",
["--tab-width=1", "--tab-width=3", "--parser=babylon"],
{ input: "function a() { b }" }
).test({
stdout: "function a() {\n b;\n}\n",
status: 0
});
});