@@ -11,8 +11,8 @@ import { WebSocketServer } from 'ws'
1111import { getConfig } from '../config'
1212import { workerPath } from '../constants'
1313import { createErrorLogger , log } from '../log'
14- import { formatPkg } from '../utils'
15- import { waitForWsConnection } from './ws'
14+ import { formatPkg , showVitestError } from '../utils'
15+ import { waitForWsConnection , WsConnectionMetadata } from './ws'
1616
1717export async function createVitestTerminalProcess ( pkg : VitestPackage ) : Promise < ResolvedMeta > {
1818 const pnpLoader = pkg . loader
@@ -26,9 +26,10 @@ export async function createVitestTerminalProcess(pkg: VitestPackage): Promise<R
2626 const config = getConfig ( pkg . folder )
2727 const env = config . env || { }
2828 const terminal = vscode . window . createTerminal ( {
29- hideFromUser : true ,
29+ hideFromUser : false ,
3030 cwd : pkg . cwd ,
3131 isTransient : false ,
32+ name : 'vitest' ,
3233 shellArgs : config . terminalShellArgs ,
3334 shellPath : config . terminalShellPath ,
3435 env : {
@@ -49,7 +50,15 @@ export async function createVitestTerminalProcess(pkg: VitestPackage): Promise<R
4950 log . info ( '[API]' , `Initiated ws connection via ${ wsAddress } ` )
5051 log . info ( '[API]' , `Starting ${ formatPkg ( pkg ) } in the terminal: ${ command } ` )
5152 terminal . sendText ( command , true )
52- const meta = await waitForWsConnection ( wss , pkg , false , 'terminal' )
53+ const meta = await new Promise < WsConnectionMetadata > ( ( resolve , reject ) => {
54+ const timeout = setTimeout ( ( ) => {
55+ terminal . show ( false )
56+ reject ( new Error ( `The extension could not connect to the terminal in 5 seconds. See the "vitest" terminal output for more details.` ) )
57+ } , 5000 )
58+ waitForWsConnection ( wss , pkg , false , 'terminal' ) . then ( resolve , reject ) . finally ( ( ) => {
59+ clearTimeout ( timeout )
60+ } )
61+ } )
5362 const processId = ( await terminal . processId ) ?? Math . random ( )
5463 log . info ( '[API]' , `${ formatPkg ( pkg ) } terminal process ${ processId } created` )
5564 const vitestProcess = new ExtensionTerminalProcess (
0 commit comments