How to use the @stryker-mutator/api/test_runner.RunStatus.Error function in @stryker-mutator/api

To help you get started, we’ve selected a few @stryker-mutator/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stryker-mutator / stryker / packages / karma-runner / src / KarmaTestRunner.ts View on Github external
private determineRunState() {
    // Karma will report an Error if no tests had executed.
    // This is not an "error" in Stryker terms
    if (this.currentRunStatus === RunStatus.Error && !this.currentErrorMessages.length && !this.currentTestResults.length) {
      return RunStatus.Complete;
    } else if (this.currentErrorMessages.length) {
      // Karma will return Complete when there are runtime errors
      return RunStatus.Error;
    } else {
      return this.currentRunStatus;
    }
  }
}
github stryker-mutator / stryker / packages / karma-runner / src / KarmaTestRunner.ts View on Github external
public async run({ testHooks }: { testHooks?: string }): Promise {
    this.testHooksMiddleware.currentTestHooks = testHooks || '';
    if (this.currentRunStatus !== RunStatus.Error) {
      // Only run when there was no compile error
      // An compile error can happen in case of angular-cli
      await this.runServer();
    }
    const runResult = this.collectRunResult();
    this.cleanRun();
    return runResult;
  }
github stryker-mutator / stryker / packages / core / src / test-runner / RetryDecorator.ts View on Github external
if (attemptsLeft > 0) {
      try {
        return await this.innerRunner.run(options);
      } catch (error) {
        if (error instanceof OutOfMemoryError) {
          this.log.info(
            "Test runner process [%s] ran out of memory. You probably have a memory leak in your tests. Don't worry, Stryker will restart the process, but you might want to investigate this later, because this decreases performance.",
            error.pid
          );
        }
        await this.recover();
        return this.run(options, attemptsLeft - 1, error);
      }
    } else {
      await this.recover();
      return { status: RunStatus.Error, errorMessages: [`${ERROR_MESSAGE}${errorToString(lastError)}`], tests: [] };
    }
  }
github stryker-mutator / stryker / packages / karma-runner / src / StrykerReporter.ts View on Github external
private collectRunState(runResult: karma.TestResults): RunStatus {
    if (runResult.disconnected) {
      return RunStatus.Timeout;
    } else if (runResult.error) {
      return RunStatus.Error;
    } else {
      return RunStatus.Complete;
    }
  }
}
github stryker-mutator / stryker / packages / jasmine-runner / src / JasmineTestRunner.ts View on Github external
}).catch(error => ({
      errorMessages: [`An error occurred while loading your jasmine specs${EOL}${errorToString(error)}`],
      status: RunStatus.Error,
      tests: []
    }));
  }
github stryker-mutator / stryker / packages / core / src / Sandbox.ts View on Github external
private determineMutantState(runResult: RunResult): MutantStatus {
    switch (runResult.status) {
      case RunStatus.Timeout:
        return MutantStatus.TimedOut;
      case RunStatus.Error:
        return MutantStatus.RuntimeError;
      case RunStatus.Complete:
        if (runResult.tests.some(t => t.status === TestStatus.Failed)) {
          return MutantStatus.Killed;
        } else {
          return MutantStatus.Survived;
        }
    }
  }
github stryker-mutator / stryker / packages / mocha-runner / src / MochaTestRunner.ts View on Github external
mocha.run(() => {
            const reporter = StrykerMochaReporter.currentInstance;
            if (reporter) {
              const result: RunResult = reporter.runResult;
              resolve(result);
            } else {
              const errorMsg = 'The StrykerMochaReporter was not instantiated properly. Could not retrieve the RunResult.';
              this.log.error(errorMsg);
              resolve({
                errorMessages: [errorMsg],
                status: RunStatus.Error,
                tests: []
              });
            }
          });
        } catch (error) {