3.6.0 • Published 5 years ago

@jsenv/testing v3.6.0

Weekly downloads
31
License
MIT
Repository
github
Last release
5 years ago

jsenv testing

github package ci status codecov

Introduction

@jsenv/testing is used by jsenv projects to execute tests and generate coverage.

It has the following exports

  • test
  • cover
  • startContinuousTesting

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

  1. Create basic project file structure

    — see ./docs/basic-project

  2. Install dev dependencies

    npm install

test example

node ./execute-tests.js

I made a video recording terminal during execution basic-project/execute-tests.js. The gif below was generated from that video.

test terminal recording

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.js

It 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.

browsing coverage recording

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.

3.6.0

5 years ago

3.5.0

5 years ago

3.4.0

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.10.0

5 years ago

2.9.0

5 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.29.0

5 years ago

1.28.0

5 years ago

1.27.0

5 years ago

1.26.0

5 years ago

1.25.0

5 years ago

1.24.0

5 years ago

1.23.0

5 years ago

1.22.0

5 years ago

1.21.0

5 years ago

1.20.0

5 years ago

1.19.0

5 years ago

1.18.0

5 years ago

1.17.1

5 years ago

1.17.0

5 years ago

1.16.0

5 years ago

1.15.1

5 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago