diff --git a/package.json b/package.json index 3f328273..5a1f6755 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "commander": "^3.0.0", "globby": "^10.0.1", "ora": "^4.0.2", + "slash": "^3.0.0", "tmp": "^0.1.0", "workerpool": "^5.0.1" }, diff --git a/src/runner.js b/src/runner.js index 207935a9..e45b3ffe 100644 --- a/src/runner.js +++ b/src/runner.js @@ -1,8 +1,10 @@ const http = require('http'); const https = require('https'); const { writeFileSync } = require('fs'); -const { resolve, extname, join } = require('path'); +const { join } = require('path').posix; +const { resolve, extname } = require('path'); const colors = require('colors/safe'); +const slash = require('slash'); const globby = require('globby'); const ora = require('ora'); const queue = require('async-promise-queue'); @@ -182,7 +184,14 @@ async function getAllFiles(paths) { return path; }); - const files = await globby(patterns, { absolute: true, gitignore: true }); + const files = await globby(patterns, { + // must specify a properly escaped `cwd` because globby infers from + // process.cwd() directly and without correcting back to posix paths + // asserts if the individual file path isn't "in" the cwd + cwd: slash(process.cwd()), + absolute: true, + gitignore: true, + }); if (files.length < 1) { throw new NoFilesError(); }