Skip to content

Instantly share code, notes, and snippets.

@mikeerickson
Last active January 3, 2019 22:26
Show Gist options
  • Save mikeerickson/38431c67e6896b9758276a75777b7f5c to your computer and use it in GitHub Desktop.
Save mikeerickson/38431c67e6896b9758276a75777b7f5c to your computer and use it in GitHub Desktop.
(JS) Script to execute mocha test stress tests
/*eslint no-console: "off"*/
const { spawnSync } = require("child_process");
const colors = require("chalk");
let iterations = process.argv.slice(2)[0] || 5;
console.log("");
console.time(colors.red("Execution Time"));
for (let idx = 1; idx <= iterations; idx++) {
let pct = Math.round((idx / iterations) * 100);
let msg = `${colors.blue.bold("==> Running Stress Test:")} ${idx} of ${iterations} (${pct}%)`;
console.log(colors.green(msg));
spawnSync("yarn", ["run", "test"], { stdio: "inherit" });
}
console.timeEnd(colors.red("Execution Time"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment