diff options
author | Johann-S <johann.servoire@gmail.com> | 2018-03-06 08:35:28 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-03-06 08:35:28 +0300 |
commit | fb60a4a9867eb1fc18cf310de2bbb8f21e262e6b (patch) | |
tree | babc43cdec526b1bfce2b558bbc29f784d340714 /js/tests/README.md | |
parent | e43f97304eac2b276c755267e29de70ae2ac7afd (diff) |
Add a bit of documentation on how to run the code coverage (#25783)
Diffstat (limited to 'js/tests/README.md')
-rw-r--r-- | js/tests/README.md | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/js/tests/README.md b/js/tests/README.md index 88c35be402..23c5ff39df 100644 --- a/js/tests/README.md +++ b/js/tests/README.md @@ -27,16 +27,20 @@ To run the unit test suite via a real web browser, open `index.html` in the brow * Each test should begin with [`assert.expect`](https://api.qunitjs.com/assert/expect/) to ensure that the expected assertions are run. * Each test should follow the project's [JavaScript Code Guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#js) +## Code coverage + +Currently we're aiming for at least 80% test coverage for our code. To ensure your changes meet or exceed this limit, run `npm run js-compile && npm run js-test` and open the file in `js/coverage/lcov-report/index.html` to see the code coverage for each plugin. See more details when you select a plugin and ensure your change is fully covered by unit tests. + ### Example tests -```javascript +```js // Synchronous test QUnit.test('should describe the unit being tested', function (assert) { assert.expect(1) - var templateHTML = '<div class="alert alert-danger fade show">' - + '<a class="close" href="#" data-dismiss="alert">×</a>' - + '<p><strong>Template necessary for the test.</p>' - + '</div>' + var templateHTML = '<div class="alert alert-danger fade show">' + + '<a class="close" href="#" data-dismiss="alert">×</a>' + + '<p><strong>Template necessary for the test.</p>' + + '</div>' var $alert = $(templateHTML).appendTo('#qunit-fixture').bootstrapAlert() $alert.find('.close').trigger('click') |