Closed aviadbd closed 5 years ago
Hi @aviadbd , thanks reporting this issue.
Could you provide is with some more information? I've never used Meteor myself, could you explain how your build process works? I'm assuming that this line of code import {HTTP} from 'meteor/http';
comes from your code somewhere. NodeJS does not support import
statements yet, so what kind of transpiler are you using? Babel? Webpack?
Hi @nicojs
Meteor has its own package manager, uses import
and in fact wraps npm packages in a way that allows you to import
them too.
Meteor is its own transpiler, for that matter, as it builds from your source a node.js project and runs/deploys it.
Ok, but the tests are clearly running on plain node, seeing the nodejs function wrapper siganture here: (function (exports, require, module, __filename, __dirname)
. It seems to me that meteor doesn't use the mocha test runner, but something like karma instead. Can you confirm this? Could you maybe provide a small test project for us that looks like your application (meteor + es6 + a way to run the tests)?
Maybe I didn't explain well?
When I run tests using Meteor, it complies (transpiles?) the sources correctly and then uses a test driver to run the tests. It can use many test drivers packaged for the task, specifically I use Mocha.
Please see a great example as the Todos App, at https://github.com/meteor/todos/ .
An example test, using Mocha and Chai (the recommended setup at Meteor's own site), could be found here: https://github.com/meteor/todos/blob/master/imports/api/lists/server/lists.tests.js
Ok, thanks for your additional explanation. I want to take a closer look when i get some time (which is hopefully by the end of this week). For the time being, you could try to run stryker on the intermediary files that meteor transpiles for you.
Basically what needs to happen is that every mutation to the source file gets transpiled by stryker using meteor (or whatever bundler meteor internally uses), before running it through mocha.
I'm not sure that's actually possible, as I'm not sure the transpiled project keeps the same structure of the original project; therefore, choosing the files to mutate might prove hard.
I can wait a week or two. Please tell me if you want me to check something.
@aviadbd Could you see what happens if you use https://www.npmjs.com/package/stryker-javascript-mutator in the project? (This probably won't mean we support your project. I'm just curious what happens)
@simondel I'm trying to understand why it would be any different; its still running on code that has dependencies that can't be found (the Meteor dependencies). Am I wrong?
We have decided that we won't focus on building Meteor support. Would you be willing to build this yourself or shall we close this issue?
Hey Guys,
Found a solution by mocking the Meteor Framework :)
I created a repo for this.
You can check it out at https://github.com/gugacavalieri/stryker-meteor-integration
Many thanks to https://github.com/pcorey/unit-testing-with-testdouble
@gugacavalieri awesome you were able to pull it off! I see you're trying to setup the mutation score badge. If you're having trouble with it, please don't hesitate to drop us a line at gitter: https://gitter.im/stryker-mutator/stryker
@nicojs Thanks ! Will check again why it is not rendering and let you know :smile:
As a workaround is available, I'm closing this issue for now.
I'm working with Meteor, testing with Mocha, and would really love to use Stryker.
Problem is, since Stryker is its own runner, it won't find any Meteor packages (or so it seems):
Any ideas on how to make it work?