Skip to content

Commit

Permalink
make coveralls an optional peer dep
Browse files Browse the repository at this point in the history
Most people don't use it, and it's kinda big.

Breaking change, tho

Fix: #795
  • Loading branch information
isaacs committed Mar 5, 2022
1 parent 3f1ae47 commit 1ff75a4
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 49 deletions.
3 changes: 2 additions & 1 deletion bin/jack.js
Expand Up @@ -360,7 +360,8 @@ Much more documentation available at: https://www.node-tap.org/
This is enabled by default.
If a COVERALLS_REPO_TOKEN environment
variable is set, then coverage is
variable is set, and the 'coveralls'
module is installed, then coverage is
sent to the coveralls.io service.`,
negate: {
short: 'no-cov',
Expand Down
6 changes: 5 additions & 1 deletion bin/run.js
Expand Up @@ -29,6 +29,7 @@ const maybeResolve = id => {
const tsNode = maybeResolve('ts-node/register')
const flowNode = maybeResolve('flow-remove-types/register')
const jsx = require.resolve('./jsx.js')
const coverallsBin = maybeResolve('coveralls/bin/coveralls.js')

const which = require('which')
const {ProcessDB} = require('istanbul-lib-processinfo')
Expand Down Expand Up @@ -352,12 +353,15 @@ const runCoverageReportOnly = options => {
runNyc(['report'], [], options)
if (process.env.COVERALLS_REPO_TOKEN ||
process.env.__TAP_COVERALLS_TEST__) {
pipeToCoveralls()
return pipeToCoveralls()
}
}

/* istanbul ignore next */
const pipeToCoveralls = async () => {
if (!coverallsBin) {
return
}
const reporter = spawn(node, [nycBin, 'report', '--reporter=text-lcov'], {
stdio: [ 0, 'pipe', 2 ]
})
Expand Down

0 comments on commit 1ff75a4

Please sign in to comment.