Skip to content

Some files are not found when using pattern array #310

@bradlc

Description

@bradlc

Environment

  • OS Version: macOS 11.2.3
  • Node.js Version: 16.0.0

Actual behavior

Calling the sync method with an array of patterns does not correctly find all of the matching files. Running each pattern separately does.

Note that the files are found correctly when the paths are fully resolved.

Expected behavior

Passing an array of patterns should return the same list of files as running each pattern separately.

Steps to reproduce

  1. Clone https://github.com/bradlc/fast-glob-bug
  2. npm install
  3. cd test1
  4. node index.js

Code sample

const fg = require('fast-glob')
const assert = require('assert')

let pattern1 = '**/*.js'
let pattern2 = '../test2/**/*.js'

// fails
assert.deepStrictEqual(
  fg.sync([pattern1, pattern2]).sort(),
  [...fg.sync(pattern1), ...fg.sync(pattern2)].sort()
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions