Skip to content

Commit

Permalink
chore: add verbose log for the watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Oct 2, 2024
1 parent ab940fe commit e2285cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import mm from 'micromatch'
import type { TestTree } from './testTree'
import { getConfig } from './config'
import type { VitestFolderAPI } from './api'
import { log } from './log'

export class ExtensionWatcher extends vscode.Disposable {
private watcherByFolder = new Map<vscode.WorkspaceFolder, vscode.FileSystemWatcher>()
Expand All @@ -31,10 +32,12 @@ export class ExtensionWatcher extends vscode.Disposable {
this.watcherByFolder.set(api.workspaceFolder, watcher)

watcher.onDidDelete((file) => {
log.verbose?.('[VSCODE] File deleted:', file.fsPath)
this.testTree.removeFile(normalize(file.fsPath))
})

watcher.onDidChange(async (file) => {
log.verbose?.('[VSCODE] File changed:', file.fsPath)
const filepath = normalize(file.fsPath)
if (await this.shouldIgnoreFile(filepath)) {
return
Expand All @@ -43,6 +46,7 @@ export class ExtensionWatcher extends vscode.Disposable {
})

watcher.onDidCreate(async (file) => {
log.verbose?.('[VSCODE] File created:', file.fsPath)
const filepath = normalize(file.fsPath)
if (await this.shouldIgnoreFile(filepath)) {
return
Expand Down

0 comments on commit e2285cc

Please sign in to comment.