How to use the @stryker-mutator/api/test_runner.RunStatus.Complete 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 / jest-runner / src / JestTestRunner.ts View on Github external
public async run(options: RunOptions): Promise {
    this.setNodeEnv();
    const { results } = await this.jestTestAdapter.run(
      this.jestConfig,
      process.cwd(),
      this.enableFindRelatedTests ? options.mutatedFileName : undefined
    );

    // Get the non-empty errorMessages from the jest RunResult, it's safe to cast to Array here because we filter the empty error messages
    const errorMessages = results.testResults
      .map((testSuite: jest.TestResult) => testSuite.failureMessage)
      .filter(errorMessage => errorMessage) as string[];

    return {
      errorMessages,
      status: results.numRuntimeErrorTestSuites > 0 ? RunStatus.Error : RunStatus.Complete,
      tests: this.processTestResults(results.testResults)
    };
  }
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 / core / src / test-runner / CommandTestRunner.ts View on Github external
function completeResult(exitCode: number | null, timer: Timer): RunResult {
        const duration = timer.elapsedMs();
        if (exitCode === 0) {
          return {
            status: RunStatus.Complete,
            tests: [
              {
                name: 'All tests',
                status: TestStatus.Success,
                timeSpentMs: duration
              }
            ]
          };
        } else {
          return {
            status: RunStatus.Complete,
            tests: [
              {
                failureMessages: [output.map(buf => buf.toString()).join(os.EOL)],
                name: 'All tests',
                status: TestStatus.Failed,
                timeSpentMs: duration
              }
            ]
          };
        }
      }
    });
github stryker-mutator / stryker / packages / api / testResources / module / useTestRunner.ts View on Github external
return new Promise(r => r({
      coverage,
      status: RunStatus.Complete,
      tests: [{
        failureMessages: [''],
        name: '',
        status: TestStatus.Failed,
        timeSpentMs: 23
      }]
    }));
  }
github stryker-mutator / stryker / packages / mocha-runner / src / StrykerMochaReporter.ts View on Github external
this.runner.on('end', () => {
      this.runResult.status = RunStatus.Complete;
      StrykerMochaReporter.log.debug('Mocha test run completed: %s/%s passed', this.passedCount, this.runResult.tests.length);
    });
  }
github stryker-mutator / stryker / packages / jasmine-runner / src / JasmineTestRunner.ts View on Github external
jasmineDone() {
          resolve({
            errorMessages: [],
            status: RunStatus.Complete,
            tests
          });
        }
      };
github stryker-mutator / stryker / packages / wct-runner / src / WctTestRunner.ts View on Github external
public async run(): Promise {
    this.reporter.results = [];
    try {
      await steps.runTests(this.context).catch(WctTestRunner.ignoreFailedTests);
      return {
        status: RunStatus.Complete,
        tests: this.reporter.results
      };
    } catch (error) {
      return {
        errorMessages: [error.stack],
        status: RunStatus.Error,
        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 / karma-runner / src / KarmaTestRunner.ts View on Github external
private cleanRun() {
    this.currentTestResults = [];
    this.currentErrorMessages = [];
    this.currentCoverageReport = undefined;
    this.currentRunStatus = RunStatus.Complete;
  }