TypeError: Cannot read properties of undefined (reading 'tests')
Opened this issue · 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)
Looks like its an issue on my side as I tried reverting to the 2.9 version and I still get the error - Trying to figure it out, since we haven't changed anything since this was working last (except updating all dependencies)
After additional debugging, I still pretty sure this is on my side but I cannot figure out where or why... So I'm looking for additional help; please and thank you
A little more info/context:
- I am only seeing this when I run cypress open; this doesn't log or show when I run the spec directly in headless
- the test results are not being sent to testrail in either case
- the run in testrail IS being created as intended
- in either method, I am left with a created_run.json file at root
I pulled the last known good configuration from our repo into a clean directory and still got this error with the old npm i
modules - now I'm wondering how I got this to work the one time...
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 (..\GITTMP\WebUIAutomation\node_modules\cypress-testrail\src\Reporter.js:136:41)
at Object.handler (..\GITTMP\WebUIAutomation\node_modules\cypress-testrail\src\Reporter.js:77:24)
at invoke (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:185:18)
at ..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
at tryCatcher (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
at Function.Promise.attempt.Promise.try (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
at Object.wrapChildPromise (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
at RunPlugins.execute (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
at EventEmitter.<anonymous> (..\AppData\Local\Cypress\Cache\13.5.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> (..\AppData\Local\Cypress\Cache\13.5.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] (..\AppData\Local\Cypress\Cache\13.5.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)
^C^CTerminate batch job (Y/N)?
^C
PS ..\GITTMP\WebUIAutomation> npm list
webuiautomation@1.3.1 ..\GITTMP\WebUIAutomation
+-- @cypress/grep@3.1.5
+-- @testing-library/cypress@10.0.1
+-- axe-core@4.8.2
+-- cypress-axe@1.5.0
+-- cypress-real-events@1.11.0
+-- cypress-testrail@2.8.2
+-- cypress-visual-regression@3.0.0
+-- cypress-wait-until@1.7.2
+-- cypress@13.5.1
+-- eslint-config-prettier@8.10.0
+-- eslint-plugin-cypress@2.15.1
+-- eslint@8.53.0
+-- fast-glob@3.2.12
+-- husky@8.0.3
+-- lint-staged@13.3.0
+-- playwright-webkit@1.39.0
+-- prettier-eslint@15.0.1
`-- prettier@2.8.8
Based on my various tests, I'm going to see if @boxblinkracer can shed any light (headbashingagainstwall)
hi there
so sorry for the late reply
ill check it out, give me a bit please :)
@boxblinkracer just wanted to check-in and see if we can help provide any additional info on this