blurts-server icon indicating copy to clipboard operation
blurts-server copied to clipboard

When running `npm test`, skip coveralls when not configured

Open jwhitlock opened this issue 3 years ago • 1 comments

Add a new script scripts/is_coveralls_configured.js that checks if COVERALLS_REPO_TOKEN is defined or .coveralls.yml exists, and sets exit code 1 (failure) if not configured. It can be run with npm test:is_coveralls_configured

This is then used in npm test to skip running coveralls if it isn't configured, which is normal in the development environment.

jwhitlock avatar Oct 07 '22 15:10 jwhitlock

Force-pushed to fix the command. coveralls ran in CircleCI and coverage was uploaded to coveralls.io.

It is skipped for me locally (since I never setup .coverage.yml).

We're missing a coverage badge. I could add it to README.md with this PR:

[![Coverage Status](https://coveralls.io/repos/github/mozilla/blurts-server/badge.svg?branch=master)](https://coveralls.io/github/mozilla/blurts-server?branch=master)

which renders as:

Coverage Status

jwhitlock avatar Oct 07 '22 16:10 jwhitlock

Rebased on current main and made changes based on feedback:

  • Script is now scripts/is-coveralls-configured.js, using kabob-naming for consistency with other scripts
  • npm test now calls scripts/is_coveralls_configured.js directly, and npm test:is_coveralls_configured is dropped
  • Remove a comment about .coverage.yml and the Ruby coveralls as unneeded
  • Remove unneeded call to process.exit(0), only needed for non-zero exit code
  • Add the coverage badge to README.md, defaulting to the main branch (not master, like in my comment)

jwhitlock avatar Oct 18 '22 20:10 jwhitlock