Skip to content

Commit

Permalink
fix: toggle glob windowsPathsNoEscape to true
Browse files Browse the repository at this point in the history
  • Loading branch information
cschanaj committed Mar 4, 2023
1 parent 5895551 commit 7bbb915
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build-self-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function instrumentFile (name) {
}

async function instrumentGlob (pattern) {
const result = await glob(pattern)
const result = await glob(pattern, { windowsPathsNoEscape: true })

result.forEach(file => {
instrumentFile(file)
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class NYC {
this._loadAdditionalModules()

this.fakeRequire = true
const files = await this.exclude.glob(this.cwd)
const files = await this.exclude.glob(this.cwd, { windowsPathsNoEscape: true })
for (const relFile of files) {
const filename = path.resolve(this.cwd, relFile)
const ext = path.extname(filename)
Expand Down Expand Up @@ -236,14 +236,15 @@ class NYC {
if (stats.isDirectory()) {
inputDir = input

const filesToInstrument = await this.exclude.glob(input)
const filesToInstrument = await this.exclude.glob(input, { windowsPathsNoEscape: true })

const concurrency = output ? os.cpus().length : 1
if (this.config.completeCopy && output) {
const files = await glob(path.resolve(input, '**'), {
dot: true,
nodir: true,
ignore: ['**/.git', '**/.git/**', path.join(output, '**')]
ignore: ['**/.git', '**/.git/**', path.join(output, '**')],
windowsPathsNoEscape: true
})
const destDirs = new Set(
files.map(src => path.dirname(path.join(output, path.relative(input, src))))
Expand Down
2 changes: 1 addition & 1 deletion npm-run-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ const patterns = [
]

patterns.forEach(pattern => {
glob.globSync(pattern)
glob.globSync(pattern, { windowsPathsNoEscape: true })
.forEach((f) => rimraf(f))
})
2 changes: 1 addition & 1 deletion test/helpers/reset-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const rimraf = require('rimraf')

module.exports = async function () {
// nuke any temporary files created during test runs.
const files = await glob('test/**/*/{.nyc_output,.cache}')
const files = await glob('test/**/*/{.nyc_output,.cache}', { windowsPathsNoEscape: true })
await Promise.all(files.map(f => rimraf(f)))

// reset Node's require cache.
Expand Down
2 changes: 1 addition & 1 deletion test/nyc-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ t.test('extracts coverage headers from unexecuted files', async t => {
]
})

const files = await glob(path.join(t.tempDir, '*.json'))
const files = await glob(path.join(t.tempDir, '*.json'), { windowsPathsNoEscape: true })
const coverage = []
await Promise.all(files.map(async file => {
const data = JSON.parse(await fs.readFile(file, 'utf-8'))
Expand Down

0 comments on commit 7bbb915

Please sign in to comment.