Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(oxlint): add CliRunResult to snapshot #8780

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
----------
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/_--print-config@oxlint.snap
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ working directory:
"globals": {},
"ignorePatterns": []
}
----------
CLI result: PrintConfigResult
----------
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
----------
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 --print-config@oxlint.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ working directory:
"globals": {},
"ignorePatterns": []
}
----------
CLI result: PrintConfigResult
----------
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
----------
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
----------
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
----------
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
----------
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 @@ -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
----------
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/_fixtures__linter@oxlint.snap
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
----------
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 @@ -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
----------
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
----------
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/_foo.asdf@oxlint.snap
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 @@ -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
----------
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
Loading