Ava: No log output

Created on 16 Jun 2018  Â·  3Comments  Â·  Source: avajs/ava

Description

I try to log values for debugging with t.log and console.log, but they're not showing up in the terminal.

Test Source

'use strict'

const test = require('ava')

test('something', (t) => {

    t.log('1')
    t.log('2')
    console.log('3')

    t.pass()

})

Error Message & Stack Trace

$ ava


  1 tests passed

Sometimes:

$ ava

â ¸ 3

  1 tests passed

Config

Copy the relevant section from package.json:

{
  "ava": {
    "babel": false,
    "compileEnhancements": false
  }
}

Command-Line Arguments


Environment

Node.js v10.4.0
darwin 17.6.0
ava 1.0.0-beta.5.1
npm 6.1.0

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.)

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fleg picture fleg  Â·  3Comments

clitetailor picture clitetailor  Â·  3Comments

sindresorhus picture sindresorhus  Â·  5Comments

carpasse picture carpasse  Â·  3Comments

niftylettuce picture niftylettuce  Â·  4Comments