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

fix!: improve globs #3392

Merged
merged 13 commits into from
Jun 6, 2023
10 changes: 5 additions & 5 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ All configuration options that are not supported inside a [workspace](/guide/wor
### include

- **Type:** `string[]`
- **Default:** `['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']`
- **Default:** `['**/*.{test,spec}.{,m,c}{j,t}sx?']`

Files to include in the test run, using glob pattern.

Expand Down Expand Up @@ -206,7 +206,7 @@ Options used when running `vitest bench`.
#### benchmark.include

- **Type:** `string[]`
- **Default:** `['**/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']`
- **Default:** `['**/*.{bench,benchmark}.{,m,c}{j,t}sx?']`

Include globs for benchmark test files

Expand Down Expand Up @@ -702,9 +702,9 @@ List of files included in coverage as glob patterns
'**/*.d.ts',
'cypress/**',
'test{,s}/**',
'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'test{,-*}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'**/*{.,-}test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'**/*{.,-}spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
Expand Down
10 changes: 5 additions & 5 deletions packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { BenchmarkUserOptions, ResolvedCoverageOptions, UserConfig } from './types'
import { isCI } from './utils/env'

export const defaultInclude = ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
export const defaultInclude = ['**/*.{test,spec}.{,m,c}{j,t}sx?']
nickserv marked this conversation as resolved.
Show resolved Hide resolved
export const defaultExclude = ['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*']
export const benchmarkConfigDefaults: Required<Omit<BenchmarkUserOptions, 'outputFile'>> = {
include: ['**/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
include: ['**/*.{bench,benchmark}.{,m,c}{j,t}sx?'],
exclude: defaultExclude,
includeSource: [],
reporters: ['default'],
Expand All @@ -17,9 +17,9 @@ const defaultCoverageExcludes = [
'**/*.d.ts',
'cypress/**',
'test{,s}/**',
'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'test{,-*}.{,m,c}{j,t}sx?',
'**/*{.,-}test.{,m,c}{j,t}sx?',
'**/*{.,-}spec.{,m,c}{j,t}sx?',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/types/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface BenchmarkUserOptions {
/**
* Include globs for benchmark test files
*
* @default ['**\/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
* @default ['**\/*.{bench,benchmark}.{,m,c}{j,t}sx?']
*/
include?: string[]

Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export interface InlineConfig {
/**
* Include globs for test files
*
* @default ['**\/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
* @default ['**\/*.{test,spec}.{,m,c}{j,t}sx?']
*/
include?: string[]

Expand Down
2 changes: 1 addition & 1 deletion test/stacktraces/fixtures/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default defineConfig({
test: {
threads: false,
isolate: false,
include: ['**/*.{test,spec}.{imba,js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
include: ['**/*.{test,spec}.{imba,{,m,c}{j,t}sx?}'],
setupFiles: ['./setup.js'],
},
})