Skip to content

Commit

Permalink
test: add a test for queue
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Dec 9, 2024
1 parent 3e6d366 commit 753456b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/reporters/fixtures/long-loading-task.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { test } from 'vitest'

await new Promise(r => setTimeout(r, 500))

test('works')
14 changes: 14 additions & 0 deletions test/reporters/tests/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ describe('default reporter', async () => {
expect(result.stderr).not.toContain(`status: 'not found'`)
})

test('prints queued tests as soon as they are added', async () => {
const { stdout, vitest } = await runVitest({
include: ['fixtures/long-loading-task.test.ts'],
reporters: [['default', { isTTY: true, summary: true }]],
config: 'fixtures/vitest.config.ts',
watch: true,
})

await vitest.waitForStdout('❯ fixtures/long-loading-task.test.ts 0/0')
await vitest.waitForStdout('Waiting for file changes...')

expect(stdout).toContain('✓ fixtures/long-loading-task.test.ts (1 test)')
})

test('prints skipped tests by default when a single file is run', async () => {
const { stdout } = await runVitest({
include: ['fixtures/all-passing-or-skipped.test.ts'],
Expand Down

0 comments on commit 753456b

Please sign in to comment.