How can I get source maps to work when running tests using ember-qunit for an ember app built on ember-cli - ember.js

I have an Ember app built using ember-cli and I'm writing my tests using the ember-qunit testing adapter and running them in the browser using testem as instructed in the ember-cli documentation. Although debugging in Google Chrome works fine when I'm interesting with my app, I am unable to use many debugging features such as breakpoints when running my tests.
I often run into a problem that my tests fail despite my actual app seeming to work properly, and to investigate the problem I would like to step through code while my tests are running.
But when I step into code that appears in vendor.js I just just see the following contents in my vendor.js:
// Please wait a bit.
// Compiled script is not shown while source map is being loaded!
These two lines are lines 6 & 7 of the file. The lines before this are blank, and these two lines are the last lines in the file. The debugger has the first line of the file highlighted as if that's the current location in the source, but it cannot show the source for some reason.
I can proceed to step through the code, but I can't see anything.
However, if I find vendor.js in the list of sources in the developer tools sources file list then it opens as a separate source tab and I can see all my code. At this point I have two tabs labeled vendor.js, one with all my vendor assets and one with just those line quoted above.
I am guessing that there is something different between how my tests are served and how my app is served in the development environment that is confusing Chrome.
I am using the following versions of things:
ember 1.9.1
ember-data 1.0.0-beta.14.1
ember-cli 0.1.9
qunit 1.17.1
ember-qunit 0.2.0
testem 0.6.33
Although I've poked around a bunch I don't really have any leads on where the problem is stemming from. Perhaps it's related to how testem is running the tests? Or could it be something that gets included in my tests has a messed up source map?
I appreciate any help or ideas.

I'm on ember-cli 0.2.2.
I ran across this problem as well and found this Chrome issue with processing sourcemaps.
People commenting on the issue suggest using the Chrome Canary build for now:
I'm currently using the Canary build to put breakpoints in and debug my ember code.
Get it here: https://www.google.com/chrome/browser/canary.html

Related

How to do Coverage exports for vscode extensions

I have seen a lot of tutorials how to make vscode extensions. Like:
https://code.visualstudio.com/docs/extensions/testing-extensions
And there is many tutorials how to do coverage exports, there many ways how to do it, but I didn't seen good examples which would follow the examples from their docs and work with vscode extensions (they need the extensionHost instead of nodejs).
I have all the tests written in the mocha which is bundled in the vscode as proposed by their documents.
I tried to experiment and I'm stuck, are there any hints or directions where I could continue and get my process working again?
The answer which worked is in the comments to my original question. But to simplify and boil down what had to be done, and what steps I did personally. Not all steps are really essential and required, but these steps made it pretty convient:
installed istanbul, istanbul-coveralls, gulp, gulp-json-editor, coveralls to my package as the DEV dependencies
included the MS supplied istanbul test runner for vscode extension testing into my tests
modified the tests to run an istanbul runner instead of mocha runner directly (the tests itself could stay as they are).
attached reference to the istanbul runner now I had to read the coverconfig.json to know how to do the coverage itself (what parts to ignore, where is source, where to output results, what formats the results should be etc...).
added coverage to gitignore and to vscode project as so they will not annoy me in the UI and will not polute the repo.
added few visual studio launchers/tasks to make it easier for me to trigger them from the UI
installed vscode plugin to display the coverage in the gutters: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters and then added to my project settings the "lcov.path": [ "coverage/lcov.info" ] (or whatever location you will have the line coverage) so the plugin can read and show the coverage directly in the UI.
setup gulp to delete old coverage results and start new ones on each run
added npm scripts for regular tests and for the coverage variant
changed travis steps so the coverage variant is running now instead of the generic non-coverage one. Added script step so the coveralls module is run and broadcasts the results from the coverage/lcov.info to the https://coveralls.io/ website. (i think signing in and doing the first-time setup is required to make it work on their website)
Now on each commit travis will do the work by itself and I can use coveralls banner inside my readme to give quick glipse how well is my coverage. And you can use gulp to watch it for changes and build/test locally and have fast feedback in the UI what lines were covered by your tests.
The setup is similar to the listed links:
https://github.com/Microsoft/vscode-mssql
https://github.com/kenhowardpdx/vscode-gist/pull/10

How to open Test Runner Tab in IntelliJ?

