Skip to content

Commit 0592f39

Browse files
committed
fix: restore cli cursor on unexpected exits
1 parent 164e52f commit 0592f39

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

packages/vitest/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"expect-type": "^1.1.0",
163163
"magic-string": "^0.30.12",
164164
"pathe": "^1.1.2",
165+
"restore-cursor": "^5.1.0",
165166
"std-env": "^3.8.0",
166167
"tinybench": "^2.9.0",
167168
"tinyexec": "^0.3.1",

packages/vitest/src/node/reporters/renderers/windowedRenderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Writable } from 'node:stream'
22
import type { Vitest } from '../../core'
33
import { stripVTControlCharacters } from 'node:util'
4+
import restoreCursor from 'restore-cursor'
45

56
const DEFAULT_RENDER_INTERVAL = 16
67

@@ -50,6 +51,9 @@ export class WindowRenderer {
5051
this.interceptStream(process.stderr, 'error'),
5152
)
5253

54+
restoreCursor()
55+
this.write(HIDE_CURSOR, 'output')
56+
5357
this.start()
5458
}
5559

@@ -129,7 +133,6 @@ export class WindowRenderer {
129133

130134
this.write(windowContent.join('\n'))
131135
this.write(SYNC_END)
132-
this.write(HIDE_CURSOR)
133136

134137
this.windowHeight = rowCount + Math.max(0, padding)
135138
}

pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)