@@ -12,7 +12,7 @@ import { noop, slash, toArray } from '@vitest/utils'
1212import { getTasks , hasFailed } from '@vitest/runner/utils'
1313import { version } from '../../package.json' with { type : 'json' }
1414import { getCoverageProvider } from '../integrations/coverage'
15- import { workspacesFiles as workspaceFiles } from '../constants'
15+ import { defaultBrowserPort , workspacesFiles as workspaceFiles } from '../constants'
1616import { WebSocketReporter } from '../api/setup'
1717import type { SerializedCoverageConfig } from '../runtime/config'
1818import type { ArgumentsType , OnServerRestartHandler , ProvidedContext , UserConsoleLog } from '../types/general'
@@ -87,6 +87,9 @@ export class Vitest {
8787 /** @deprecated use `_cachedSpecs` */
8888 projectTestFiles = this . _cachedSpecs
8989
90+ /** @private */
91+ public _browserLastPort = defaultBrowserPort
92+
9093 constructor (
9194 public readonly mode : VitestRunMode ,
9295 options : VitestOptions = { } ,
@@ -104,6 +107,7 @@ export class Vitest {
104107 this . unregisterWatcher ?.( )
105108 clearTimeout ( this . _rerunTimer )
106109 this . restartsCount += 1
110+ this . _browserLastPort = defaultBrowserPort
107111 this . pool ?. close ?.( )
108112 this . pool = undefined
109113 this . coverageProvider = undefined
0 commit comments