-
Notifications
You must be signed in to change notification settings - Fork 250
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
I am not able to run striker on requirejs project #168
Comments
Did you load requirejs in your stryker.conf.js? How would you load requirejs in your normal karma.conf.js setup? Is it with a plugin? Or is it in the files list? |
Hm. I am not sure I load requirejs in stryker.conf.js. Here is it:
Sure I run my tests (I am doing it with karma) with requirejs plugin. The reason why I didn't enable requirejs in stryker is: I didn't find it on this page: https://www.npmjs.com/search?q=stryker-plugin Is requirejs is build in plugin? How can I use it then? How I can enbale requirejs support? Should I just add it to path? As I understand there: #159 |
Oooh ok. I have to use this: https://www.npmjs.com/package/stryker-karma-runner I am trying this at the moment. |
I copypasted files from my karma.conf.js. Here is my stryker.conf.js:
My main.js:
So ngRoute is core dependency in main.js. But actually it seems to me I don't get into the main.js file.... I put console.log in it and don't see anytying in the output. |
You are on the right track. Indeed, right now its not possible to make stryker use your I am on the road right now, i will take a look and respond in a few hours. |
Ok so I did good. Am I right in this opinion: files to be mutaded (my source files) must be in filesToMutate property, right? Looks like I am on the correct way. Also look this. This is loading of karma page with stryker: And here is without it: In stryker case I am getting error about ngRoutes and ngMocks. ngRoutes and ngMocks are RequireJS modules wich are defined in core-all.js file. This file is not loaded in stryker case thats why I am getting error about ngMocks (or ngRoute - it floats). Why it is not loading? How I can load it before main.js? |
Looks like stryker and karma parse files property differently. I am talking about this block:
I need next line, obviously, to get all these files indexed by karma server (so they are available under
So karma load core-all.js, add all files to index, define ngRoute and ngMocks modules and when main.js is requiring them everything is ok. If I remove this line I wouldn't be able to bootstrap my core framework (because I need all files under Ok, what is in case of stryker. Looks like stryker parse files option in different way. If I have this in conf:
Then files core-all.js and components are not loaded. Probably this happens because I have included: false on paths So if I remove this lines I see that core-all.js and components-all.js are loading, but application is not able to bootstrap because there are no mandatory files under What do you think about it? Also, is there any property like |
You can either use that property, or use the object literal to mark files to be mutated as described here: https://github.com/stryker-mutator/stryker/blob/master/README.md#all-files |
OK. I got about |
I think i know what the issue is. Indeed, it has to do with the file list. Consider these 2 lines: 'test/units/tools/ng-core/core-all.js',
{ pattern: 'test/units/tools/ng-core/**/*.*', included: false }, The second pattern will localize the Can you try to write your patterns in such a way that you won't define a file twice? Just to see if that fixes the issue? I tried to use requirejs+karma+stryker myself and ran into the same issue. You can see it working here: https://github.com/nicojs/karma-requirejs-stryker First i had these patterns: { pattern: 'relative/**/*.js', mutated: true, included: false },
{ pattern: 'test-main.js', mutated: false, included: true },
{ pattern: '*.js)', mutated: false, included: false }, As you can see, test-main.js would be located twice. Once by the second pattern and once by the third. Then i rewrote it like this: { pattern: 'relative/**/*.js', mutated: true, included: false },
{ pattern: 'test-main.js', mutated: false, included: true },
{ pattern: '+(dependency.js|legacy-library.js|test.js)', mutated: false, included: false }, Now it works. |
I already tried this but I had strange problem. If I remove line
It didnt' work too. Now I want to debug script execution. I want to see files in I need this to check window.karma.files property contents. I need to check if If I debug karma-runner (without stryker) - everything is ok. Do you know why I am not able to debug main.js? Note that if I put debugger in grunt configuration - debugger stops on this breakpoint. |
|
I'm not sure what your debug procedure is. Stryker currently always runs test runners in a child process, so that might hinder debugging. This is so we can upscale to multiple instances when starting to test actual mutants. You can see the output of the child processes when you set loglevel to trace: I've created #172 for the duplicate files. I also created stryker-mutator/stryker-karma-runner#7 for the reading of the karma.conf file and related bug #148 to that one as well. If these 3 bugs are fixed, it might work for you right out of the box :) We're also working on a major release which would change the way the initial test run is done, see progress here: #165 |
Debug procedure... Hm. I will try to explain :) Imagine you are creating 1-3 line application :) You have document, you add DOMContentLoaded event listener on it. So your code is:
Now when you open this page in browser in debug mode (when Developer Tools is opened (or FireBug)) script execution will stop on this breakpoint So when I say And when I run karma runner and stryker above it I am not able to debug main.js. This is the problem. I don't know how to explain more correctly. I can make a video :) (I am not trolling or joking sry, I know I have bad english and it is therefore you didn't understand me). |
A-ha! I just understood what is the problem there. Karma runner has property proxies. When karma doesn't find field it checks property proxies and parts in it for requested file. If no, you will get 404. Do you have option like proxies in stryker? |
Finally!
Now I am getting all libraries, all tests (main.js) and require all modules they test. Really beautifull. I have another problem: it looks like test page is reloading. When I watch net traffic I see page is reloading right after all modules to test were required. UPD Do you want what is it? |
@sharikovvladislav very cool you got it working! I'm really happy, its been a fruitful exercise as we now have a few more valuable issues. We will be fixing them in the coming weeks. Maybe you want to verify them as we fix them? The idea is that it should work out-of-the-box in the near future. Wow! 2000 tests! That's awesome! No, loading the page 2001 times is not what we want, but its how it is implemented right now. For reasons why: see github.com//issues/142#issuecomment-244852473. You can disable this with We'll be releasing the next major version: 0.5 of Stryker somewhere in the next weeks. You can see progress here: #165. That release will make the initial test run collect coverage reports in one pass of the test runner. So 1 page load instead of 2001 in your case. So please be patient as we fix this issue :) |
@nicojs Sure I will try to review fixed issues as soon as possible. About deduplicating files. I think it is really must have feature. I have 12 items in files block instead of 4 lines (like in karma conf file). About 2001 tests. The problem is not only in 2001 tests. The problem is application is about 100 files and these 100 files is requiring by requirejs each it. Also what about no debug ability? Do you have ideas how to fix this problem? I have another problem :) I tried mutation testing on small test case (about 10 it Do you have some small tasks to implement (in stryker)? I can try to help somewhere with them. |
This is #172
How long does a normal karma run take? We can do optimisations in Stryker. Namely running multiple instances of Karma at once and analysis on code coverage to see which tests we need to run. We'll see how fast it will be. At the very least you'll have the progress reporter to report progress to you.
Yes we have: #173
It should not remove mutated files from the base path. However, after the initial run and in the mutation run, all files are copied to a local
Yes, we have tons :). Maybe you can start with these: Be sure you can run |
I'll close this issue for now since we haven't heard anything anymore. If you still have issues, could you reopen it? Thanks! |
Hi,
I am getting this:
When I run stryker.
How I can manage this?
The text was updated successfully, but these errors were encountered: