-
Couldn't load subscription status.
- Fork 678
Description
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 helperutil/verifyPageContent.ts- Level 2: Middle helperutil/checkElementText.ts- Level 3: Deepest helper (performs assertion)
Test File (nested-test.spec.ts) contains 4 tests with different nesting levels:
- 3 levels -
validateContent()→verifyPageContent()→checkElementText() - 2 levels -
verifyPageContent()→checkElementText() - 1 level -
checkElementText() - 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