Skip to content

Commit

Permalink
fix: vitest.exclude not working #60
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n committed Jul 23, 2022
1 parent 598194d commit 9cd3218
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/discover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sep } from 'path'
import path, { sep } from 'path'
import * as vscode from 'vscode'
import minimatch from 'minimatch'
import parse from './pure/parsers'
Expand Down Expand Up @@ -55,9 +55,10 @@ export class TestFileDiscoverer extends vscode.Disposable {
workspaceFolder.uri,
include,
)
const workspacePath = workspaceFolder.uri.fsPath
const watcher = vscode.workspace.createFileSystemWatcher(pattern)
const filter = (v: vscode.Uri) =>
exclude.every(x => !minimatch(v.fsPath, x, { dot: true }))
exclude.every(x => !minimatch(path.relative(workspacePath, v.fsPath), x, { dot: true }))
watcher.onDidCreate(
uri => filter(uri) && this.getOrCreateFile(controller, uri),
)
Expand Down

0 comments on commit 9cd3218

Please sign in to comment.