Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update mutation-testing-elements to v3.0.0 #4592

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"karma-webpack": "5.0.0",
"minimatch": "9.0.3",
"mocha": "10.2.0",
"mutation-testing-metrics": "2.0.5",
"mutation-testing-report-schema": "2.0.5",
"mutation-testing-metrics": "3.0.0",
"mutation-testing-report-schema": "3.0.0",
"rxjs": "7.8.1",
"semver": "7.5.4",
"svelte": "4.2.3",
Expand Down
3 changes: 1 addition & 2 deletions e2e/test/hit-limit/verify/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai';
import { Stryker } from '@stryker-mutator/core';
import { MutantStatus } from 'mutation-testing-report-schema/api';

describe('Limit counter', () => {
/**
Expand All @@ -11,7 +10,7 @@ describe('Limit counter', () => {
(only ? it.only : it)(`should limit infinite loops in the ${runner}-runner`, async () => {
const stryker = new Stryker({ testRunner: runner });
const results = await stryker.runMutationTest();
const timeoutResults = results.filter((res) => res.status === MutantStatus.Timeout);
const timeoutResults = results.filter((res) => res.status === 'Timeout');
expect(timeoutResults).lengthOf(3);
timeoutResults.forEach((result) => expect(result.statusReason).eq('Hit limit reached (501/500)'));
});
Expand Down
13 changes: 6 additions & 7 deletions e2e/test/ignore-project/verify/verify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect } from 'chai';
import { MutantStatus } from 'mutation-testing-report-schema';

import { expectMetricsJsonToMatchSnapshot, readMutationTestingJsonResult } from '../../../helpers.js';

Expand All @@ -19,15 +18,15 @@ describe('After running stryker on jest-react project', () => {
expect(conditionalExpressionMutants).lengthOf(3);
expect(equalityOperatorMutants).lengthOf(2);
booleanLiteralMutants.forEach((booleanMutant) => {
expect(booleanMutant.status).eq(MutantStatus.Ignored);
expect(booleanMutant.status).eq('Ignored');
expect(booleanMutant.statusReason).eq('Ignore boolean and conditions');
});
conditionalExpressionMutants.forEach((conditionalMutant) => {
expect(conditionalMutant.status).eq(MutantStatus.Ignored);
expect(conditionalMutant.status).eq('Ignored');
expect(conditionalMutant.statusReason).eq('Ignore boolean and conditions');
});
equalityOperatorMutants.forEach((equalityMutant) => {
expect(equalityMutant.status).eq(MutantStatus.NoCoverage);
expect(equalityMutant.status).eq('NoCoverage');
});
});

Expand All @@ -37,7 +36,7 @@ describe('After running stryker on jest-react project', () => {
const mutantsAtLine3 = circleResult.mutants.filter(({ location }) => location.start.line === 3);
expect(mutantsAtLine3).lengthOf(2);
mutantsAtLine3.forEach((mutant) => {
expect(mutant.status).eq(MutantStatus.Ignored);
expect(mutant.status).eq('Ignored');
expect(mutant.statusReason).eq('Ignored because of excluded mutation "ArithmeticOperator"');
});
});
Expand All @@ -55,9 +54,9 @@ describe('After running stryker on jest-react project', () => {
expect(mutantsAtLin13).lengthOf(1);
expect(mutantsAtLine18).lengthOf(1);
[...mutantsAtLine2, ...mutantsAtLin8, ...mutantsAtLin13].forEach((mutant) => {
expect(mutant.status).eq(MutantStatus.Ignored);
expect(mutant.status).eq('Ignored');
expect(mutant.statusReason).eq("We're not interested in console.log statements for now");
});
mutantsAtLine18.forEach((mutant) => expect(mutant.status).eq(MutantStatus.NoCoverage));
mutantsAtLine18.forEach((mutant) => expect(mutant.status).eq('NoCoverage'));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function createMutantResult(overrides?: Partial<MutantResult>): MutantRes
},
mutatorName: 'bazMutator',
replacement: 'baz',
status: MutantStatus.Killed,
status: 'Killed',
};
return { ...defaults, ...overrides };
}
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"node": ">=16.0.0"
},
"dependencies": {
"mutation-testing-metrics": "2.0.5",
"mutation-testing-report-schema": "2.0.5",
"mutation-testing-metrics": "3.0.0",
"mutation-testing-report-schema": "3.0.0",
"tslib": "~2.6.0",
"typed-inject": "~4.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/core/mutant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as schema from 'mutation-testing-report-schema/api';

export { MutantStatus } from 'mutation-testing-report-schema/api';
export type { MutantStatus } from 'mutation-testing-report-schema/api';

// We're reusing the `MutantResult` interface here to acquire uniformity.

Expand All @@ -21,7 +21,7 @@ export interface Mutant
*/
replacement: string;
/**
* The status if a mutant if known. This should be undefined for a mutant that still needs testing.
* The status of a mutant if known. This should be undefined for a mutant that still needs testing.
*/
status?: schema.MutantStatus;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
"lodash.groupby": "~4.6.0",
"log4js": "~6.9.0",
"minimatch": "~9.0.1",
"mutation-testing-elements": "2.0.5",
"mutation-testing-metrics": "2.0.5",
"mutation-testing-report-schema": "2.0.5",
"mutation-testing-elements": "3.0.1",
"mutation-testing-metrics": "3.0.0",
"mutation-testing-report-schema": "3.0.0",
"npm-run-path": "~5.1.0",
"progress": "~2.0.0",
"rxjs": "~7.8.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/mutants/incremental-differ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';

import { diff_match_patch as DiffMatchPatch } from 'diff-match-patch';
import chalk from 'chalk';
import { schema, Mutant, Position, Location, MutantStatus, StrykerOptions, FileDescriptions, MutateDescription } from '@stryker-mutator/api/core';
import { schema, Mutant, Position, Location, StrykerOptions, FileDescriptions, MutateDescription } from '@stryker-mutator/api/core';
import { Logger } from '@stryker-mutator/api/logging';
import { TestResult, TestStatus } from '@stryker-mutator/api/test-runner';
import { I, normalizeFileName, normalizeLineEndings, notEmpty } from '@stryker-mutator/util';
Expand Down Expand Up @@ -302,13 +302,13 @@ export class IncrementalDiffer {
// End users can use --force to force retesting of certain mutants
return true;
}
if (oldMutant.status === MutantStatus.Ignored) {
if (oldMutant.status === 'Ignored') {
// Was previously ignored, but not anymore, we need to run it now
return false;
}

const testsDiff = diffTestCoverage(mutant.id, oldCoverageTestKeysByMutantKey.get(mutantKey), coveringTests);
if (oldMutant.status === MutantStatus.Killed) {
if (oldMutant.status === 'Killed') {
if (oldKillingTests) {
for (const killingTest of oldKillingTests) {
if (testsDiff.get(killingTest) === 'same') {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/mutants/mutant-test-planner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class MutantTestPlanner {
} else if (this.options.ignoreStatic) {
// Static (w/o perTest coverage) and ignoreStatic is on -> Ignore.
return this.createMutantEarlyResultPlan(mutant, {
status: MutantStatus.Ignored,
status: 'Ignored',
statusReason: 'Static mutant (and "ignoreStatic" was enabled)',
isStatic,
coveredBy,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/process/4-mutation-test-executor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { from, partition, merge, Observable, lastValueFrom, EMPTY, concat, bufferTime, mergeMap } from 'rxjs';
import { toArray, map, shareReplay, tap } from 'rxjs/operators';
import { tokens, commonTokens } from '@stryker-mutator/api/plugin';
import { MutantResult, MutantStatus, Mutant, StrykerOptions, PlanKind, MutantTestPlan, MutantRunPlan } from '@stryker-mutator/api/core';
import { MutantResult, Mutant, StrykerOptions, PlanKind, MutantTestPlan, MutantRunPlan } from '@stryker-mutator/api/core';
import { TestRunner, CompleteDryRunResult } from '@stryker-mutator/api/test-runner';
import { Logger } from '@stryker-mutator/api/logging';
import { I } from '@stryker-mutator/util';
Expand Down Expand Up @@ -98,7 +98,7 @@ export class MutationTestExecutor {
private executeNoCoverage(input$: Observable<MutantRunPlan>) {
const [noCoverageMatchedMutant$, coveredMutant$] = partition(input$.pipe(shareReplay()), ({ runOptions }) => runOptions.testFilter?.length === 0);
const noCoverageResult$ = noCoverageMatchedMutant$.pipe(
map(({ mutant }) => this.mutationTestReportHelper.reportMutantStatus(mutant, MutantStatus.NoCoverage)),
map(({ mutant }) => this.mutationTestReportHelper.reportMutantStatus(mutant, 'NoCoverage')),
);
return { noCoverageResult$, coveredMutant$ };
}
Expand Down
22 changes: 10 additions & 12 deletions packages/core/src/reporters/clear-text-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { getEmojiForStatus, plural } from '../utils/string-utils.js';

import { ClearTextScoreTable } from './clear-text-score-table.js';

const { MutantStatus } = schema;

export class ClearTextReporter implements Reporter {
public static inject = tokens(commonTokens.logger, commonTokens.options);
constructor(
Expand Down Expand Up @@ -99,14 +97,14 @@ export class ClearTextReporter implements Reporter {
child.file?.mutants.forEach((result) => {
totalTests += result.testsCompleted ?? 0;
switch (result.status) {
case MutantStatus.Killed:
case MutantStatus.Timeout:
case MutantStatus.RuntimeError:
case MutantStatus.CompileError:
case 'Killed':
case 'Timeout':
case 'RuntimeError':
case 'CompileError':
this.reportMutantResult(result, this.writeDebugLine);
break;
case MutantStatus.Survived:
case MutantStatus.NoCoverage:
case 'Survived':
case 'NoCoverage':
this.reportMutantResult(result, this.writeLine);
break;
default:
Expand All @@ -120,7 +118,7 @@ export class ClearTextReporter implements Reporter {
}

private statusLabel(mutant: MutantModel): string {
const status = MutantStatus[mutant.status];
const { status } = mutant;
return this.options.clearTextReporter.allowEmojis ? `${getEmojiForStatus(status)} ${status}` : status.toString();
}

Expand All @@ -142,15 +140,15 @@ export class ClearTextReporter implements Reporter {
.forEach((line) => {
logImplementation(chalk.green('+ ' + line));
});
if (result.status === MutantStatus.Survived) {
if (result.status === 'Survived') {
if (result.static) {
logImplementation('Ran all tests for this mutant.');
} else if (result.coveredByTests) {
this.logExecutedTests(result.coveredByTests, logImplementation);
}
} else if (result.status === MutantStatus.Killed && result.killedByTests?.length) {
} else if (result.status === 'Killed' && result.killedByTests?.length) {
logImplementation(`Killed by: ${result.killedByTests[0].name}`);
} else if (result.status === MutantStatus.RuntimeError || result.status === MutantStatus.CompileError) {
} else if (result.status === 'RuntimeError' || result.status === 'CompileError') {
logImplementation(`Error message: ${result.statusReason}`);
}
logImplementation('');
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/reporters/dots-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import os from 'os';

import chalk from 'chalk';
import { Reporter } from '@stryker-mutator/api/report';
import { MutantResult, MutantStatus } from '@stryker-mutator/api/core';
import type { MutantResult } from '@stryker-mutator/api/core';

export class DotsReporter implements Reporter {
public onMutantTested(result: MutantResult): void {
let toLog: string;
switch (result.status) {
case MutantStatus.Killed:
case 'Killed':
toLog = '.';
break;
case MutantStatus.Timeout:
case 'Timeout':
toLog = chalk.yellow('T');
break;
case MutantStatus.Survived:
case 'Survived':
toLog = chalk.bold.red('S');
break;
case MutantStatus.RuntimeError:
case 'RuntimeError':
toLog = chalk.yellow('E');
break;
default:
Expand Down
Loading