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

feat(eslint): support *.spec.* files for Vitest #14

Merged
merged 1 commit into from
Oct 24, 2024
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
6 changes: 3 additions & 3 deletions eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const hasReact = has('react')
const hasTestingLibrary = has('@testing-library/dom')
const hasJestDom = has('@testing-library/jest-dom')
const hasVitest = has('vitest')
const vitestFiles = ['**/__tests__/**/*', '**/*.test.*']
const vitestFiles = ['**/__tests__/**/*', '**/*.test.*', '**/*.spec.*']
const testFiles = ['**/tests/**', '**/#tests/**', ...vitestFiles]
const playwrightFiles = ['**/e2e/**']

Expand Down Expand Up @@ -224,8 +224,8 @@ export const config = [
: null,

// This assumes test files are those which are in the test directory or have
// *.test.* in the filename. If a file doesn't match this assumption, then it
// will not be allowed to import test files.
// *.test.* or *.spec.* in the filename. If a file doesn't match this assumption,
// then it will not be allowed to import test files.
{
files: ['**/*.ts?(x)', '**/*.js?(x)'],
ignores: testFiles,
Expand Down
1 change: 1 addition & 0 deletions fixture/app/components/accordion.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const MockAccordion = () => <div>Accordion</div>
3 changes: 3 additions & 0 deletions fixture/app/components/accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// eslint-disable-next-line
import { MockAccordion } from './__tests__/accordion.tsx'
// eslint-disable-next-line
import { MockAccordion as SpecMockAccordion } from './accordion.spec.tsx'

console.log(MockAccordion)
console.log(SpecMockAccordion)