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

Implementation of mutation levels #4686

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b039851
Merge pull request #11 from stryker-mutator/master
dvcopae Oct 21, 2023
dfe19e2
Merge branch 'stryker-mutator:master' into master
dvcopae Nov 14, 2023
87c8be4
Base structure for selecting operators individually (#14)
dvcopae Nov 14, 2023
9ec5d92
#18 restrict arraydeclaration mutator (#40)
Ja4pp Nov 21, 2023
f9fbcf6
#23 restrict equalityoperator mutator (#41)
brokhiv Nov 22, 2023
e4830b4
#21 booleanliteral (#44)
Luctia Nov 24, 2023
b152138
#20 assignment operator (#46)
Luctia Nov 24, 2023
4d8db03
Add restriction for string literals (#43)
dvcopae Nov 26, 2023
5a7c317
Restrict optional chaining mutator (#45)
dvcopae Nov 26, 2023
9f9d0c7
Change mutation level specification style (#56)
dvcopae Dec 4, 2023
240614c
Read default levels v2 (#60)
dvcopae Dec 4, 2023
6b7d9a2
Restricted logical-operator-mutator.ts (#57)
brokhiv Dec 5, 2023
b91605f
#22 restrict conditionalexpression mutator (#55)
Ja4pp Dec 5, 2023
69138fa
25 restrict methodexpression mutator (#54)
brokhiv Dec 5, 2023
44378ef
29 restrict unaryoperator mutator (#53)
brokhiv Dec 5, 2023
7ac2587
#30 restrict updateoperator mutator (#51)
Ja4pp Dec 5, 2023
1523566
Added support for arrowfunction (#47)
Luctia Dec 5, 2023
ff9c4c3
#63 implement objectliteral mutator (#65)
Ja4pp Dec 6, 2023
0ad71de
Refactor mutators (#64)
dvcopae Dec 6, 2023
6629ef6
Implement mutationLevel construct BlockStatement (#66)
Ja4pp Dec 7, 2023
4043abe
implement MutationLevel construct for Regex (#67)
Ja4pp Dec 7, 2023
a66eb01
Rename mutators & enhance NodeMutatorConfiguration type (#68)
dvcopae Dec 9, 2023
c9a232f
#48 ensure code consistency between mutators tests (#75)
Ja4pp Jan 11, 2024
c0f00a8
Finish building the mutation level (#76)
dvcopae Jan 14, 2024
1ec2e3a
Provide means to calculate adjusted mutation score and implement into…
Luctia Jan 14, 2024
772c596
#72 clean up code create pr (#80)
Ja4pp Jan 16, 2024
3bb1e3b
E2e test (#82)
dvcopae Jan 16, 2024
073b2ad
#72 final touches to improve mergeability (#83)
Ja4pp Jan 16, 2024
b111450
Merge branch 'master' into master
dvcopae Jan 16, 2024
69adeba
Fix up eslintignore (#84)
dvcopae Jan 16, 2024
419d28b
Documentation (#74)
brokhiv Jan 27, 2024
905f413
Pr feedback (#85)
dvcopae Jan 27, 2024
6ef29d5
Merge branch 'stryker-mutator:master' into master
dvcopae Jan 29, 2024
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
3 changes: 2 additions & 1 deletion e2e/test/ignore-project/stryker.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"concurrency": 2,
"coverageAnalysis": "perTest",
"mutator": {
"excludedMutations": ["ArithmeticOperator", "BlockStatement"]
"includedMutations": ["@StringLiteral", "@ConditionalExpression", "@EqualityOperator", "@LogicalOperator", "@BooleanLiteral"],
"excludedMutations": ["@ArithmeticOperator", "BlockStatementRemoval"]
},
"reporters": [
"clear-text",
Expand Down
27 changes: 25 additions & 2 deletions e2e/test/ignore-project/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,37 @@ describe('After running stryker on jest-react project', () => {
});
});

it('should report mutants that result from excluded mutators with the correct ignore reason', async () => {
it('should report mutants that are excluded from the excludedMutation list with the correct ignore reason', async () => {
const report = await readMutationTestingJsonResult();
const circleResult = report.files['src/Circle.js'];
const mutantsAtLine3 = circleResult.mutants.filter(({ location }) => location.start.line === 3);
expect(mutantsAtLine3).lengthOf(2);
mutantsAtLine3.forEach((mutant) => {
expect(mutant.status).eq('Ignored');
expect(mutant.statusReason).eq('Ignored because of excluded mutation "ArithmeticOperator"');
expect(mutant.statusReason).eq('Ignored by level');
});
});

it('should report mutants that are excluded because they were not in the includedMutations list', async () => {
const report = await readMutationTestingJsonResult();
const addResult = report.files['src/Add.js'];
const mutantsAtLine7 = addResult.mutants.filter(({ location }) => location.start.line === 7);
const updateOperatorMutants = mutantsAtLine7.filter(({ mutatorName }) => mutatorName === 'UpdateOperator');

const mutantsAtLine14 = addResult.mutants.filter(({ location }) => location.start.line === 14);
const unaryOperatorMutants = mutantsAtLine14.filter(({ mutatorName }) => mutatorName === 'UnaryOperator');

expect(updateOperatorMutants).lengthOf(1);
expect(unaryOperatorMutants).lengthOf(1);

updateOperatorMutants.forEach((updateMutant) => {
expect(updateMutant.status).eq('Ignored');
expect(updateMutant.statusReason).eq('Ignored by level');
});

unaryOperatorMutants.forEach((updateMutant) => {
expect(updateMutant.status).eq('Ignored');
expect(updateMutant.statusReason).eq('Ignored by level');
});
});

Expand Down
12 changes: 6 additions & 6 deletions e2e/test/ignore-project/verify/verify.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
exports[`After running stryker on jest-react project should report expected scores 1`] = `
Object {
"compileErrors": 0,
"ignored": 32,
"killed": 8,
"mutationScore": 50,
"ignored": 34,
"killed": 6,
"mutationScore": 42.857142857142854,
"mutationScoreBasedOnCoveredCode": 100,
"noCoverage": 8,
"pending": 0,
"runtimeErrors": 0,
"survived": 0,
"timeout": 0,
"totalCovered": 8,
"totalDetected": 8,
"totalCovered": 6,
"totalDetected": 6,
"totalInvalid": 0,
"totalMutants": 48,
"totalUndetected": 8,
"totalValid": 16,
"totalValid": 14,
}
`;
2 changes: 1 addition & 1 deletion e2e/test/reporters-e2e/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ describe('Verify stryker has ran correctly', () => {
const createTestsRegex = () => /All tests\s*AddSpec\.js\s*\s*✓ Add should be able to add two numbers \(killed 2\)/;
const createNoCoverageMutantRegex = () => /\[NoCoverage\]/;
const createSurvivedMutantRegex = () => /\[Survived\]/;
const createClearTextTableSummaryRowRegex = () => /All files\s*\|\s*64\.00\s*\|\s*16\s*\|\s*0\s*\|\s*1\s*\|\s*8\s*\|\s*0\s*\|/;
const createClearTextTableSummaryRowRegex = () => /All files\s*\|\s*64\.00\s*\|\s*64\.00\s*\|\s*16\s*\|\s*0\s*\|\s*1\s*\|\s*8\s*\|\s*0\s*\|/;
23 changes: 19 additions & 4 deletions package-lock.json

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

Loading