Skip to content

Commit

Permalink
fix: apply retry and bail from test config file (#4530)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 18, 2023
1 parent 6a149a6 commit 94f9a3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
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

0 comments on commit 94f9a3c

Please sign in to comment.