Fix --debug-print-doc (#2400)
* Add test of --debug-print-doc See https://github.com/prettier/prettier/issues/2396 * Pass test of --debug-print-doc See https://github.com/prettier/prettier/issues/2396master
parent
8fcd667200
commit
16bc297572
|
@ -154,7 +154,7 @@ const options = {
|
|||
function format(input, opt) {
|
||||
if (argv["debug-print-doc"]) {
|
||||
const doc = prettier.__debug.printToDoc(input, opt);
|
||||
return prettier.__debug.formatDoc(doc);
|
||||
return { formatted: prettier.__debug.formatDoc(doc) };
|
||||
}
|
||||
|
||||
if (argv["debug-check"]) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const runPrettier = require("../runPrettier");
|
||||
|
||||
test("prints doc with --debug-print-doc", () => {
|
||||
const result = runPrettier("cli/with-shebang", ["--debug-print-doc"], {
|
||||
input: "0"
|
||||
});
|
||||
|
||||
expect(result.stdout).toEqual('["0", ";", hardline, breakParent];\n');
|
||||
expect(result.stderr).toEqual("");
|
||||
expect(result.status).toEqual(0);
|
||||
});
|
Loading…
Reference in New Issue