Skip to content

Commit

Permalink
test(oxlint): add CliRunResult to snapshot (#8780)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Jan 30, 2025
1 parent 9731c56 commit 55c2025
Show file tree
Hide file tree
Showing 48 changed files with 159 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ...es__issue_7566__tests__main.js [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ 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:
----------
----------
CLI result: LintNoFilesFound
----------
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ source: apps/oxlint/src/tester.rs
arguments: --ignore-path fixtures/linter/.customignore fixtures/linter/nan.js
working directory:
----------
----------
CLI result: LintNoFilesFound
----------
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 0 files with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 2 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/_--import-plugin [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ working directory:
"globals": {},
"ignorePatterns": []
}
----------
CLI result: PrintConfigResult
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/_--tsconfig [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ arguments: --tsconfig oxc/tsconfig.json
working directory:
----------
The tsconfig file "<cwd>/oxc/tsconfig.json" does not exist, Please provide a valid tsconfig file.
----------
CLI result: InvalidOptionTsConfig
----------
3 changes: 3 additions & 0 deletions ..._vitest_replace__eslintrc.json [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ working directory:
Found 1 warning and 1 error.
Finished in <variable>ms on 1 file with 109 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/_-A all [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ working directory:
"globals": {},
"ignorePatterns": []
}
----------
CLI result: PrintConfigResult
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/_-A all [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 3 files with 0 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/_-D correctness [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory:
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 96 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions ...e_extension__eslintrc.json [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions ..._vitest_replace__eslintrc.json [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ working directory:
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 50 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory:
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions ...atch__eslintrc.json -W no-empty [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions ...h__eslintrc.json -W no-empty [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ working directory:
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
##########
arguments: -c fixtures/overrides/.oxlintrc.json fixtures/overrides/test.ts
Expand All @@ -40,6 +43,9 @@ working directory:
Found 1 warning and 1 error.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
##########
arguments: -c fixtures/overrides/.oxlintrc.json fixtures/overrides/other.jsx
Expand All @@ -56,3 +62,6 @@ working directory:
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ working directory:

Found 2 warnings and 2 errors.
Finished in <variable>ms on 7 files with 96 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ working directory:
"globals": {},
"ignorePatterns": []
}
----------
CLI result: PrintConfigResult
----------
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ working directory:
Found 2 warnings and 0 errors.
Finished in <variable>ms on 1 file with 48 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ working directory:

Found 3 warnings and 0 errors.
Finished in <variable>ms on 1 file with 59 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ working directory:

Found 4 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ working directory:
Found 3 warnings and 0 errors.
Finished in <variable>ms on 3 files with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ working directory:

Found 2 warnings and 0 errors.
Finished in <variable>ms on 2 files with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ working directory:
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ working directory:

Found 2 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 0 files with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory: fixtures/auto_config_detection
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory: fixtures/config_ignore_patterns/ignore_directory
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ working directory: fixtures/eslint_and_typescript_alias_rules
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 1 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
##########
arguments: -c oxlint-typescript.json test.js
Expand All @@ -32,3 +35,6 @@ working directory: fixtures/eslint_and_typescript_alias_rules
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 1 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ working directory: fixtures/jest_and_vitest_alias_rules
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 1 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
##########
arguments: -c oxlint-vitest.json test.js
Expand All @@ -34,3 +37,6 @@ working directory: fixtures/jest_and_vitest_alias_rules
Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 1 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
3 changes: 3 additions & 0 deletions apps/oxlint/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ working directory: fixtures/linter
Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ arguments: --format=checkstyle test.js
working directory: fixtures/output_formatter_diagnostic
----------
<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file name="test.js"><error line="5" column="1" severity="error" message="`debugger` statement is not allowed" source="" /><error line="1" column="10" severity="warning" message="Function &apos;foo&apos; is declared but never used." source="" /><error line="1" column="17" severity="warning" message="Parameter &apos;b&apos; is declared but never used. Unused parameters should start with a &apos;_&apos;." source="" /></file></checkstyle>
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ working directory: fixtures/output_formatter_diagnostic
Found 2 warnings and 1 error.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ working directory: fixtures/output_formatter_diagnostic
::error file=test.js,line=5,endLine=5,col=1,endColumn=10,title=oxlint::`debugger` statement is not allowed
::warning file=test.js,line=1,endLine=1,col=10,endColumn=13,title=oxlint::Function 'foo' is declared but never used.
::warning file=test.js,line=1,endLine=1,col=17,endColumn=18,title=oxlint::Parameter 'b' is declared but never used. Unused parameters should start with a '_'.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ working directory: fixtures/output_formatter_diagnostic
{"message": "Function 'foo' is declared but never used.","code": "eslint(no-unused-vars)","severity": "warning","causes": [],"url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html","help": "Consider removing this declaration.","filename": "test.js","labels": [{"label": "'foo' is declared here","span": {"offset": 9,"length": 3}}],"related": []},
{"message": "Parameter 'b' is declared but never used. Unused parameters should start with a '_'.","code": "eslint(no-unused-vars)","severity": "warning","causes": [],"url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html","help": "Consider removing this parameter.","filename": "test.js","labels": [{"label": "'b' is declared here","span": {"offset": 16,"length": 1}}],"related": []}
]
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ working directory: fixtures/output_formatter_diagnostic
38:9 error `debugger` statement is not allowed eslint(no-debugger)

3 problems (1 error, 2 warnings)
----------
CLI result: LintFoundErrors
----------
7 changes: 6 additions & 1 deletion apps/oxlint/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ impl Tester {
format!("working directory: {}\n", relative_dir.to_str().unwrap()).as_bytes(),
);
output.extend_from_slice("----------\n".as_bytes());
let _ = LintRunner::new(options).with_cwd(self.cwd.clone()).run(&mut output);
let result = LintRunner::new(options).with_cwd(self.cwd.clone()).run(&mut output);

output.extend_from_slice("----------\n".as_bytes());
output.extend_from_slice(format!("CLI result: {result:?}\n").as_bytes());
output.extend_from_slice("----------\n".as_bytes());

output.push(b'\n');
}

Expand Down

0 comments on commit 55c2025

Please sign in to comment.