Skip to content
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
17 changes: 15 additions & 2 deletions napi/oxlint2/test/__snapshots__/e2e.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`cli options for bundling > should lint a directory 1`] = `
exports[`cli options for bundling > should lint a directory with errors 1`] = `
"
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
,-[index.js:1:1]
1 | debugger;
: ^^^^^^^^^
\`----
help: Remove the debugger statement

Found 0 warnings and 1 error.
Finished in Xms on 1 file using X threads."
`;

exports[`cli options for bundling > should lint a directory without errors 1`] = `
"Found 0 warnings and 0 errors.
Finished in Xms on 0 files with 1 rules using X threads."
Finished in Xms on 1 file using X threads."
`;

exports[`cli options for bundling > should load a custom plugin 1`] = `
Expand Down
11 changes: 9 additions & 2 deletions napi/oxlint2/test/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ function normalizeOutput(output: string): string {
}

describe('cli options for bundling', () => {
it('should lint a directory', async () => {
const { stdout, exitCode } = await runOxlint('test/fixtures/basic');
it('should lint a directory without errors', async () => {
const { stdout, exitCode } = await runOxlint('test/fixtures/built_in_no_errors');

expect(exitCode).toBe(0);
expect(normalizeOutput(stdout)).toMatchSnapshot();
});

it('should lint a directory with errors', async () => {
const { stdout, exitCode } = await runOxlint('test/fixtures/built_in_errors');

expect(exitCode).toBe(1);
expect(normalizeOutput(stdout)).toMatchSnapshot();
});

it('should load a custom plugin', async () => {
const { stdout, exitCode } = await runOxlint(
'test/fixtures/basic_custom_plugin',
Expand Down
1 change: 1 addition & 0 deletions napi/oxlint2/test/fixtures/built_in_errors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debugger;
4 changes: 4 additions & 0 deletions napi/oxlint2/test/fixtures/built_in_no_errors/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"categories": { "correctness": "off" },
"rules": { "no-debugger": "error" }
}
1 change: 1 addition & 0 deletions napi/oxlint2/test/fixtures/built_in_no_errors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let x;
Loading