diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index d79c139ffacfd..b607e67119df1 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -971,13 +971,11 @@ mod test { #[test] fn test_overrides() { - let args_1 = - &["-c", "fixtures/cli/overrides/.oxlintrc.json", "fixtures/cli/overrides/test.js"]; - let args_2 = - &["-c", "fixtures/cli/overrides/.oxlintrc.json", "fixtures/cli/overrides/test.ts"]; - let args_3 = - &["-c", "fixtures/cli/overrides/.oxlintrc.json", "fixtures/cli/overrides/other.jsx"]; - Tester::new().test_and_snapshot_multiple(&[args_1, args_2, args_3]); + // This is split into three to avoid creating a snapshot with a filename too large to be usable on Windows. + let tester = Tester::new().with_cwd("fixtures/cli/overrides".into()); + tester.test_and_snapshot(&["-c", ".oxlintrc.json", "test.js"]); + tester.test_and_snapshot(&["-c", ".oxlintrc.json", "test.ts"]); + tester.test_and_snapshot(&["-c", ".oxlintrc.json", "other.jsx"]); } #[test] diff --git a/apps/oxlint/src/snapshots/_-c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.js -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.ts -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__other.jsx@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.js -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.ts -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__other.jsx@oxlint.snap deleted file mode 100644 index 0a358116c2f21..0000000000000 --- a/apps/oxlint/src/snapshots/_-c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.js -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__test.ts -c fixtures__cli__overrides__.oxlintrc.json fixtures__cli__overrides__other.jsx@oxlint.snap +++ /dev/null @@ -1,67 +0,0 @@ ---- -source: apps/oxlint/src/tester.rs ---- -########## -arguments: -c fixtures/cli/overrides/.oxlintrc.json fixtures/cli/overrides/test.js -working directory: ----------- - - x eslint(no-var): Unexpected var, use let or const instead. - ,-[fixtures/cli/overrides/test.js:1:1] - 1 | var msg = "hello"; - : ^^^ - 2 | console.log(msg); - `---- - help: Replace var with let or const - -Found 0 warnings and 1 error. -Finished in ms on 1 file with 95 rules using 1 threads. ----------- -CLI result: LintFoundErrors ----------- - -########## -arguments: -c fixtures/cli/overrides/.oxlintrc.json fixtures/cli/overrides/test.ts -working directory: ----------- - - x eslint(no-var): Unexpected var, use let or const instead. - ,-[fixtures/cli/overrides/test.ts:1:1] - 1 | var msg = "hello"; - : ^^^ - 2 | console.log(msg); - `---- - help: Replace var with let or const - - ! eslint(no-console): Unexpected console statement. - ,-[fixtures/cli/overrides/test.ts:2:1] - 1 | var msg = "hello"; - 2 | console.log(msg); - : ^^^^^^^^^^^ - `---- - help: Delete this console statement. - -Found 1 warning and 1 error. -Finished in ms on 1 file with 95 rules using 1 threads. ----------- -CLI result: LintFoundErrors ----------- - -########## -arguments: -c fixtures/cli/overrides/.oxlintrc.json fixtures/cli/overrides/other.jsx -working directory: ----------- - - x eslint(no-var): Unexpected var, use let or const instead. - ,-[fixtures/cli/overrides/other.jsx:1:1] - 1 | var msg = "hello"; - : ^^^ - 2 | console.log(msg); - `---- - help: Replace var with let or const - -Found 0 warnings and 1 error. -Finished in ms on 1 file with 95 rules using 1 threads. ----------- -CLI result: LintFoundErrors ----------- diff --git a/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json other.jsx@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json other.jsx@oxlint.snap new file mode 100644 index 0000000000000..8319e2aa47c81 --- /dev/null +++ b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json other.jsx@oxlint.snap @@ -0,0 +1,21 @@ +--- +source: apps/oxlint/src/tester.rs +--- +########## +arguments: -c .oxlintrc.json other.jsx +working directory: fixtures/cli/overrides +---------- + + x eslint(no-var): Unexpected var, use let or const instead. + ,-[other.jsx:1:1] + 1 | var msg = "hello"; + : ^^^ + 2 | console.log(msg); + `---- + help: Replace var with let or const + +Found 0 warnings and 1 error. +Finished in ms on 1 file with 95 rules using 1 threads. +---------- +CLI result: LintFoundErrors +---------- diff --git a/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.js@oxlint.snap new file mode 100644 index 0000000000000..b0ee5d0870baf --- /dev/null +++ b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.js@oxlint.snap @@ -0,0 +1,21 @@ +--- +source: apps/oxlint/src/tester.rs +--- +########## +arguments: -c .oxlintrc.json test.js +working directory: fixtures/cli/overrides +---------- + + x eslint(no-var): Unexpected var, use let or const instead. + ,-[test.js:1:1] + 1 | var msg = "hello"; + : ^^^ + 2 | console.log(msg); + `---- + help: Replace var with let or const + +Found 0 warnings and 1 error. +Finished in ms on 1 file with 95 rules using 1 threads. +---------- +CLI result: LintFoundErrors +---------- diff --git a/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.ts@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.ts@oxlint.snap new file mode 100644 index 0000000000000..385373beeda40 --- /dev/null +++ b/apps/oxlint/src/snapshots/fixtures__cli__overrides_-c .oxlintrc.json test.ts@oxlint.snap @@ -0,0 +1,29 @@ +--- +source: apps/oxlint/src/tester.rs +--- +########## +arguments: -c .oxlintrc.json test.ts +working directory: fixtures/cli/overrides +---------- + + x eslint(no-var): Unexpected var, use let or const instead. + ,-[test.ts:1:1] + 1 | var msg = "hello"; + : ^^^ + 2 | console.log(msg); + `---- + help: Replace var with let or const + + ! eslint(no-console): Unexpected console statement. + ,-[test.ts:2:1] + 1 | var msg = "hello"; + 2 | console.log(msg); + : ^^^^^^^^^^^ + `---- + help: Delete this console statement. + +Found 1 warning and 1 error. +Finished in ms on 1 file with 95 rules using 1 threads. +---------- +CLI result: LintFoundErrors +----------