-
-
Notifications
You must be signed in to change notification settings - Fork 322
feat: handle vitest workspace configuration #1003
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
Changes from 2 commits
cd0f799
31b4588
c2ce293
27564a4
33da58d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "@fixtures/vitest8", | ||
| "devDependencies": { | ||
| "vitest": "*" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { expect, test } from 'vitest'; | ||
|
|
||
| test('Unit A', () => { | ||
| expect(true).toBe(!false); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| workspace: [ | ||
| { | ||
| test: { | ||
| name: 'integration', | ||
| setupFiles: './vitest.integration.setup.mjs', | ||
| }, | ||
| }, | ||
| { | ||
| test: { | ||
| globalSetup: './vitest.unit.setup.ts', | ||
| name: 'unit', | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { test } from 'bun:test'; | ||
| import assert from 'node:assert/strict'; | ||
| import { main } from '../../src/index.js'; | ||
| import { resolve } from '../../src/util/path.js'; | ||
| import baseArguments from '../helpers/baseArguments.js'; | ||
| import baseCounters from '../helpers/baseCounters.js'; | ||
|
|
||
| const cwd = resolve('fixtures/plugins/vitest8'); | ||
|
|
||
| test('Find dependencies with Vitest plugin (8)', async () => { | ||
| const { counters, issues, report, rules } = await main({ | ||
| ...baseArguments, | ||
| cwd, | ||
| }); | ||
|
|
||
| assert(issues.unresolved['vitest.config.ts']['./vitest.integration.setup.mjs']); | ||
| assert(issues.unresolved['vitest.config.ts']['./vitest.unit.setup.ts']); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the PR! Happy to merge. If you could please
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure that I understand the counters and issues returned by How exactly would
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I wasn't clear. With "tidy" I meant that the issue counters end up being zero ( |
||
|
|
||
| assert.deepEqual(counters, { | ||
| ...baseCounters, | ||
| unlisted: 0, | ||
| unresolved: 2, | ||
| processed: 3, | ||
| total: 3, | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the types for this plugin (https://github.com/webpro-nl/knip/pull/1003/checks#step:6:18)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
27564a4