oxc/crates
Maurice Nicholson 9bbdec146f
Use oxc's own graphical reporter for test snapshots (#2241)
Fixes #2217

Previously we were using the miette default, but given ours is a fork,
and for example now prints slightly more relevant line- and
column-numbers vs miette, we should dog-food our own have the tests tell
us if/when the output changes.

I did actually scan all the snapshot deltas and all look correct to me.

One funny one I noticed was this

```diff
diff --git a/crates/oxc_linter/src/snapshots/no_empty_file.snap b/crates/oxc_linter/src/snapshots/no_empty_file.snap
index cfc53e1c..6f001fbd 100644
--- a/crates/oxc_linter/src/snapshots/no_empty_file.snap
+++ b/crates/oxc_linter/src/snapshots/no_empty_file.snap
@@ -2,6 +2,7 @@
 source: crates/oxc_linter/src/tester.rs
 expression: no_empty_file
 ---
+
   ⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
    ╭─[no_empty_file.tsx:1:1]
    ╰────
@@ -29,7 +30,7 @@ expression: no_empty_file
   help: Delete this file or add some code to it.
 
   ⚠ eslint-plugin-unicorn(no-empty-file): Empty files are not allowed.
-   ╭─[no_empty_file.tsx:1:1]
+   ╭─[no_empty_file.tsx:0:1]
  0 │ 
    · ▲
    ╰────
@@ -149,4 +150,3 @@ expression: no_empty_file
    ╰────
   help: Delete this file or add some code to it.
 
-
```

...which I suppose is technically correct but also a bit confusing
perhaps? Should we make the line **minimum 1**? If so I can create
another PR for that.

There is a subtle change in whitespace too - each file gains a newline
at the start but looses one at the end. My assumption is that oxc's
reporter is adding a newline at the start of each report (compared to
miette's), plus I removed the extra newline in `tester.rs` or else the
snapshot diffs would have been even larger.

Finally there are no changes to reports with *multi-line* annotations
like this:

```
  ⚠ typescript-eslint(ban-types): Prefer explicitly define the object shape
   ╭─[ban_types.tsx:1:1]
 1 │ ╭─▶ const emptyObj: {
 2 │ │   
 3 │ ╰─▶         } = {foo: "bar"};
   ╰────
  help: This type means "any non-nullish value", which is slightly better than 'unknown', but it's still a broad type
```

Again I can create a separate PR to improve those and we should see
snapshot diffs when I make that change 😄

I'd appreciate a quick review on this one if at all possible, given the
high chance of conflict.
2024-02-01 11:24:00 +08:00
..
oxc feat(ast): TypeScript definition for wasm target (#2158) 2024-01-30 15:43:03 +08:00
oxc_allocator docs(allocator): document behaviour of Box 2024-01-29 21:34:45 +08:00
oxc_ast refactor(semantic): adding binder for ImportSpecifier replaces the ModuleDeclaration's binder (#2230) 2024-01-31 11:57:08 +08:00
oxc_cli feat(cli): add --version (#2182) 2024-01-26 19:13:17 +08:00
oxc_codegen feat(codegen): change back to read raw (#2222) 2024-01-31 12:17:52 +08:00
oxc_diagnostics Better source line and column numbers (#2213) 2024-01-30 12:26:16 +08:00
oxc_index Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_js_regex Initialize JS Regex crates and def AST. (#1500) 2023-11-23 00:22:17 +08:00
oxc_language_server chore(deps): update cargo (#2191) 2024-01-29 11:38:47 +08:00
oxc_linter Use oxc's own graphical reporter for test snapshots (#2241) 2024-02-01 11:24:00 +08:00
oxc_macros feat(linter): remove the --timings feature (#2049) 2024-01-16 14:21:04 +08:00
oxc_minifier feat(codegen): move string test to codegen (#2150) 2024-01-23 23:49:36 +08:00
oxc_parser refactor(lexer): don't use lexer.current.chars directly (#2237) 2024-01-31 21:35:46 +08:00
oxc_prettier fix(codegen): print Directive original string (#2157) 2024-01-25 15:24:05 +08:00
oxc_semantic refactor(semantic): adding binder for ImportSpecifier replaces the ModuleDeclaration's binder (#2230) 2024-01-31 11:57:08 +08:00
oxc_span feat(ast): TypeScript definition for wasm target (#2158) 2024-01-30 15:43:03 +08:00
oxc_syntax feat(ast): remove serde skip for symbol_id and reference_id (#2220) 2024-01-30 21:03:05 +08:00
oxc_transformer feat(transformer/decorators): support static member (#2235) 2024-01-31 19:11:27 +08:00
oxc_wasm feat(ast): remove serde skip for symbol_id and reference_id (#2220) 2024-01-30 21:03:05 +08:00