Skip to content

Commit

Permalink
Merge branch 'main' into fix-eco-ci-6
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Nov 13, 2024
2 parents acbae9f + 4c96cce commit ec1860b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/vitest/src/node/pools/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export function createMethodsRPC(project: WorkspaceProject, options: MethodsOpti

// serialize rollup error on server to preserve details as a test error
function handleRollupError(e: unknown): never {
if (e instanceof Error && 'plugin' in e) {
if (
e instanceof Error
&& ('plugin' in e || 'frame' in e || 'id' in e)
) {
// eslint-disable-next-line no-throw-literal
throw {
name: e.name,
Expand Down
9 changes: 9 additions & 0 deletions packages/vitest/src/node/stdin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ export function registerConsoleShortcuts(
})

on()

if (typeof filter === 'undefined') {
return
}

const files = ctx.state.getFilepaths()
// if running in standalone mode, Vitest instance doesn't know about any test file
const cliFiles
Expand Down Expand Up @@ -193,6 +198,10 @@ export function registerConsoleShortcuts(

on()

if (typeof filter === 'undefined') {
return
}

latestFilename = filter?.trim() || ''
const lastResults = watchFilter.getLastResults()

Expand Down
8 changes: 2 additions & 6 deletions packages/vitest/src/node/watch-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export class WatchFilter {
break
case key?.ctrl && key?.name === 'c':
case key?.name === 'escape':
this.cancel()
this.write(`${ESC}1G${ESC}0J`) // clean content
onSubmit(undefined)
break
return
case key?.name === 'enter':
case key?.name === 'return':
onSubmit(
Expand Down Expand Up @@ -224,10 +224,6 @@ export class WatchFilter {
this.write(`${ESC}${cursortPos}G`)
}

private cancel() {
this.write(`${ESC}J`) // erase down
}

private write(data: string) {
// @ts-expect-error -- write() method has different signature on the union type
this.stdout.write(data)
Expand Down

0 comments on commit ec1860b

Please sign in to comment.