-
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(linter): use snapshot testing instead of LintResult
- Loading branch information
Showing
49 changed files
with
869 additions
and
228 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --ignore-path fixtures/issue_7566/.oxlintignore fixtures/issue_7566/tests/main.js fixtures/issue_7566/tests/function/main.js | ||
working directory: | ||
---------- |
17 changes: 17 additions & 0 deletions
17
...ore-path fixtures__linter__.customignore --no-ignore [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --ignore-path fixtures/linter/.customignore --no-ignore fixtures/linter/nan.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to isNaN() when checking for NaN | ||
,-[fixtures/linter/nan.js:1:8] | ||
1 | 123 == NaN; | ||
: ^^^ | ||
`---- | ||
help: Use the isNaN function to compare with NaN. | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
7 changes: 7 additions & 0 deletions
7
...shots/_--ignore-path fixtures__linter__.customignore [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --ignore-path fixtures/linter/.customignore fixtures/linter/nan.js | ||
working directory: | ||
---------- |
9 changes: 9 additions & 0 deletions
9
...pshots/_--ignore-pattern **__*.js --ignore-pattern **__*.vue [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --ignore-pattern **/*.js --ignore-pattern **/*.vue fixtures/linter | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 0 files with 97 rules using 1 threads. |
9 changes: 9 additions & 0 deletions
9
apps/oxlint/src/snapshots/_--import-plugin -A all -D no-cycle [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --import-plugin -A all -D no-cycle fixtures/flow/ | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 2 files with 99 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --import-plugin fixtures/flow/index.mjs | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 99 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --vitest-plugin -c fixtures/eslintrc_vitest_replace/eslintrc.json fixtures/eslintrc_vitest_replace/foo.test.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/expect-expect.html\eslint-plugin-jest(expect-expect)]8;;\: Test has no assertions | ||
,-[fixtures/eslintrc_vitest_replace/foo.test.js:1:1] | ||
1 | test.skip('foo', () => { | ||
: ^^^^^^^^^ | ||
2 | // ... | ||
`---- | ||
help: Add assertion(s) in this Test | ||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/no-disabled-tests.html\eslint-plugin-jest(no-disabled-tests)]8;;\: Disabled test | ||
,-[fixtures/eslintrc_vitest_replace/foo.test.js:1:1] | ||
1 | test.skip('foo', () => { | ||
: ^^^^^^^^^ | ||
2 | // ... | ||
`---- | ||
help: Remove the appending `.skip` | ||
Found 1 warning and 1 error. | ||
Finished in <variable>ms on 1 file with 109 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -A all fixtures/linter | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 3 files with 0 rules using 1 threads. |
17 changes: 17 additions & 0 deletions
17
apps/oxlint/src/snapshots/_-D correctness [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -D correctness fixtures/linter/debugger.js | ||
working directory: | ||
---------- | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
,-[fixtures/linter/debugger.js:1:1] | ||
1 | debugger; | ||
: ^^^^^^^^^ | ||
`---- | ||
help: Delete this code. | ||
Found 0 warnings and 1 error. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
9 changes: 9 additions & 0 deletions
9
...nt/src/snapshots/_-W correctness -A no-debugger [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -W correctness -A no-debugger fixtures/linter/debugger.js | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 96 rules using 1 threads. |
16 changes: 16 additions & 0 deletions
16
... fixtures__eslintrc_env__eslintrc_no_env.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -W no-undef -c fixtures/eslintrc_env/eslintrc_no_env.json fixtures/eslintrc_env/test.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undef.html\eslint(no-undef)]8;;\: 'console' is not defined. | ||
,-[fixtures/eslintrc_env/test.js:1:1] | ||
1 | console.log('') | ||
: ^^^^^^^ | ||
`---- | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 98 rules using 1 threads. |
16 changes: 16 additions & 0 deletions
16
..._-W no-undef -c fixtures__no_undef__eslintrc.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -W no-undef -c fixtures/no_undef/eslintrc.json fixtures/no_undef/test.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undef.html\eslint(no-undef)]8;;\: 'console' is not defined. | ||
,-[fixtures/no_undef/test.js:1:1] | ||
1 | console.log(foo) | ||
: ^^^^^^^ | ||
`---- | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 98 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/config_ignore_patterns/ignore_extension/eslintrc.json fixtures/config_ignore_patterns/ignore_extension | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-empty-file.html\eslint-plugin-unicorn(no-empty-file)]8;;\: Empty files are not allowed. | ||
,-[fixtures/config_ignore_patterns/ignore_extension/main.ts:1:1] | ||
`---- | ||
help: Delete this file or add some code to it. | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
9 changes: 9 additions & 0 deletions
9
...ures__eslintrc_env__eslintrc_env_browser.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/eslintrc_env/eslintrc_env_browser.json fixtures/eslintrc_env/test.js | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 98 rules using 1 threads. |
15 changes: 15 additions & 0 deletions
15
...ots/_-c fixtures__eslintrc_off__eslintrc.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/eslintrc_off/eslintrc.json fixtures/eslintrc_off/test.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-empty-file.html\eslint-plugin-unicorn(no-empty-file)]8;;\: Empty files are not allowed. | ||
,-[fixtures/eslintrc_off/test.js:1:1] | ||
`---- | ||
help: Delete this file or add some code to it. | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/eslintrc_vitest_replace/eslintrc.json fixtures/eslintrc_vitest_replace/foo.test.js | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
18 changes: 18 additions & 0 deletions
18
.../src/snapshots/_-c fixtures__import__.oxlintrc.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/import/.oxlintrc.json fixtures/import/test.js | ||
working directory: | ||
---------- | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-default-export.html\eslint-plugin-import(no-default-export)]8;;\: Prefer named exports | ||
,-[fixtures/import/test.js:7:8] | ||
6 | // import/no-default-export | ||
7 | export default function foo() {} | ||
: ^^^^^^^ | ||
8 | | ||
`---- | ||
Found 0 warnings and 1 error. | ||
Finished in <variable>ms on 1 file with 50 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/jest_and_vitest_alias_rules/oxlint-jest.json fixtures/jest_and_vitest_alias_rules/test.js | ||
working directory: | ||
---------- | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/no-identical-title.html\eslint-plugin-jest(no-identical-title)]8;;\: Test title is used multiple times in the same describe block. | ||
,-[fixtures/jest_and_vitest_alias_rules/test.js:3:6] | ||
2 | it("works", () => {}); | ||
3 | it("works", () => {}); | ||
: ^^^^^^^ | ||
4 | }); | ||
`---- | ||
help: Change the title of test. | ||
Found 0 warnings and 1 error. | ||
Finished in <variable>ms on 1 file with 1 rules using 1 threads. | ||
########## | ||
arguments: -c fixtures/jest_and_vitest_alias_rules/oxlint-vitest.json fixtures/jest_and_vitest_alias_rules/test.js | ||
working directory: | ||
---------- | ||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/no-identical-title.html\eslint-plugin-jest(no-identical-title)]8;;\: Test title is used multiple times in the same describe block. | ||
,-[fixtures/jest_and_vitest_alias_rules/test.js:3:6] | ||
2 | it("works", () => {}); | ||
3 | it("works", () => {}); | ||
: ^^^^^^^ | ||
4 | }); | ||
`---- | ||
help: Change the title of test. | ||
Found 0 warnings and 1 error. | ||
Finished in <variable>ms on 1 file with 1 rules using 1 threads. |
17 changes: 17 additions & 0 deletions
17
...c/snapshots/_-c fixtures__linter__eslintrc.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/linter/eslintrc.json fixtures/linter/debugger.js | ||
working directory: | ||
---------- | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
,-[fixtures/linter/debugger.js:1:1] | ||
1 | debugger; | ||
: ^^^^^^^^^ | ||
`---- | ||
help: Delete this code. | ||
Found 0 warnings and 1 error. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
9 changes: 9 additions & 0 deletions
9
..._-c fixtures__no_console_off__eslintrc.json [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/no_console_off/eslintrc.json fixtures/no_console_off/test.js | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 97 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/no_empty_allow_empty_catch/eslintrc.json -W no-empty fixtures/no_empty_allow_empty_catch/test.js | ||
working directory: | ||
---------- | ||
Found 0 warnings and 0 errors. | ||
Finished in <variable>ms on 1 file with 98 rules using 1 threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: -c fixtures/no_empty_disallow_empty_catch/eslintrc.json -W no-empty fixtures/no_empty_disallow_empty_catch/test.js | ||
working directory: | ||
---------- | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty.html\eslint(no-empty)]8;;\: Unexpected empty block statements | ||
,-[fixtures/no_empty_disallow_empty_catch/test.js:1:29] | ||
1 | try { console.log() } catch {} | ||
: ^^ | ||
`---- | ||
help: Remove this block or add a comment inside it | ||
Found 1 warning and 0 errors. | ||
Finished in <variable>ms on 1 file with 98 rules using 1 threads. |
Oops, something went wrong.