Last active
January 3, 2019 22:26
-
-
Save mikeerickson/38431c67e6896b9758276a75777b7f5c to your computer and use it in GitHub Desktop.
(JS) Script to execute mocha test stress tests
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
/*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