Debugging Unit Tests With Jasmine Test Runner

I am currently working on a project that uses Jasmine and Karma, we use the VS taskrunner to run the test with this command line:

cmd.exe /c grunt -b "C:\...\Gruntfile.js" karma

When I try to run the tests from the js files with the Resharper test runner, Jasmine pops up (with a different port than the grunt config) and says no spec found.  I understand it looks for a SpecRunner.html file, but we already have the spec in the grunt config.  (files array removed for brevity  It looks like this:

karma: {
unit: {
options: {
frameworks: ['mocha'],
reporters: ['spec'],
colors: true,
files: [...], 
runnerPort: 9876,
browsers: ['PhantomJS'],
//----- set this as true to run karma:unit once
singleRun: true
}
}
},

Is there any way to load the config from this grunt task into the ReSharper test runner?

Thanks!

-Todd Miller

 

 

 

 

0
2 comments
Avatar
Permanently deleted user

I got a little further with this by specifying a path to phantomjs.exe, rather than letting the browser pop up.  

 

Now I'm getting an error that the test timed out, looking at this:

 

https://youtrack.jetbrains.com/issue/RSRP-462494

 

0

you might want to try
https://marketplace.visualstudio.com/items?itemName=vs-publisher-999439.WallabyjsforVisualStudio2015 or
https://marketplace.visualstudio.com/items?itemName=vs-publisher-2795.ChutzpahTestRunnerContextMenuExtension
as they let you choose the port to run yours tests on and click on the line of code you want to debug (just as it it was C# code).
The benefit of Chutzpah is that you can run any part of a Jasmine (etc) unit test as it assume you are doing iterative Test Driven Development. As a side product the unit tests are presented in the ReSharper test runner just like any other unit tests. Resharper only is negligent when it comes to JS/Node/TS world, but you get used to a tool and everything being in place for that tool. 
Equally using wallaby to have a tsunami of intellisense at your finger tips.
Also in the json config when you start up a JS unit test project you can fix the port on which your test runner runs - all of this is covered in the Pluralsight course on seamless TDD in JS  with Wallaby (sadly an older version), but all tests will be fine in Resharper once done.

https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
https://app.pluralsight.com/course-player?clipId=e5304601-112a-4e56-993f-c7da0ad4dc38

0

Please sign in to leave a comment.