namuol / tap-difflet

TAP output formatter using difflet for inequality errors.
48 stars 8 forks source link

fails erroring on ci exited with 0. #10

Open thisconnect opened 6 years ago

thisconnect commented 6 years ago

any idea why this exits with 0?

https://travis-ci.org/thisconnect/tools/jobs/295026162#L2141

> tape **/__test__/*.js | tap-difflet
module.js:471
    throw err;
    ^
Error: Cannot find module 'babel-core'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/travis/build/thisconnect/tools/node_modules/rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js:4:17)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
0 passing (2s)
The command "npm test" exited with 0.
namuol commented 6 years ago

This:

https://github.com/namuol/tap-difflet/blob/2f47e7730e9bcf3506c195dda0d983cf621ae275/bin/tap-difflet#L34-L36

The solution would be to change process.on('exit')'s handler to check if there's a nonzero return code and return that first, before returning the number of errors encountered.

At work right now so I can't make this change but PRs are welcome! Should be a good starter contribution. :)

thisconnect commented 6 years ago

I tried writing a test, not sure if that is good enough

/* Modules */

var test = require('tape');

/* Tests */

test('halt and catch fire', function(assert) {
  assert.plan(1);
  throw new Error('something broke')
});

unfortunately the code is 0 process.on('exit', function (code) {, my guess is TAP just streams the error in TAP format, so no exit code

I am not sure if I'm able to solve this. Another question, why does it use tap-parser-yaml and not tap-parser?