MBielski
MBielski

Reputation: 6620

Include custom Dojo modules in Intern coverage

I'll apologize now because I am very new to Intern and know just enough to know that I don't know anywhere near enough. I am using the latest version of Intern. I see lots of details about how to exclude files from the coverage reports that Intern generates, but nothing on what it includes in coverage by default, and now to get other things included. Intern already instruments and provides coverage reports on the test files that I run, but that doesn't do me any good. I need to I have several custom Dojo modules that need to be instrumented for coverage, but I can't seem to find how to make that happen. I am only running functional tests at this time.

The website under test is being served by local IIS, but the test files are in a completely different folder. Be default, it appears that Intern is instrumenting the test files and showing me nice reports about how much of my tests were covered in the run. Seeing this, my thought was that I needed to move all of the Intern install and configuration to the local IIS folder, which I did. Intern is still only providing coverage reports for the test files and not the Dojo modules.

Folder structure in IIS

wwwroot
  |
  --js
     |
     --Chai
     --ckeditor
     --myScripts
     --dojo
     --node_modules
     Gruntfile.js
     internConfig.js
     package.json

I need the files in the myScripts folder instrumented for code coverage. Here is what I am excluding:

excludeInstrumentation: /^(?:Chai|node_modules|ckeditor|dojo)\//

It appears that nothing in those folders is being is instrumented, so at least I have that right. I don't have anything defined under loaderOptions at this time, and I'm not entirely sure that that is where the stuff in the myScripts folder should be listed when it comes to functional testing. So, the question is how do I get the stuff in that folder instrumented for code coverage?

Upvotes: 0

Views: 75

Answers (1)

C Snover
C Snover

Reputation: 18766

In order to be instrumented, code need to be requested from the HTTP server that Intern creates when you run intern-runner. If you are loading code directly from IIS, it will never be instrumented and no code coverage analysis can be performed. If you need to use IIS instead of the built in server, you will also need to configure IIS to reverse proxy requests for these files to Intern, as described in the testing non-CORS APIs documentation.

Upvotes: 1

Related Questions