diff --git a/API.md b/API.md index 5a33930..831e6a3 100644 --- a/API.md +++ b/API.md @@ -6,8 +6,8 @@ The oxlint configuration containing hapi style guide rules and config. To use in [`@hapi/oxc-plugin`](https://github.com/hapijs/oxc-plugin) to your `package.json`, then in your `oxlint.config.ts` add: ```ts -import { defineConfig } from 'oxlint'; import DefaultOxlintConfig from '@hapi/oxc-plugin/oxlint'; +import { defineConfig } from 'oxlint'; export default defineConfig({ extends: [DefaultOxlintConfig], @@ -23,8 +23,8 @@ The [oxfmt](https://oxc.rs/docs/guide/usage/formatter/oxfmt.html) configuration [`@hapi/oxc-plugin`](https://github.com/hapijs/oxc-plugin) to your `package.json`, then in your `oxfmt.config.ts` add: ```ts -import { defineConfig } from 'oxfmt'; import DefaultOxfmtConfig from '@hapi/oxc-plugin/oxfmt'; +import { defineConfig } from 'oxfmt'; export default defineConfig({ ...DefaultOxfmtConfig, @@ -94,8 +94,8 @@ To use it, add [`@hapi/oxc-plugin`](https://github.com/hapijs/oxc-plugin) to you in your `vitest.config.js` add: ```js -import { defineConfig } from 'vitest/config'; import oxc from '@hapi/oxc-plugin/vitest'; +import { defineConfig } from 'vitest/config'; export default defineConfig({ plugins: [oxc()], diff --git a/package.json b/package.json index 748b422..e8cc415 100644 --- a/package.json +++ b/package.json @@ -43,14 +43,13 @@ "lint:fix": "oxlint --fix && oxfmt --write" }, "dependencies": { - "@oxlint/plugins": "^1.76.0" + "@oxlint/plugins": "^1.90.0" }, "devDependencies": { - "@hapi/oxc-plugin": "file:.", - "@vitest/coverage-v8": "^4.1.10", - "oxfmt": "^0.61.0", - "oxlint": "^1.76.0", - "vitest": "^4.1.10" + "@vitest/coverage-v8": "^5.0.5", + "oxfmt": "^0.75.0", + "oxlint": "^1.90.0", + "vitest": "^5.0.5" }, "peerDependencies": { "oxfmt": ">=0.61.0", diff --git a/src/vitest.js b/src/vitest.js index 6fc9c32..7735d51 100644 --- a/src/vitest.js +++ b/src/vitest.js @@ -5,7 +5,7 @@ export default function (options = {}) { return { name: '@hapi/oxc-plugin:vitest', - async configureVitest({ injectTestProjects }) { + async configureVitest({ project, injectTestProjects }) { await injectTestProjects({ // Vitest 5 makes inline projects extend the declaring config by default, which // would run the host's own tests a 2nd time under this project. @@ -19,6 +19,9 @@ export default function (options = {}) { name: '@hapi/oxc-plugin', include: [Path.join(import.meta.dirname, 'vitest.test.js')], exclude: [], + // Without extending, our maxWorkers default ignores `vitest run` and follows the TTY, + // vitest 5 then refuses to group it with the host project. + maxWorkers: project.config.maxWorkers, }, }); }, diff --git a/test/vitest.js b/test/vitest.js index f0a2b47..6f74d92 100644 --- a/test/vitest.js +++ b/test/vitest.js @@ -9,6 +9,7 @@ const internals = {}; internals.inject = async function (plugin) { const injected = []; const context = { + project: { config: { maxWorkers: 3 } }, injectTestProjects(config) { injected.push(config); return Promise.resolve([]); @@ -34,6 +35,7 @@ describe('vitest plugin', () => { expect(injected).toHaveLength(1); expect(injected[0].extends).toBe(false); expect(injected[0].test.name).toBe('@hapi/oxc-plugin'); + expect(injected[0].test.maxWorkers).toBe(3); expect(injected[0].test.include).toHaveLength(1); expect(injected[0].test.include[0]).toMatch(/vitest\.test\.js$/); expect(injected[0].define.__HAPI_OXC_OXLINT__).toBe(true); diff --git a/vitest.config.js b/vitest.config.js index 2f3cde7..749898c 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -20,7 +20,14 @@ export default defineConfig({ }, reportsDirectory: './coverage', reporter: ['text', 'lcov'], - exclude: ['test/**', 'dist/**', '**/*.d.ts'], + + exclude: [ + 'test/**', + 'dist/**', + '**/*.d.ts', + // Vitest 5 no longer drops the test file injected by our own plugin from coverage. + 'src/vitest.test.js', + ], }, }, });