Skip to content

Commit

Permalink
Renames testRunner to multipleTestExecutionsRunner and clean env befo…
Browse files Browse the repository at this point in the history
…re each test execution
  • Loading branch information
jeremy-then committed Dec 1, 2023
1 parent d710353 commit 26483e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion testRunner.js → multipleTestExecutionsRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ const timesArg = Number(process.argv[2]);

const RUN_ALL_TESTS_THESE_TIMES = timesArg || Number(process.env.RUN_ALL_TESTS_THESE_TIMES) || 1;

console.info(`Will attempt to run tests ${RUN_ALL_TESTS_THESE_TIMES} times.`)
console.info(`Will attempt to run tests ${RUN_ALL_TESTS_THESE_TIMES} times.`);

const cleanEnvCommand = "kill $(ps -A | grep -e java -e python -e bitcoind | awk '{print $1}')";

const ensureCleanEnv = () => {
console.info('Cleaning environment...');
shell.exec(cleanEnvCommand);
console.info('Environment clean.');
};

let fails = 0;
let attempts = 1;

for(let i = 0; i < RUN_ALL_TESTS_THESE_TIMES; i++) {
console.info(`Running tests ${attempts} out of ${RUN_ALL_TESTS_THESE_TIMES} times.`);
ensureCleanEnv();
if (shell.exec('npm run test-fail-fast').code !== 0) {
fails++;
}
Expand Down

0 comments on commit 26483e4

Please sign in to comment.