-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
--exclude
CLI flag (#4279)
Co-authored-by: Vladimir <[email protected]>
- Loading branch information
1 parent
4d55a02
commit f859efc
Showing
13 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import { add } from './math' | ||
|
||
test('should add two numbers correctly', () => { | ||
expect(add(1, 2)).toBe(3) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function add(a: number, b: number): number { | ||
return a + b | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import { capitalize } from './string' | ||
|
||
test('should capitalize strings correctly', () => { | ||
expect(capitalize('i Love Vitest')).toBe('I love vitest') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function capitalize(str: string): string { | ||
return str.slice(0, 1).toUpperCase() + str.slice(1).toLowerCase() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['fixtures/exclude/*.test.ts'], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@vitest/test-cli", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest --exclude fixtures/exclude/**/string.test.ts" | ||
}, | ||
"devDependencies": { | ||
"vite": "latest", | ||
"vitest": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import { runVitestCli } from '../../test-utils' | ||
|
||
test('should still test math.test.ts', async () => { | ||
const { stderr, stdout } = await runVitestCli( | ||
'run', | ||
'--config', | ||
'fixtures/exclude/vitest.exclude.config.ts', | ||
'--exclude', | ||
'fixtures/exclude/string.test.ts', | ||
) | ||
|
||
expect(stdout).toContain(`✓ fixtures/exclude/math.test.ts`) | ||
expect(stdout).not.toContain(`string.test.ts`) | ||
expect(stderr).toBe('') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['test/**.test.ts'], | ||
reporters: ['verbose'], | ||
testTimeout: 60_000, | ||
chaiConfig: { | ||
truncateThreshold: 999, | ||
}, | ||
}, | ||
}) |