Skip to content

Testcafe stacktrace is incomplete and missing reference to calling test #8450

@AriAy-Ded

Description

@AriAy-Ded

What is your Scenario?

When using nested helper functions (3+ levels deep), TestCafe omits some function calls from the error stacktrace, making debugging difficult.

What is the Current behavior?

Test Structure

Helper Functions (in separate files under util/):

  • util/validateContent.ts - Level 1: Top-level helper
  • util/verifyPageContent.ts - Level 2: Middle helper
  • util/checkElementText.ts - Level 3: Deepest helper (performs assertion)

Test File (nested-test.spec.ts) contains 4 tests with different nesting levels:

  1. 3 levels - validateContent()verifyPageContent()checkElementText()
  2. 2 levels - verifyPageContent()checkElementText()
  3. 1 level - checkElementText()
  4. Direct assertion - No helper functions (baseline)

All tests are designed to fail to demonstrate stacktrace behavior.

The Bug

3 Levels of Nesting

Stacktrace ends at:

at checkElementText (util/checkElementText.ts:16:12)
at verifyPageContent (util/verifyPageContent.ts:16:12)
at validateContent (util/validateContent.ts:8:71)

❌ NO REFERENCE to nested-test.spec.ts - The stacktrace stops at the deepest helper file and never shows where in the test file the call originated!

What is the Expected behavior?

at (nested-test.spec.ts:17:28) ← Test file IS shown!

What is your TestCafe test code?

https://github.com/aayvazyan-tgm/testcafe-stacktrace-bug

Your complete test report

https://github.com/aayvazyan-tgm/testcafe-stacktrace-bug/blob/main/execution-log.md

Steps to Reproduce

npx testcafe "chrome:headless --disable-features=LocalNetworkAccess --no-sandbox" nested-test.spec.ts

TestCafe version

3.7.2

Node.js version

v22.20.0

Command-line arguments

npx testcafe "chrome:headless --disable-features=LocalNetworkAccess --no-sandbox" nested-test.spec.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    TYPE: enhancementThe accepted proposal for future implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions