diff --git a/src/printer.js b/src/printer.js index 753ba61..898cb9a 100644 --- a/src/printer.js +++ b/src/printer.js @@ -542,10 +542,16 @@ function printMisc(path, opts, print) { function printProlog(path, opts, print) { const { XMLDeclOpen, attribute, SPECIAL_CLOSE } = path.node; - const parts = [XMLDeclOpen]; + + // The XMLDeclOpen token includes the single whitespace character that follows + // " double", async () => { expect(formatted).toMatchSnapshot(); }); + +test("wrapped XML declaration is stable on reformat", async () => { + const input = '\n\n'; + const opts = { printWidth: 20 }; + + const once = await format(input, opts); + const twice = await format(once, opts); + + expect(twice).toEqual(once); +});