diff --git a/build-self-coverage.js b/build-self-coverage.js index 91beff2f..59c40e42 100644 --- a/build-self-coverage.js +++ b/build-self-coverage.js @@ -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) diff --git a/index.js b/index.js index 32db0f8a..92b8422d 100755 --- a/index.js +++ b/index.js @@ -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) @@ -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)))) diff --git a/npm-run-clean.js b/npm-run-clean.js index ab77ce5c..8bfa1f9a 100644 --- a/npm-run-clean.js +++ b/npm-run-clean.js @@ -19,6 +19,6 @@ const patterns = [ ] patterns.forEach(pattern => { - glob.globSync(pattern) + glob.globSync(pattern, { windowsPathsNoEscape: true }) .forEach((f) => rimraf(f)) }) diff --git a/test/helpers/reset-state.js b/test/helpers/reset-state.js index 03aeb2a0..36fc9e3d 100644 --- a/test/helpers/reset-state.js +++ b/test/helpers/reset-state.js @@ -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. diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 214b6c78..cb9f2ae9 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -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'))