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

Support Mocha 8 #2274

Closed
Prophet32j opened this issue Jun 24, 2020 · 11 comments
Closed

Support Mocha 8 #2274

Prophet32j opened this issue Jun 24, 2020 · 11 comments
Labels
⁉ Question Further information is requested ☠ stale Marked as stale by the stale bot, will be removed after a certain time.

Comments

@Prophet32j
Copy link

Question

Are there plans to support Mocha 8?
I think I have issues with Mocha 8/Stryker 3.2.4 together. My code is well covered with boundaries and conditionals. All mutants survive. Even on module imports being String-literaled. I'm guessing this is a Mocha 8 issue since my other project with Mocha 7 and Stryker 2.5 working.

Stryker environment

+-- @stryker-mutator/[email protected]
+-- @stryker-mutator/[email protected]

Additional context

@Prophet32j Prophet32j added the ⁉ Question Further information is requested label Jun 24, 2020
@nicojs
Copy link
Member

nicojs commented Jun 27, 2020

Hi 👋 @Prophet32j

Could you try v3.3 of Stryker? We officially support mocha 8 since 3.3:

https://github.com/stryker-mutator/stryker/blob/epic/mutation-switching/CHANGELOG.md#330-2020-06-16

I'm missing @stryker-mutator/mocha-runner in your list of dependencies. Is this deliberate? If so, you're probably using the command test runner. That one should have worked with mocha 8 all along 😲

@maenu
Copy link

maenu commented Jul 10, 2020

I just updated to stryker v3.3.1 and it gives me:

npm WARN @stryker-mutator/[email protected] requires a peer of mocha@>= 2.3.3 < 8 but none is installed. You must install peer dependencies yourself.

The peer-dependency of mocha-framework indeed still refers to mocha < 8:

"peerDependencies": {
  "@stryker-mutator/core": "^3.0.0",
  "mocha": ">= 2.3.3 < 8"
}

While mocha-runner allows mocha < 9:

"peerDependencies": {
  "@stryker-mutator/core": "^3.0.0",
  "mocha": ">= 2.3.3 < 9"
}

@Prophet32j
Copy link
Author

Prophet32j commented Jul 10, 2020 via email

@Prophet32j
Copy link
Author

Ok. I have figured out why my tests would not run. Stryker doesn't like module-alias when importing modules.

const matchRelationships = require('../../src/er-studio/match-relationships')

vs

const matchRelationships = require('@src/er-studio/match-relationships')

For any tests that would use the aliased module reference, those tests would either time out or all mutants would live.

If there's no ability to load aliased modules, there should be some sort of NOTICE on the README to inform developers of that limitation.

Either that or I didn't correctly inform Stryker of aliased modules, but I fail to find any documentation on that.

@Prophet32j
Copy link
Author

@nicojs

@nicojs
Copy link
Member

nicojs commented Sep 16, 2020

Yeah, module aliassing does not play nice with Stryker. Allowing Stryker to mutate your code in-place will solve this issue, see #2163 .

Stryker doesn't like module-alias when importing modules

I'm not an expert on this subject. What is module-alias exactly? How does it work? If I knew what it was and how it works, I might be able to help you better here.

Either that or I didn't correctly inform Stryker of aliased modules, but I fail to find any documentation on that.

True, we're missing more extensive documentation, or FAQ for this. Please feel free to add it! I think the stryker-handbook might be the place for this documentation https://github.com/stryker-mutator/stryker-handbook/tree/master/stryker

@profplum700
Copy link

profplum700 commented Nov 23, 2020

I'm trying to get Stryker 4.1.2 running on a limited set of our unit tests. The Terminal output instruments the tests, starts the test run then produces an error that No tests were executed. Is this because our version of Mocha isn't supported, similar to this?

Here is a screenshot from stryker.log:
image

This is my stryker.conf.json:
{ "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json", "packageManager": "npm", "reporters": [ "html", "clear-text", "progress" ], "testRunner": "mocha", "coverageAnalysis": "perTest", "mutate": [ "v3/SquaredUp.App/PristinePackages/SCOM/Pages/**/*.js" ], "fileLogLevel": "trace" }

I am able to kick off all our unit tests using npm test. This has got me stumped.

I'm pretty new to this kind of thing so please let me know what other info you need and I'll get it!
@nicojs @simondel ?

@nicojs
Copy link
Member

nicojs commented Jan 25, 2021

@profplum700 could you please try again with the new --inPlace mode: https://stryker-mutator.io/docs/stryker/configuration/#inplace-boolean (just released in Stryker 4.4). This should solve your issues.

@profplum700
Copy link

@profplum700 could you please try again with the new --inPlace mode: https://stryker-mutator.io/docs/stryker/configuration/#inplace-boolean (just released in Stryker 4.4). This should solve your issues.

Thanks for the heads up. I won't be able to test it out as I've moved onto other work but I've made a note of it for the future.

@stale
Copy link

stale bot commented Jan 26, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the ☠ stale Marked as stale by the stale bot, will be removed after a certain time. label Jan 26, 2022
@nicojs
Copy link
Member

nicojs commented Jan 26, 2022

Mocha 8 is since supported.

@nicojs nicojs closed this as completed Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⁉ Question Further information is requested ☠ stale Marked as stale by the stale bot, will be removed after a certain time.
Projects
None yet
Development

No branches or pull requests

4 participants