I try to log values for debugging with t.log and console.log, but they're not showing up in the terminal.
'use strict'
const test = require('ava')
test('something', (t) => {
t.log('1')
t.log('2')
console.log('3')
t.pass()
})
$ ava
1 tests passed
Sometimes:
$ ava
â ¸ 3
1 tests passed
Copy the relevant section from package.json:
{
"ava": {
"babel": false,
"compileEnhancements": false
}
}
Node.js v10.4.0
darwin 17.6.0
ava 1.0.0-beta.5.1
npm 6.1.0
I assume this is because the default reporter only shows details for failed tests. The logs should show up if you use npx ava --verbose.
Though I would have expected console.log() to show, it's asynchronous so perhaps the worker exits before it's read. I'm looking to make some changes to the reporters that should make this more reliable, see #1776.
(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)
console.log should always show up by default. This is bad behavior. When we add a console.log we always expect to be able to see it.
I assume this is because the default reporter only shows details for failed tests. The logs should show up if you use
npx ava --verbose.Though I would have expected
console.log()to show, it's asynchronous so perhaps the worker exits before it's read. I'm looking to make some changes to the reporters that should make this more reliable, see #1776.(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)
it works, thank you!
Most helpful comment
I assume this is because the default reporter only shows details for failed tests. The logs should show up if you use
npx ava --verbose.Though I would have expected
console.log()to show, it's asynchronous so perhaps the worker exits before it's read. I'm looking to make some changes to the reporters that should make this more reliable, see #1776.(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)