Skip to content

Test runner: spec reporter abridges diff on deepEqual / deepStrictEqual assertion failure #52596

Closed
@danburzo

Description

@danburzo

Version

v21.7.3

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

A failing deepEqual or deepStrictEqual assertion in a test, when using the spec test reporter.

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

No response

What is the expected behavior? Why is that the expected behavior?

The full diff, or at least a larger print depth, of the actual/expected objects helps debug the failing tests.

What do you see instead?

$> node --test 'test/**/*.test.js'

  AssertionError [ERR_ASSERTION]: parse: /* A comment */ a
      at <project-path>//test/testcases.test.js:34:14
      at Array.forEach (<anonymous>)
      at test.objectPrintDepth (<project-path>/test/testcases.test.js:20:45)
      at async Test.run (node:internal/test_runner/test:640:9)
      at async startSubtest (node:internal/test_runner/harness:218:3) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: { type: 'SelectorList', selectors: [ [Object] ] },
    expected: { type: 'SelectorList', selectors: [ [Object] ] },
    operator: 'deepStrictEqual'
  }

Additional information

Related to: #47051

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertIssues and PRs related to the assert subsystem.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