just icon indicating copy to clipboard operation
just copied to clipboard

Extend the jest task to support rerunning a script multiple times (like 100x) as a stress test for intermittent failures

Open KRyan opened this issue 7 years ago • 4 comments

Scenario: your jest test is intermittently failing. You have a potential local fix, and you want to increase your confidence in the change by running in a tight loop (either locally or in a lab build).

Jest does not have built-in support, and recommends doing this in a script. https://github.com/facebook/jest/issues/4336

I'm imagining a "rerun N" parameter passed to the just script, which internally would run in loop taking advantage of concurrency, and give an aggregate report.

Thoughts?

KRyan avatar Jul 15 '19 19:07 KRyan

This seems like something you would do as a wrapper of a task function... would that be what you want?

kenotron avatar Jul 31 '19 19:07 kenotron

Thanks for the suggestion. I'm not familiar with how a wrapper of a task function would work -- could you share an example?

KRyan avatar Aug 06 '19 15:08 KRyan

Task functions are just functions, so you can call it multiple times if you need it to...

const {someTask} = require('./someTask');
module.exports = function() {
  for (let i = 0; i < 1000; i++) {
    someTask();
  }
}

kenotron avatar Aug 18 '19 17:08 kenotron

Feel free to ping me on Teams to discuss further on specifics if you need to! Closing this for now.

kenotron avatar Aug 18 '19 17:08 kenotron