Skip to content

Commit

Permalink
fix: respect trailing slash when filtering by file path (#4538)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuibu authored Nov 27, 2023
1 parent 2b2416d commit f377a3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vitest/src/node/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { promises as fs } from 'node:fs'
import fg from 'fast-glob'
import mm from 'micromatch'
import { dirname, relative, resolve, toNamespacedPath } from 'pathe'
import { dirname, join, relative, resolve, toNamespacedPath } from 'pathe'
import type { TransformResult, ViteDevServer, InlineConfig as ViteInlineConfig } from 'vite'
import { ViteNodeRunner } from 'vite-node/client'
import { ViteNodeServer } from 'vite-node/server'
Expand Down Expand Up @@ -254,7 +254,8 @@ export class WorkspaceProject {
return testFiles.filter((t) => {
const testFile = relative(dir, t)
return filters.some((f) => {
return testFile.includes(f) || testFile.includes(relative(dir, f))
const relativePath = f.endsWith('/') ? join(relative(dir, f), '/') : relative(dir, f)
return testFile.includes(f) || testFile.includes(relativePath)
})
})
}
Expand Down

0 comments on commit f377a3b

Please sign in to comment.