2017-09-03 21:31:33 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
|
|
|
|
|
2017-10-06 11:01:21 +02:00
|
|
|
describe("write file with --write + unformatted file", () => {
|
|
|
|
|
runPrettier("cli/write", ["--write", "unformatted.js"]).test({
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2017-10-02 11:08:34 -05:00
|
|
|
});
|
2017-09-03 21:31:33 +08:00
|
|
|
});
|
|
|
|
|
|
2020-07-27 10:10:01 +08:00
|
|
|
describe("write file with -w + unformatted file", () => {
|
|
|
|
|
runPrettier("cli/write", ["-w", "unformatted.js"]).test({
|
|
|
|
|
status: 0,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2017-10-06 11:01:21 +02:00
|
|
|
describe("do not write file with --write + formatted file", () => {
|
|
|
|
|
runPrettier("cli/write", ["--write", "formatted.js"]).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
write: [],
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2017-10-02 11:08:34 -05:00
|
|
|
});
|
2017-09-03 21:31:33 +08:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("do not write file with --write + invalid file", () => {
|
2017-10-02 12:56:34 -05:00
|
|
|
runPrettier("cli/write", ["--write", "invalid.js"]).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
write: [],
|
2020-03-21 22:07:52 +02:00
|
|
|
status: "non-zero",
|
2017-10-02 11:08:34 -05:00
|
|
|
});
|
2017-09-03 21:31:33 +08:00
|
|
|
});
|