Skip to content

baseNameMatch works incorrectly #312

@canonic-epicure

Description

@canonic-epicure

Environment

  • OS Version: Ubuntu 18.04
  • Node.js Version: Node 12.22

According to the docs for the baseNameMatch option:

If set to true, then patterns without slashes will be matched against the basename of the path if it contains slashes.

This makes me think, that pattern with slashes are not affected by this option. However, check the following REPL session:

nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ node
Welcome to Node.js v12.22.1.
Type ".help" for more information.
> const fg = require('fast-glob')
undefined
> fg.sync('tests/**/hoo*.t.js', { })
[ 'tests/hook/hook.t.js' ]
> fg.sync('tests/**/hoo*.t.js', { baseNameMatch : true })
[]
> 

As you can see, the pattern with slashes is processed differently, depending on this option.

Note, that in the glob package, this option is processed correctly (there it is called matchBase):

> const glob = require('glob')
undefined
> glob.sync('tests/**/hoo*.t.js', { })
[ 'tests/hook/hook.t.js' ]
> glob.sync('tests/**/hoo*.t.js', { matchBase : true })
[ 'tests/hook/hook.t.js' ]
> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions