- Clone ESLint and run npm install
- Copy above 2 files inside the ESLint folder
- create 5 copies of the
lib
folder - create 5 copies of
tests
folder- Makesure you remove
bench
,fixtures
andperformance
folders fromtests<1 to 5>
folders.
- Makesure you remove
- Single Run:
time node run.js
- Parallel run:
time node run.js 1
- for other runs just comment out different globs
Last active
April 17, 2018 13:56
-
-
Save gyandeeps/61aab150e38d4d0c545fecd5d13b24b4 to your computer and use it in GitHub Desktop.
Parallel run test for ESLint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const workerFarm = require("worker-farm"); | |
const FARM_OPTIONS = { | |
maxConcurrentWorkers : require('os').cpus().length | |
, maxCallsPerWorker : Infinity | |
, maxConcurrentCallsPerWorker : 1 | |
}; | |
const workers = workerFarm(FARM_OPTIONS, require.resolve("./worker")); | |
let ret = 0; | |
const isMulti = process.argv[2] && parseInt(process.argv[2], 10) === 1; | |
if (isMulti) { | |
console.log("Multi"); | |
const patterns = [ | |
["lib/**/*.js"], | |
["lib1/**/*.js"], | |
["lib2/**/*.js"], | |
["lib3/**/*.js"], | |
["lib4/**/*.js"], | |
["lib5/**/*.js"], | |
["tests/**/*.js"], | |
["tests1/**/*.js"], | |
["tests2/**/*.js"], | |
["tests3/**/*.js"], | |
["tests4/**/*.js"], | |
["tests5/**/*.js"] | |
]; | |
const maxRet = patterns.length; | |
for (var i = 0; i < maxRet; i++) { | |
workers(patterns[i], function (err, outp) { | |
console.log("done"); | |
if (++ret === maxRet) | |
workerFarm.end(workers) | |
}) | |
} | |
} | |
else { | |
console.log("Single"); | |
const workerMod = require("./worker"); | |
const maxRet = 1; | |
const patterns = [ | |
["lib/**/*.js", "lib1/**/*.js", "lib2/**/*.js", "lib3/**/*.js", "lib4/**/*.js", "lib5/**/*.js", "tests/**/*.js", "tests1/**/*.js", "tests2/**/*.js", "tests3/**/*.js", "tests4/**/*.js", "tests5/**/*.js"] | |
]; | |
for (var i = 0; i < maxRet; i++) { | |
workerMod(patterns[0], function (err, outp) { | |
//console.log("done"); | |
console.log("done", outp.results.length); | |
if (++ret === maxRet) | |
workerFarm.end(workers) | |
}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CLIEngine = require("./lib/cli-engine"); | |
const engine = new CLIEngine({}); | |
module.exports = (pattern, callback) => { | |
const fileConfig = engine.executeOnFiles(pattern); | |
callback(null, fileConfig); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My machine: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz, 8gb ram