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: apply retry and bail from test config file #4530

Merged
merged 3 commits into from
Nov 18, 2023
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
4 changes: 2 additions & 2 deletions packages/vitest/src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ cli
.option('--inspect', 'Enable Node.js inspector')
.option('--inspect-brk', 'Enable Node.js inspector with break')
.option('--test-timeout <time>', 'Default timeout of a test in milliseconds (default: 5000)')
.option('--bail <number>', 'Stop test execution when given number of tests have failed', { default: 0 })
.option('--retry <times>', 'Retry the test specific number of times if it fails', { default: 0 })
.option('--bail <number>', 'Stop test execution when given number of tests have failed (default: 0)')
.option('--retry <times>', 'Retry the test specific number of times if it fails (default: 0)')
.option('--diff <path>', 'Path to a diff config that will be used to generate diff interface')
.option('--expand-snapshot-diff', 'Show full diff when snapshot fails')
.option('--typecheck [options]', 'Custom options for typecheck pool')
Expand Down
1 change: 0 additions & 1 deletion test/config/fixtures/retry/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ['*.test.ts'],
retry: 3,
},
})
11 changes: 3 additions & 8 deletions test/config/test/retry.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { runVitest } from '../../test-utils'
import { runVitestCli } from '../../test-utils'

const root = path.resolve('./fixtures/retry')
function run(testNamePattern?: string) {
return runVitest({
root,
testNamePattern,
})
function run(testNamePattern: string) {
return runVitestCli('run', 'fixtures/retry/retry.test.ts', '-c', 'fixtures/retry/vitest.config.ts', '-t', testNamePattern)
}

describe('retry', () => {
Expand Down