fix: don't toggle cli cursor on non-TTY (#7336) · vitest-dev/vitest@3c8050e (original) (raw)
``
1
`+
import { expect, test } from 'vitest'
`
``
2
`+
import { runVitest } from '../../test-utils'
`
``
3
+
``
4
`+
test('cursor is hidden during test run in TTY', async () => {
`
``
5
`+
const { stdout } = await runVitest({
`
``
6
`+
include: ['b1.test.ts'],
`
``
7
`+
root: 'fixtures/default',
`
``
8
`+
reporters: 'none',
`
``
9
`+
watch: false,
`
``
10
`+
}, undefined, undefined, undefined, { tty: true, preserveAnsi: true })
`
``
11
+
``
12
`+
expect(stdout).toContain('\x1B[?25l')
`
``
13
`+
expect(stdout).toContain('\x1B[?25h')
`
``
14
`+
})
`
``
15
+
``
16
`+
test('cursor is not hidden during test run in non-TTY', async () => {
`
``
17
`+
const { stdout } = await runVitest({
`
``
18
`+
include: ['b1.test.ts'],
`
``
19
`+
root: 'fixtures/default',
`
``
20
`+
reporters: 'none',
`
``
21
`+
watch: false,
`
``
22
`+
}, undefined, undefined, undefined, { preserveAnsi: true })
`
``
23
+
``
24
`+
expect(stdout).not.toContain('\x1B[?25l')
`
``
25
`+
expect(stdout).not.toContain('\x1B[?25h')
`
``
26
`+
})
`