Add CLI flag for debugging comment attachment issues (#10124)

This commit is contained in:
Georgii Dolzhykov authored and GitHub committed 2021-01-27 12:30:10 +02:00
1 parent 63a771db55
commit 79d2f4a295
14 files changed
+169 -18

No files matched your search

@@ -0,0 +1,51 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`prints information for debugging comment attachment with --debug-print-comments (stdout) 1`] = `
"[
{
\\"type\\": \\"CommentBlock\\",
\\"value\\": \\" 1 \\",
\\"start\\": 0,
\\"end\\": 7,
\\"loc\\": {
\\"start\\": { \\"line\\": 1, \\"column\\": 0 },
\\"end\\": { \\"line\\": 1, \\"column\\": 7 }
},
\\"placement\\": \\"endOfLine\\",
\\"leading\\": true,
\\"trailing\\": false,
\\"nodeDescription\\": \\"ExpressionStatement\\"
},
{
\\"type\\": \\"CommentBlock\\",
\\"value\\": \\" 2 \\",
\\"start\\": 24,
\\"end\\": 31,
\\"loc\\": {
\\"start\\": { \\"line\\": 2, \\"column\\": 16 },
\\"end\\": { \\"line\\": 2, \\"column\\": 23 }
},
\\"placement\\": \\"remaining\\",
\\"leading\\": false,
\\"trailing\\": true,
\\"nodeDescription\\": \\"Identifier foo\\"
},
{
\\"type\\": \\"CommentLine\\",
\\"value\\": \\" 3\\",
\\"start\\": 34,
\\"end\\": 38,
\\"loc\\": {
\\"start\\": { \\"line\\": 2, \\"column\\": 26 },
\\"end\\": { \\"line\\": 2, \\"column\\": 30 }
},
\\"placement\\": \\"remaining\\",
\\"leading\\": false,
\\"trailing\\": true,
\\"nodeDescription\\": \\"ExpressionStatement\\"
}
]
"
`;
exports[`prints information for debugging comment attachment with --debug-print-comments (write) 1`] = `Array []`;
@@ -0,0 +1,14 @@
"use strict";
const runPrettier = require("../runPrettier");
describe("prints information for debugging comment attachment with --debug-print-comments", () => {
runPrettier(
"cli/with-shebang",
["--debug-print-comments", "--parser", "babel"],
{ input: "/* 1 */\nconsole.log(foo /* 2 */); // 3" }
).test({
stderr: "",
status: 0,
});
});