Skip to content

Commit c652148

Browse files
committed
chore: remove unused property
1 parent ce5ca6b commit c652148

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

packages/vitest/src/node/core.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type { defineWorkspace } from 'vitest/config'
1313
import type { ArgumentsType, CoverageProvider, OnServerRestartHandler, Reporter, ResolvedConfig, UserConfig, UserWorkspaceConfig, VitestRunMode } from '../types'
1414
import { hasFailed, noop, slash, toArray, wildcardPatternToRegExp } from '../utils'
1515
import { getCoverageProvider } from '../integrations/coverage'
16-
import type { BrowserProvider } from '../types/browser'
1716
import { CONFIG_NAMES, configFiles, workspacesFiles as workspaceFiles } from '../constants'
1817
import { rootDir } from '../paths'
1918
import { WebSocketReporter } from '../api/setup'
@@ -43,14 +42,14 @@ export class Vitest {
4342
cache: VitestCache = undefined!
4443
reporters: Reporter[] = undefined!
4544
coverageProvider: CoverageProvider | null | undefined
46-
browserProvider: BrowserProvider | undefined
4745
logger: Logger
4846
pool: ProcessPool | undefined
4947

5048
vitenode: ViteNodeServer = undefined!
5149

5250
invalidates: Set<string> = new Set()
5351
changedTests: Set<string> = new Set()
52+
watchedTests: Set<string> = new Set()
5453
filenamePattern?: string
5554
runningPromise?: Promise<void>
5655
closingPromise?: Promise<void>
@@ -623,6 +622,14 @@ export class Vitest {
623622
return
624623

625624
this._rerunTimer = setTimeout(async () => {
625+
// run only watched tests
626+
if (this.watchedTests.size) {
627+
this.changedTests.forEach((test) => {
628+
if (!this.watchedTests.has(test))
629+
this.changedTests.delete(test)
630+
})
631+
}
632+
626633
if (this.changedTests.size === 0) {
627634
this.invalidates.clear()
628635
return
@@ -665,6 +672,15 @@ export class Vitest {
665672
})
666673
}
667674

675+
/**
676+
* Watch only the specified tests. If no tests are provided, all tests will be watched.
677+
*/
678+
public watchTests(tests: string[]) {
679+
this.watchedTests = new Set(
680+
tests.map(test => slash(test)),
681+
)
682+
}
683+
668684
private unregisterWatcher = noop
669685
private registerWatcher() {
670686
const updateLastChanged = (filepath: string) => {

0 commit comments

Comments
 (0)