How to use the @stryker-mutator/api/report.MutantStatus.Survived 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 / core / src / reporters / DotsReporter.ts View on Github external
public onMutantTested(result: MutantResult) {
    let toLog: string;
    switch (result.status) {
      case MutantStatus.Killed:
        toLog = '.';
        break;
      case MutantStatus.TimedOut:
        toLog = chalk.yellow('T');
        break;
      case MutantStatus.Survived:
        toLog = chalk.bold.red('S');
        break;
      case MutantStatus.RuntimeError:
        toLog = chalk.yellow('E');
        break;
      default:
        toLog = '';
        break;
    }
    process.stdout.write(toLog);
  }
github stryker-mutator / stryker / packages / html-reporter / src / templates / sourceFile.tsx View on Github external
const determineBackground = () => {
        if (currentCursorMutantStatuses.survived > 0) {
            return getContextClassForStatus(MutantStatus.Survived) + '-light';
        } else if (currentCursorMutantStatuses.noCoverage > 0) {
            return getContextClassForStatus(MutantStatus.NoCoverage) + '-light';
        } else if (currentCursorMutantStatuses.timeout > 0) {
            return getContextClassForStatus(MutantStatus.TimedOut) + '-light';
        } else if (currentCursorMutantStatuses.killed > 0) {
            return getContextClassForStatus(MutantStatus.Killed) + '-light';
        }
        return null;
    };
github stryker-mutator / stryker / packages / html-reporter / src / templates / sourceFile.tsx View on Github external
if (filtered.length) {
            return <div class="form-check form-check-inline">
                <label class="form-check-label">
                    <input type="checkbox" value="{state.toString()}" checked="{isChecked}" class="form-check-input stryker-display">
                    {MutantStatus[state]} {`(${filtered.length})`}
                </label>
            </div>;
        } else {
            return '';
        }
    }

    return <div class="row legend">
        <form novalidate="novalidate" class="col-md-12">
            {displayCheckbox(MutantStatus.NoCoverage, true)}
            {displayCheckbox(MutantStatus.Survived, true)}
            {displayCheckbox(MutantStatus.Killed, false)}
            {displayCheckbox(MutantStatus.TimedOut, false)}
            {displayCheckbox(MutantStatus.RuntimeError, false)}
            {displayCheckbox(MutantStatus.TranspileError, false)}
            <a class="stryker-collapse-expand-all" href="#">Expand all</a>
        </form>
    </div>;
}
github stryker-mutator / stryker / packages / core / src / ScoreResultCalculator.ts View on Github external
private countNumbers(mutantResults: MutantResult[]) {
    const count = (mutantResult: MutantStatus) => mutantResults.filter(_ => _.status === mutantResult).length;

    const killed = count(MutantStatus.Killed);
    const timedOut = count(MutantStatus.TimedOut);
    const survived = count(MutantStatus.Survived);
    const noCoverage = count(MutantStatus.NoCoverage);
    const runtimeErrors = count(MutantStatus.RuntimeError);
    const transpileErrors = count(MutantStatus.TranspileError);
    const totalDetected = timedOut + killed;
    const totalUndetected = survived + noCoverage;
    const totalCovered = totalDetected + survived;
    const totalValid = totalUndetected + totalDetected;
    const totalInvalid = runtimeErrors + transpileErrors;
    const totalMutants = totalValid + totalInvalid;
    const mutationScore = totalValid > 0 ? (totalDetected / totalValid) * 100 : defaultScoreIfNoValidMutants;
    const mutationScoreBasedOnCoveredCode = totalValid > 0 ? (totalDetected / totalCovered) * 100 || 0 : defaultScoreIfNoValidMutants;
    return {
      killed,
      mutationScore,
      mutationScoreBasedOnCoveredCode,
      noCoverage,
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 / core / src / reporters / ProgressKeeper.ts View on Github external
public onMutantTested(result: MutantResult): void {
    if (!this.mutantIdsWithoutCoverage.some(id => result.id === id)) {
      this.progress.tested++;
    }
    if (result.status === MutantStatus.Survived) {
      this.progress.survived++;
    }
    if (result.status === MutantStatus.TimedOut) {
      this.progress.timedOut++;
    }
  }
github stryker-mutator / stryker / packages / html-reporter / src / templates / sourceFile.tsx View on Github external
function getContextClassForStatus(status: MutantStatus) {
    switch (status) {
        case MutantStatus.Killed:
            return 'success';
        case MutantStatus.NoCoverage:
        case MutantStatus.Survived:
            return 'danger';
        case MutantStatus.TimedOut:
            return 'warning';
        case MutantStatus.RuntimeError:
        case MutantStatus.TranspileError:
            return 'secondary';
    }
}
github stryker-mutator / stryker / packages / core / src / reporters / MutationTestReportCalculator.ts View on Github external
private toStatus(status: MutantStatus): mutationTestReportSchema.MutantStatus {
    switch (status) {
      case MutantStatus.Killed:
        return mutationTestReportSchema.MutantStatus.Killed;
      case MutantStatus.NoCoverage:
        return mutationTestReportSchema.MutantStatus.NoCoverage;
      case MutantStatus.RuntimeError:
        return mutationTestReportSchema.MutantStatus.RuntimeError;
      case MutantStatus.Survived:
        return mutationTestReportSchema.MutantStatus.Survived;
      case MutantStatus.TimedOut:
        return mutationTestReportSchema.MutantStatus.Timeout;
      case MutantStatus.TranspileError:
        return mutationTestReportSchema.MutantStatus.CompileError;
      default:
        this.logUnsupportedMutantStatus(status);
        return mutationTestReportSchema.MutantStatus.RuntimeError;
    }
  }