Skip to content

Commit

Permalink
test: better logging for test/test-addon.js
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed Jul 26, 2019
1 parent 555e399 commit b9afb43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/test-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ function checkCharmapValid () {
}

test('build simple addon', function (t) {
t.plan(3)
t.plan(2)

// Set the loglevel otherwise the output disappears when run via 'npm test'
var cmd = [ nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose' ]
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) {
if (err) {
console.error('failed to run: ' + cmd.join(' '))
console.log(stderr)
t.fail(err)
}
var logLines = stderr.toString().trim().split(/\r?\n/)
var lastLine = logLines[logLines.length - 1]
t.strictEqual(err, null)
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok')
t.strictEqual(runHello().trim(), 'world')
})
Expand Down

0 comments on commit b9afb43

Please sign in to comment.