From 3242550f5f0b33769a4e0a24a7dc96773647ca75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 24 Sep 2024 14:54:48 +0100 Subject: fix(fmt): --check was broken for CSS, YAML and HTML (#25848) `deno fmt --check` was broken for CSS, YAML and HTML files. Before this PR, formatting any of these file types would return a string, even though the contract in `cli/tools/fmt.rs` is to only return a string if the formatting changed. This causes wrong flagging of these files as being badly formatted even though diffs showed nothing (because they were in fact formatted properly). Closes https://github.com/denoland/deno/issues/25840 --- tests/specs/fmt/html/__test__.jsonc | 12 ++++++++++-- tests/specs/fmt/html/well_formatted.html | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/specs/fmt/html/well_formatted.html (limited to 'tests/specs/fmt/html') diff --git a/tests/specs/fmt/html/__test__.jsonc b/tests/specs/fmt/html/__test__.jsonc index cec29d1b3..7f3169423 100644 --- a/tests/specs/fmt/html/__test__.jsonc +++ b/tests/specs/fmt/html/__test__.jsonc @@ -1,5 +1,13 @@ { "tempDir": true, - "args": "fmt --unstable-html", - "output": "[WILDLINE]badly_formatted.html\nChecked 1 file\n" + "tests": { + "badly_formatted": { + "args": "fmt badly_formatted.html", + "output": "[WILDLINE]badly_formatted.html\nChecked 1 file\n" + }, + "well_formatted": { + "args": "fmt --check well_formatted.html", + "output": "Checked 1 file\n" + } + } } diff --git a/tests/specs/fmt/html/well_formatted.html b/tests/specs/fmt/html/well_formatted.html new file mode 100644 index 000000000..c0c06cd9b --- /dev/null +++ b/tests/specs/fmt/html/well_formatted.html @@ -0,0 +1,11 @@ +
content
+ + + + -- cgit v1.2.3