When i want to execute tests in intelliJ for javascript (Jasmine - karma) I have to open the IntelliJ console and digit the command as in a normal console (grunt karma:tests). I wait, and get all the test result. But in a GUI enviroment, running from command line is not the best. I can do that without need of IntelliJ.
In addition, in one target there are 900 unit tests, when i have to change one UT i have to wait 20 sec. Every time i make a change on one test, i have to run them all.
When an error is present, i have to read the output of the console, that is a nightmare.
That's REALLY very annoying.
In Eclipse it is quite easy to run tests from one page (without need of running all tests of a target), and every test is highlighted in red (failed) or green (passed).
I searched online, and seems that the equivalent for IntelliJ is "Test Runner Tab". I have it installed, i suppose, but... how to display it?
Where to click?
Thanks
Hej, I found the solution thanks to a collegue.
#Morfic: Yes. I searched in many places but the problem was Karma itself. Sometimes it's not difficult to find, but to search...
In short: the installation of karma used by IntelliJ must not be global - for what i understood. But seee the link at the bottom of my answer to have more details.
For me, it was enough to run the following command:
npm uninstall -g karma
I already had installed karma non-globally. Then in the settings of IntelliJ i choose the local installation.
After that, clicking on the "play" green button, the tests started magically, without need of any setting or searching any window.
If I woudn't have the non-global version installed I would need also the following command:
npm install karma --save-dev
More details are in the following:
karma plugin dependencies not being found

NCover not finding unit tests

I am trying to install NCover in an existing C# .NET project for work. Unfortunately, after I download NCover and installed the Visual Studio extension, it wasn't finding any of the unit tests. The answers I've seen/heard seem to be in the vain of 'It wasn't working...time passed...it started working.'
I can run the tests with Visual Studio's Test Explorer, but I need to get NCover installed to see the code coverage. I had NCover installed previously, and other people on my team are getting it to work within the same project.
I am using Visual Studio 2013 with the newest version of NCover Desktop (v 5.1).
I am getting two errors in the console log.
The first switches between saying:
Agent Error (v4x64): An error occurred while loading assembly
and
Agent Error (v4x64): There was a problem loading test assembly [test path]. Could not get bytes from loader AppDomain
The second (after I try to run NCover) says it 'Could not load config' for the test dll.
I copied the 4 XML config file (Bolt.ext.config, Bolt.Extension2008.dll.config, NCover.exe.config, ncover.axplorer.exe.config) from one of my team members, so I'm pretty sure that I have my config correct.
Has anyone else experience this/have any suggestions? Help would be greatly appreciated!
Further information:
When I hover over the grayed out test dll in the bolt test panel, I get the following error:
Assembly is not loaded. Select and run to build and load this assembly
I was looking at this post, but it doesn't seem like any of the solutions are working for me...
After working with some of the other developers in my office, we discovered the issue was with the NCover version. For our tests to run, we needed to use NCover v5.0. Neither v5.1 or v5.2 would work with our setup. Not sure what changed in v5.1 that wouldn't let it find the tests, but I'm glad it's working now :)

CUITe test execution fails under VS2015

Using CUITe testing framework in VS2012, I created a coded UI test. This test works as expected when right clicking the test, and hitting "run test" in VS2012.
We are in the process of migrating to VS2015, so I'm trying to go through our solutions to make sure they are behaving as expected. In this solutions case, we are running into an issue where when attempting to run a test, the output pane states:
There is no test with the specified Id (guid listed)
And no CUITe tests are run.
I have confirmed that normal coded UI tests are running in VS2015, it is specifically coded UI tests created using CUITe that are failing to run.
Don't know if anyone will have any workarounds for this, but I figured I'd give it a shot. I have additionally added all of the "Microsoft Testing" dlls to the solution in a separate folder, in order to ensure the solution is using the "specific versions" of the testing DLLs. This did not solve the problem.
The issue was due to CUITe not having been compiled/provided a build definition for VS2015.
In the current GitHub repo of CUITe (code plex URL from the original question no longer the "active link") provides a new build that addresses the issue.
Current URL for CUITe is:
https://github.com/icnocop/cuite
Issue was resolved here.

GGTS can't run grails unit tests: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

I've recently upgraded from Java 6 to Java 7, and changed the Grails version accordingly to 2.3.8. Everything compiles and runs fine from the command line.
But I'm finding my version of GGTS (3.5.1.RELEASE) won't run unit tests from within the editor. I get the error:
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
I've tried completely importing the project from scratch - no joy.
The problem applies only to Grails-specific tests in GGTS, not when I run them from the command line. It happens during the Grails initialisation registerBeans() call. Which is pulled in by the #TestFor annotation (no annotation, no problem).
Looking at other error reports with the same error, I see this seems to be something to do with versions of xml-apis. I've tried putting
compile('xml-apis:xml-apis:2.0.2')
in the grails.project.dependency.resolution ... dependencies section of BuildConfig.groovy, but it has no effect.
Any suggestions what I might do instead?
Charles
My Grails guru suggested simply moving to IntelliJ - a good, if slightly costly, approach.
But to my frustration I found a different, but similar, error in that environment too. I realised that IntelliJ imports the Eclipse editor settings for the project.
So the solution turned out to be to delete all the editor-specific files for the project, and regenerate it from the Groovy/Grails sources alone.
Charles