Skip to content

Commit

Permalink
feat(task/prettier-confromance): escape template literal (oxc-project…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing authored Nov 22, 2023
1 parent c8cc814 commit aa8656d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions tasks/prettier_conformance/prettier.snap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Compatibility: 131/597 (21.94%)
Compatibility: 133/597 (22.28%)

# Failed

Expand Down Expand Up @@ -318,7 +318,6 @@ Compatibility: 131/597 (21.94%)
* export/same-local-and-exported.js

### export-default
* export-default/binary_and_template.js
* export-default/body.js
* export-default/class_instance.js
* export-default/function_in_template.js
Expand Down Expand Up @@ -600,7 +599,6 @@ Compatibility: 131/597 (21.94%)
* switch/switch.js

### template
* template/arrow.js
* template/call.js
* template/comment.js
* template/faulty-locations.js
Expand Down
5 changes: 3 additions & 2 deletions tasks/prettier_conformance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ impl TestRunner {
if snapshot_line.is_empty() { String::new() } else { title_snapshot_options }
);

let output = Self::prettier(path, input, prettier_options);
let output = Self::prettier(path, input, prettier_options).replace('`', "\\`");
let input = input.replace('`', "\\`");
let snapshot_options = snapshot_options
.iter()
.map(|(k, v)| format!("{k}: {v}"))
Expand All @@ -251,7 +252,7 @@ impl TestRunner {
println!("{input}");
println!("Output:");
println!("{output}");
let expected = Self::get_expect(snap_content, input).unwrap_or_default();
let expected = Self::get_expect(snap_content, input.as_str()).unwrap_or_default();
println!("Diff:");
println!("{}", Self::get_diff(&output, &expected));
}
Expand Down

0 comments on commit aa8656d

Please sign in to comment.