Apply suggestions from code review
Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
parent
ffbcc29470
commit
d4d71dda0d
|
|
@ -107,7 +107,7 @@ export class FullConfigInternal {
|
|||
const cpus = os.cpus().length;
|
||||
this.config.workers = Math.max(1, Math.floor(cpus * (parseInt(workers, 10) / 100)));
|
||||
} else {
|
||||
this.config.workers = resolveWorkers(workers);
|
||||
this.config.workers = parseWorkers(workers);
|
||||
}
|
||||
} else {
|
||||
this.config.workers = workers;
|
||||
|
|
@ -223,7 +223,7 @@ function resolveReporters(reporters: Config['reporter'], rootDir: string): Repor
|
|||
});
|
||||
}
|
||||
|
||||
function resolveWorkers(workers: string) {
|
||||
function parseWorkers(workers: string) {
|
||||
const parsedWorkers = parseInt(workers, 10);
|
||||
if (isNaN(parsedWorkers))
|
||||
throw new Error(`Workers ${workers} must be a number or percentage.`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue