cypress-testrail icon indicating copy to clipboard operation
cypress-testrail copied to clipboard

TypeError: Cannot read properties of undefined (reading 'tests')

Open MelaAxel opened this issue 10 months ago • 7 comments

Seeing a new error today, after re-starting our implementation process:

Everything starts out normally:

Will leave all specs to run to filter at run-time
 Starting TestRail Integration v2.10.0
 ....................................................
 Cypress: 13.8.1
 Browser: unknown
 System: win32 (10.0.22631)
 Base URL: null
 TestRail Domain: {domain]
 TestRail Mode: Create Run
 TestRail Project ID: 153
 TestRail Milestone ID:
 TestRail Suite ID:
 TestRail Run Name: Regression PoC __datetime__
 TestRail Include All Cases: false
 Ignore pending tests: true
 Screenshots: true
 Include All Failed Screenshots: false
 TestRun created in TestRail: Regression PoC 5/3/2024, 12:39:03 PM
 New TestRail Run: R12694
GET /__/ 200 7.579 ms - -

All my tests run and pass so I close Cypress and get the following:

An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

TypeError: Cannot read properties of undefined (reading 'tests')
    at Reporter._afterSpec ({path}\node_modules\cypress-testrail\src\Reporter.js:140:41)
    at Object.handler ({path}\node_modules\cypress-testrail\src\Reporter.js:80:24)
    at invoke ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:185:18)
    at {path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
    at tryCatcher ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
    at RunPlugins.execute ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
    at EventEmitter.<anonymous> ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
    at EventEmitter.emit (node:events:519:28)
    at EventEmitter.emit (node:domain:488:12)
    at process.<anonymous> {path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:951:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Error:
      Expected DataContext to already have been set via setCtx. If this is a
      testing context, make sure you are calling "setCtx" in a before hook,
      otherwise check the application flow.

    at c (<embedded>:4315:138737)
    at Object.u (<embedded>:4359:75697)
    at Object.<anonymous> (<embedded>:4392:28989)
    at Object.tryCatcher ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Object.execute ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:15:34)
    at C.close (<embedded>:4450:26869)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

MelaAxel avatar May 03 '24 18:05 MelaAxel