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

feat(instrumenter/mutators): Implement missing AssignmentOperatorMutator #3203

Merged
merged 8 commits into from
Oct 20, 2021

Conversation

Qvdpost
Copy link
Contributor

@Qvdpost Qvdpost commented Oct 14, 2021

This pull request contains the missing AssignmentOperatorMutator implemented for:
'+=' = '-=',
'-=' = '+=',
'=' = '/=',
'/=' = '
=',
'%=' = '*=',
'<<=' = '>>=',
'>>=' = '<<=',
'&=' = '|=',
'|=' = '&=',
'&&=' = '||=',
'||=' = '&&=',
'??=' = '&&=',

This list also contains the '??=' which is not present in the Stryker-js documentation. We are not sure how the documentation should be updated to reflect this change, given that the operator might be specific to JavaScript.
@nicojs

Breaks :
instrumenter integration
should not place disabled mutants:

  AssertionError: expected value to match snapshot instrumenter integration should not place disabled mutants 1
  + expected - actual


  at arrangeAndActAssert (test/integration/instrumenter.it.spec.ts:126:41)
  at Context.<anonymous> (test/integration/instrumenter.it.spec.ts:52:5)

@nicojs
Copy link
Member

nicojs commented Oct 15, 2021

Great to see such a complete PR. Great job. Got some small remarks.

Fix the build:

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

This is a formatting check, you can use npm run lint:fix from the root. That should fix it.

  AssertionError: expected value to match snapshot instrumenter integration should not place disabled mutants 1
  + expected - actual


  at arrangeAndActAssert (test/integration/instrumenter.it.spec.ts:126:41)
  at Context.<anonymous> (test/integration/instrumenter.it.spec.ts:52:5)

To fix that, you can update the snapshots. Use CHAI_JEST_SNAPSHOT_UPDATE_ALL=true npm run test from the instrumenter package. That updates the snapshots. Probably this mutator added a mutation.

@Qvdpost
Copy link
Contributor Author

Qvdpost commented Oct 18, 2021

Thank you for the suggestions!

We applied each of your remarks to the best of our understanding. All tests now pass (yay!).

Please let us know if there are any other issues that need be resolved.

Regards,
Lily & Quinten

@@ -75,7 +75,7 @@ function factorial(num) {

while (stryMutAct_9fa48(\\"13\\") ? i > num : stryMutAct_9fa48(\\"12\\") ? i < num : stryMutAct_9fa48(\\"11\\") ? false : (stryCov_9fa48(\\"11\\", \\"12\\", \\"13\\"), i <= num)) {
// Stryker disable next-line UpdateOperator: Infinite loop
o *= i++;
stryMutAct_9fa48(\\"15\\") ? o /= i++ : (stryCov_9fa48(\\"15\\"), o *= i++);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh haha. Great to see your mutation is being placed correctly 😅

Copy link
Member

@nicojs nicojs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

@nicojs nicojs enabled auto-merge (squash) October 20, 2021 15:24
@nicojs
Copy link
Member

nicojs commented Oct 20, 2021

One of the e2e tests failed, because we used a += and -= in that particular test project, which in turn changed the actual number of killed and survived mutants. I've updated it 🎉.

@LilyOSullivan
Copy link

Thank you for helping us fix it, and guiding us through the pull request! 🎉

@nicojs nicojs merged commit 95b694b into stryker-mutator:master Oct 20, 2021
@nicojs
Copy link
Member

nicojs commented Oct 22, 2021

LilyOSullivan added a commit to LilyOSullivan/mutation-testing-elements that referenced this pull request Oct 29, 2021
Document Stryker-JS only ??= operator (Logical nullish assignment). 
Added in pull request stryker-mutator#3203 in Stryker-JS repository. 
stryker-mutator/stryker-js#3203
nicojs pushed a commit to stryker-mutator/mutation-testing-elements that referenced this pull request Oct 29, 2021
…1476)

Document Stryker-JS only ??= operator (Logical nullish assignment). 
Added in pull request #3203 in Stryker-JS repository. 
stryker-mutator/stryker-js#3203
@nicojs
Copy link
Member

nicojs commented Nov 23, 2021

This feature just released in Stryker 5.5, see https://twitter.com/stryker_mutator/status/1463193759726948358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants