- Edit
package.json
Jest configuration as shown below. The big points are to ensure you have ajson
reporter and to ensure your coverage is stored in a unique directory for unit tests (in this config itscoverage/unit
. Also, add the development dependencies shown as they are required for the merge script. - Edit your e2e configuration (
test/jest-e2e.json
) as shown below. The required "trick" was to ensure thatrootDir
's subtree includes paths for the e2e tests as well as an source you want to generate coverage for. Using the parent directory includes bothtest
andsrc
so this works. I tried many other methods, like settingcollectCoverageFrom
to../src
, none of them worked. It appears you must use the parent directory and exclude everything you don't want. Note that it also uses a unique directory for its generated coverage data (coverage/e2e
). - Add
merge-coverage.ts
shown below to your project and run it after you've ran both test sets generating coverage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
command -v docker >/dev/null 2>&1 || { echo >&2 "I require Docker but it's not installed. Aborting."; exit 1; } | |
echo "Basic auth for traefik >= v1.7" | |
read -p "User: " USER | |
read -p "Password: " PW | |
# Pull httpd:alpine image (small and includes httpasswd) | |
docker pull httpd:alpine >/dev/null 2>&1 |