Skip to content

Commit

Permalink
feat(tasks/prettier): Show total match ratio with updating snapshot f…
Browse files Browse the repository at this point in the history
…ormat (#8788)

Previously, #8634 visualized each spec result, but this was not enough.

If the implementation has been updated but the spec still fails, there
is no way to know if there is an improvement or not.

This time, finally, all progress is visualized! 🤩 


![image](https://github.com/user-attachments/assets/df5b4658-450a-4b0c-8348-ffc9b977c50c)

e.g. here `arrow_function_expression` is mostly passing, except for
comment handling.
  • Loading branch information
leaysgur authored Jan 30, 2025
1 parent 55c2025 commit b3a5769
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 1,253 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions tasks/common/src/diff.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use console::Style;
use similar::{ChangeTag, TextDiff};

pub fn print_diff_in_terminal(expected: &str, actual: &str) {
let diff = TextDiff::from_lines(expected, actual);
use similar::{ChangeTag, DiffableStr, TextDiff};

pub fn print_diff_in_terminal<T>(diff: &TextDiff<T>)
where
T: DiffableStr + ?Sized,
{
for op in diff.ops() {
for change in diff.iter_changes(op) {
let (sign, style) = match change.tag() {
Expand Down
1 change: 1 addition & 0 deletions tasks/prettier_conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ oxc_tasks_common = { workspace = true }
cow-utils = { workspace = true }
pico-args = { workspace = true }
rustc-hash = { workspace = true }
similar = { workspace = true }
walkdir = { workspace = true }
Loading

0 comments on commit b3a5769

Please sign in to comment.