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

Stryker Equality ignore once not working #3812

Closed
Gurran opened this issue Oct 28, 2022 · 6 comments · Fixed by #3842
Closed

Stryker Equality ignore once not working #3812

Gurran opened this issue Oct 28, 2022 · 6 comments · Fixed by #3842
Labels
🚀 Feature request New feature request 👶 Good first issue Good for newcomers hacktoberfest https://hacktoberfest.digitalocean.com/

Comments

@Gurran
Copy link

Gurran commented Oct 28, 2022

image
image

Stryker Version:

"@stryker-mutator/core": "^6.2.3",
"@stryker-mutator/karma-runner": "^6.2.3",
"@stryker-mutator/typescript-checker": "^6.1.2",
@Gurran
Copy link
Author

Gurran commented Oct 28, 2022

// Stryker disable all followed by // Stryker restore all works

@Gurran
Copy link
Author

Gurran commented Oct 28, 2022

Even without the once keyword it still won't work

image

I've tried with Equality and equality

@nicojs
Copy link
Member

nicojs commented Oct 29, 2022

image

The name of the mutators is EqualityOperator.

Let's warn users when a mutator name doesn't match any of the enabled mutators.

@nicojs nicojs added 🚀 Feature request New feature request 👶 Good first issue Good for newcomers hacktoberfest https://hacktoberfest.digitalocean.com/ labels Oct 29, 2022
@Giovds
Copy link
Contributor

Giovds commented Nov 4, 2022

I've been working on a PoC for this feature and I could use some feedback.
My current implementation shows the following:

image

Which in it's turn reflects in the HTML:

image

A couple of questions:

  1. Is this solution what was expected of this feature, or did I misinterpret it?
  2. I wanted to introduce a new Status along the lines of Unknown, but this requires a change to the Schema which is probably used by more stryker projects? Not sure if I can just add something there without discussing it more broadly. Or is it acceptable to use Ignored for this?
  3. I'm also not happy with the diff view, but it seems like these are required with my current implementation (I'm currently (ab)using the Mutant class to get it to display in the clear-text-reporter). It doesn't really highlight the real error. It would be cool if I could create a diff where the Unknown Operator is highlighted and perhaps a close match can be suggested. Might be tricky though.

Thoughts?

P.S. The ignore reason does not seem to show either, I'll probably have to introduce some new logging to the clear text reporter :)
Something like this (assuming offset -1 is always the directive...):
image

@nicojs
Copy link
Member

nicojs commented Nov 5, 2022

I've been working on a PoC for this feature

😍

A couple of questions:

  1. Is this solution what was expected of this feature, or did I misinterpret it?

Well, having it end up in the report itself is nice, but a lot of work. I was thinking more along the lines of a warning message being logged.

image

What do you think about this message?

"Unused 'Stryker disable' directive. Mutator with name 'Equality' was not found. Directive found at: src/foo:23:1"

  1. I wanted to introduce a new Status along the lines of Unknown, but this requires a change to the Schema which is probably used by more stryker projects? Not sure if I can just add something there without discussing it more broadly. Or is it acceptable to use Ignored for this?

Yeah, introducing a new status is a lot of work and is technically a breaking change. We should be hesitant to add new.

  1. I'm also not happy with the diff view, but it seems like these are required with my current implementation (I'm currently (ab)using the Mutant class to get it to display in the clear-text-reporter). It doesn't really highlight the real error. It would be cool if I could create a diff where the Unknown Operator is highlighted and perhaps a close match can be suggested. Might be tricky though.

Wow yes, definitely. Like the HTML reporter does? Feel free to open an issue for that 😍. You might even be able to share code between mutation-testing-elements (or mutation-testing-metrics) and Stryker, but at least you will be able to copy the code: https://github.com/stryker-mutator/mutation-testing-elements/blob/8702f65404bb05aa90d5b9f3d134312d91cd4cd9/packages/elements/src/lib/code-helpers.ts#L320

@Giovds
Copy link
Contributor

Giovds commented Nov 5, 2022

I'll stash the changes for adding them to the report itself, though it does not differ to much from logging it as a warning. It works, but perhaps I made it to difficult so I would love some feedback on it. I'll open the PR for it.

"Unused 'Stryker disable' directive. Mutator with name 'Equality' was not found. Directive found at: src/foo:23:1"

Sounds good to me.

Wow yes, definitely. Like the HTML reporter does? Feel free to open an issue for that 😍. You might even be able to share code between mutation-testing-elements (or mutation-testing-metrics) and Stryker, but at least you will be able to copy the code: https://github.com/stryker-mutator/mutation-testing-elements/blob/8702f65404bb05aa90d5b9f3d134312d91cd4cd9/packages/elements/src/lib/code-helpers.ts#L320

👍 I'll write an issue for it. Not sure what exactly you mean with like the HTML reporter does? I assume that you get a clickable preview of the mutation but in this case a suggestion with a close match?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request 👶 Good first issue Good for newcomers hacktoberfest https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants