Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log("-----------------");
}
config.set({
basepath: {
node: __dirname,
}
});
let cpuCount = os.cpus().length + 1;
if ("TRAVIS" in process.env && "CI" in process.env) {
// fixed thread count for CI
cpuCount = 8;
}
const testFiles: string[] = glob.sync("./test/**/*.spec.js");
const pool = new Pool(cpuCount);
let jobCounter = 0;
const testStartTime = new Date();
const fileCount = testFiles.length;
let exitWithError = false;
let totalTestCount = 0;
let totalFailedTestCount = 0;
console.log(
`Running tests: ${fileArrToString(testFiles)} with ${cpuCount} threads`);
testFiles.forEach(file => {
pool.run("./test_thread")
.send({files: [file]})
.on("done",
(testCount, failedTestCount) => {
if (failedTestCount !== 0) {
const newThreadPool = (config) => {
logger.verbose('Creating new threadpool');
return config.threads ? new Threads.Pool(config.threads) : new Threads.Pool();
};
constructor (numWorkers, outputBuffer) {
this.outputBuffer= outputBuffer
this.usingWorkers = numWorkers > 0
if (this.usingWorkers > 0) {
this.pool = Pool(
() => spawn(new Worker(), numWorkers)
)
} else {
this.pool = null
}
}
prepareDataForTransfer (typedArrays) {
constructor(options: WorkerInit) {
const { concurrency, reporter } = options;
this.options = options;
this.pool = new Pool(concurrency);
this.pool.on("error", (job, e) => reporter.reportError(e));
}