[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix: don't rerun on Esc or Ctrl-C during watch filter (#6895)

authored by

Hiroshi Ogawa and committed by
GitHub
(Nov 12, 2024, 1:41 PM +0100) 98f76ea7 07c19b8a

+11 -6
+9
packages/vitest/src/node/stdin.ts
··· 149 149 }) 150 150 151 151 on() 152 + 153 + if (typeof filter === 'undefined') { 154 + return 155 + } 156 + 152 157 const files = ctx.state.getFilepaths() 153 158 // if running in standalone mode, Vitest instance doesn't know about any test file 154 159 const cliFiles ··· 192 197 }) 193 198 194 199 on() 200 + 201 + if (typeof filter === 'undefined') { 202 + return 203 + } 195 204 196 205 latestFilename = filter?.trim() || '' 197 206 const lastResults = watchFilter.getLastResults()
+2 -6
packages/vitest/src/node/watch-filter.ts
··· 74 74 break 75 75 case key?.ctrl && key?.name === 'c': 76 76 case key?.name === 'escape': 77 - this.cancel() 77 + this.write(`${ESC}1G${ESC}0J`) // clean content 78 78 onSubmit(undefined) 79 - break 79 + return 80 80 case key?.name === 'enter': 81 81 case key?.name === 'return': 82 82 onSubmit( ··· 222 222 const cursortPos 223 223 = this.keywordOffset() + (this.currentKeyword?.length || 0) 224 224 this.write(`${ESC}${cursortPos}G`) 225 - } 226 - 227 - private cancel() { 228 - this.write(`${ESC}J`) // erase down 229 225 } 230 226 231 227 private write(data: string) {