Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Add code coverage to QUnit tests #1124

Conversation

interactivellama
Copy link
Contributor

Fixes #1081 in that it will fail if the coverage decreases. Current threshold is 68 in individual controls and 81 as an average overall. If you add functionality, you will need to add unit tests now for tests to pass.

Issues:

  • The tests were being run without the test server starting up. The main server serving the files was being used for testing instead.
  • Coverage cannot be checked when testing dist.
  • Coverage cannot be tested when testing /test/*.html (no server).

Needed changes:

  • QUnit runs global variables test and test on dist (when needed)
  • Blanket QUnit runs source file tests with code coverage. Threshold has been set to 1%, so that it can ignored and that tests would still pass.
  • Remove references to lib folder in watch task
  • Add all tests to serve task and make it "do everything."
  • Add a serveslow task to do all tests on source without building dist
  • Rename qunit:simple to qunit:source for accuracy
  • Add length of time to aid developers in choosing a serve task
  • Remove 'feulux-' filename prefix from tests, and add tests.html as a default file when serving.
  • Re-order tests, so that blanket_qunit will fail first. Globals hardly ever fails for obvious reasons.

@interactivellama interactivellama force-pushed the blanket-code-coverage-and-serve branch from e552c95 to ad298cd Compare February 23, 2015 17:47
@cmcculloh-kr cmcculloh-kr self-assigned this Feb 23, 2015
@@ -546,12 +574,14 @@ module.exports = function (grunt) {

if (!grunt.option('no-tests')) {
grunt.task.run(['releasetest']);
//delete any screenshots that may have happened if it got this far. This isn't foolproof because it relies on the phantomjs server/page timeout, which can take longer than this grunt task depending on how long saucelabs takes to run...
// Delete any screenshots that may have happened if it got this far. This isn't foolproof

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's up with splitting this onto multiple lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't read it. It went off the page. I don't have line wrap on, do you? I thought we typically tried to keep code to 80 characters, so it doesn't wrap. I looked into the styleguide and didn't see any mention of line length. Maybe we we should add a recommendation?

The 80 standard length due to IBM punch cards, but in magazines articles, for instance, I don't think columns are supposed to be over 9 words for readability. You also have to scroll within this GH interface and on your phone farther.

http://stackoverflow.com/questions/903754/do-you-still-limit-line-length-in-code

@interactivellama interactivellama force-pushed the blanket-code-coverage-and-serve branch 2 times, most recently from dda0ef4 to 27c91b6 Compare February 24, 2015 19:00
- QUnit runs global variables test and test on dist (when needed)
- Blanket QUnit runs source file tests with code coverage. Threshold has been set to 1%, so that it can be ignored and that tests would still pass.
- Remove references to `lib` folder in watch task
- Add all tests to `serve` task and make it "do everything."
- Add a `serveslow` task to do all tests on source without building dist
- Rename qunit:simple to qunit:source for accuracy
- Add length of time to aid developers in choosing a serve task
- Remove 'feulux-' filename prefix from tests, and add tests.html as a default file when serving.
- Re-order tests, so that `blanket_qunit` will fail first. Globals hardly ever fails for obvious reasons.
@interactivellama interactivellama force-pushed the blanket-code-coverage-and-serve branch from 27c91b6 to 1593961 Compare February 25, 2015 20:01
cmcculloh-kr pushed a commit that referenced this pull request Feb 25, 2015
…and-serve

Refactor QUnit with code coverage
@cmcculloh-kr cmcculloh-kr merged commit b372f4e into ExactTarget:master Feb 25, 2015
@interactivellama interactivellama added this to the 3.6.3 milestone Feb 26, 2015
@interactivellama interactivellama changed the title Refactor QUnit with code coverage Add code coverage to QUnit tests Feb 26, 2015
@interactivellama interactivellama deleted the blanket-code-coverage-and-serve branch June 15, 2015 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up Blanket/Qunit to output code coverage to console.
3 participants