Skip to content
Snippets Groups Projects
Select Git revision
  • eda69ca6d71e79d96218c211dfd529768c72965d
  • main default protected
2 results

main.py

Blame
  • Forked from SOFT Core / SOFT 161 and 162 / Exploratory Testing
    Source project has a limited visibility.
    failFast.js 600 B
    import jestEnvironmentNode from 'jest-environment-node';
    
    export default class FailFastEnvironment extends jestEnvironmentNode.default {
      constructor(...rest) {
        super(...rest);
        this.failed = false;
      }
    
      async handleTestEvent(event, state) {
        switch (event.name) {
        case 'hook_failure':
        case 'test_fn_failure':
          this.failed = true;
          break;
        case 'test_start':
          if (this.failed) {
            event.test.mode = 'skip';
          }
          break;
        default:
        }
        if (super.handleTestEvent !== undefined) {
          await super.handleTestEvent(event, state);
        }
      }
    }