Cypress configuration error when adding code to before:run Node event listener #31368
Replies: 1 comment
-
I return with a solution, sort of. It turns out I was trying to do the right thing in the wrong place. My original intention was to set up a script that resets the environment and seeds the database each time Cyprress is launched, either with ✅ Instead I ran the script a level higher in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to set up the Cypress
before:run
listener to run some code to setup the test environment before any test in the suite is run, as well as set some environment variables to be used throughout testing. In order to retrieve an authToken to hit our system APIs, I have a function that programmatically retrieves a token through our Cognito service. When I import that function (from a .js file) into mycypress.config.ts
and call that imported function in theon('before:run)
listener, I get this TypeError:My
cypress.config.ts
file:And please let me know if there is anything else you need to see from my code in diagnosing this issue.
Beta Was this translation helpful? Give feedback.
All reactions