diff --git a/napi/oxlint2/test/__snapshots__/e2e.test.ts.snap b/napi/oxlint2/test/__snapshots__/e2e.test.ts.snap index 93330779ddda6..c1fb796c01c97 100644 --- a/napi/oxlint2/test/__snapshots__/e2e.test.ts.snap +++ b/napi/oxlint2/test/__snapshots__/e2e.test.ts.snap @@ -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`] = ` diff --git a/napi/oxlint2/test/e2e.test.ts b/napi/oxlint2/test/e2e.test.ts index d4e71c84c0551..4e35cd5fb644d 100644 --- a/napi/oxlint2/test/e2e.test.ts +++ b/napi/oxlint2/test/e2e.test.ts @@ -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', diff --git a/napi/oxlint2/test/fixtures/basic/.oxlintrc.json b/napi/oxlint2/test/fixtures/built_in_errors/.oxlintrc.json similarity index 100% rename from napi/oxlint2/test/fixtures/basic/.oxlintrc.json rename to napi/oxlint2/test/fixtures/built_in_errors/.oxlintrc.json diff --git a/napi/oxlint2/test/fixtures/built_in_errors/index.js b/napi/oxlint2/test/fixtures/built_in_errors/index.js new file mode 100644 index 0000000000000..eab74692130a6 --- /dev/null +++ b/napi/oxlint2/test/fixtures/built_in_errors/index.js @@ -0,0 +1 @@ +debugger; diff --git a/napi/oxlint2/test/fixtures/built_in_no_errors/.oxlintrc.json b/napi/oxlint2/test/fixtures/built_in_no_errors/.oxlintrc.json new file mode 100644 index 0000000000000..91ec3d661a1c6 --- /dev/null +++ b/napi/oxlint2/test/fixtures/built_in_no_errors/.oxlintrc.json @@ -0,0 +1,4 @@ +{ + "categories": { "correctness": "off" }, + "rules": { "no-debugger": "error" } +} diff --git a/napi/oxlint2/test/fixtures/built_in_no_errors/index.js b/napi/oxlint2/test/fixtures/built_in_no_errors/index.js new file mode 100644 index 0000000000000..2756c24c45775 --- /dev/null +++ b/napi/oxlint2/test/fixtures/built_in_no_errors/index.js @@ -0,0 +1 @@ +let x;