Skip to content

Commit

Permalink
refactor: normalize file path to use unix slash when applying file fi…
Browse files Browse the repository at this point in the history
…lters
  • Loading branch information
thetutlage committed Jun 29, 2023
1 parent 8962d42 commit 0c9d5f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"fast-glob": "^3.2.12",
"find-cache-dir": "^4.0.0",
"getopts": "^2.3.0",
"ms": "^2.1.3"
"ms": "^2.1.3",
"slash": "^5.1.0"
},
"directories": {
"test": "test"
Expand Down
3 changes: 2 additions & 1 deletion src/files_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* file that was distributed with this source code.
*/

import slash from 'slash'
import { sep } from 'node:path'
import fastGlob from 'fast-glob'
import { pathToFileURL } from 'node:url'
Expand Down Expand Up @@ -46,7 +47,7 @@ export class FilesManager {
*/
grep(files: URL[], filters: string[]): URL[] {
return files.filter((file) => {
const filename = file.pathname
const filename = slash(file.pathname)
const filenameWithoutTestSuffix = filename.replace(FILE_SUFFIX_EXPRESSION, '')

return !!filters.find((filter) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/cli_parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const DATASET: [CLIArgs, CLIArgs][] = [
},
],
[
new CliParser().parse(['--browser=chrome', '--browser=firefox']),
new CliParser().parse(['--browser', 'chrome', '--browser', 'firefox']),
{
'_': [] as string[],
'files': '',
Expand Down

0 comments on commit 0c9d5f1

Please sign in to comment.