@jsenv/testing v3.6.0
jsenv testing
Introduction
@jsenv/testing is used by jsenv projects to execute tests and generate coverage.
It has the following exports
testcoverstartContinuousTesting
How to use
To understand how to use jsenv testing let's use it on a "real" project. We will setup a basic project and execute tests, then see how to get test coverage.
Basic project setup
Create basic project file structure
— see ./docs/basic-project
Install dev dependencies
npm install
test example
node ./execute-tests.jsI made a video recording terminal during execution basic-project/execute-tests.js. The gif below was generated from that video.

Cool isn't it?
If you want to know more about test, there is a dedicated page for that.
— see test documentation
From this point you can generate coverage for that basic project. If you are interested by this, it is explained in the next part.
cover example
node ./generate-coverage.jsIt will execute tests and generate basic-project/coverage/coverage-final.json.
I made a gif to illustrate one thing you can get after generating basic project coverage. You can see me exploring the files to see coverage of basic-project/src/platform-name.js.

These files will be generated only if you pass coverageHtmlReport: true to cover.
What is coverage-final.json ?
At this point you have a basic-project/coverage/coverage-final.json file. You can pass it to a code coverage tool and get valuable information from it.
It's important to know that coverage-final.json format comes from instanbul.
— see istanbul on github
The most valuable thing to do with that file is to feed it to some code coverage tool during your continuous integration script.
I have documented one of them named codecov.io but you can integrate with pretty much anything else.
— see uploading coverage to codecov.io
startContinuousTesting example
To be documented, in any case it's an experimental for now.
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago