Skip to content

test runner breaks with ERR_TAP_LEXER_ERROR while trying a console.dir with colors flag set ( {colors: true} ) #46959

Description

@nickmilon

Version

v19.7.0

Platform

Linux lnv 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

test_runner

What steps will reproduce the bug?

// test-console_colors.js

import { it } from 'node:test'
const obj = { a: 1, b: 2}
it('test-console-no-colors', () => {
    console.dir(obj, { colors: false })
}); 

it('test-console-with-colors', () => {
    console.dir(obj, { colors: true })
}); 

node --test test-console_colors.js

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

should be same as when I run: node del/test-console_colours.js

{ a: 1, b: 2 }
{ a: 1, b: 2 }
TAP version 13
# Subtest: test-console-no-colours
ok 1 - test-console-no-colours
  ---
  duration_ms: 5.98973
  ...
# Subtest: test-console-with-colours
ok 2 - test-console-with-colours
  ---
  duration_ms: 0.511385
  ...
1..2
# tests 2
# pass 2
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 13.586095

What do you see instead?

TAP version 13
# Subtest: /_nm/prgs/node/acropolis-ch/del/test-console_colours.js
    # { a: 1, b: 2 }
not ok 1 - /_nm/prgs/node/acropolis-ch/del/test-console_colours.js
  ---
  duration_ms: 52.299434
  failureType: 'uncaughtException'
  error: 'Unexpected character: \x1B at line 1, column 0'
  code: 'ERR_TAP_LEXER_ERROR'
  stack: |-
    Socket.emit (node:events:512:28)
    Socket.read (node:net:742:39)
    async Promise.all (index 1)
  ...
1..1
# tests 1
# pass 0
# fail 1
# cancelled 0
# skipped 0
# todo 0
# duration_ms 66.556183

Additional information

  1. Looks like similar/related to this issue 45706
  2. same error happens even if I run console.dir outside subtest (it)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions