Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do arrow functions not work. #26

Open
steven-holloway opened this issue Dec 17, 2019 · 2 comments
Open

Why do arrow functions not work. #26

steven-holloway opened this issue Dec 17, 2019 · 2 comments

Comments

@steven-holloway
Copy link

This is not a good enough.
"NOTE: Do not use ES6 arrow functions for your describe or it callback. This will cause the recording function to break."
Do you have any idea why?

@cellog
Copy link

cellog commented Dec 17, 2019

because the code uses this.currentTest. However, this can be fixed by listening for Cypress's test:before:run event and setting a global variable in index.js

let currentTest = ''

Cypress.on('test:before:run', ({ title }) => currentTest = title

Then, all references to this.currentTest.title can simply be replaced with currentTest

@dani-mp
Copy link

dani-mp commented Nov 25, 2021

I had the same question. It's an odd requirement and error also prone. I hope it gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants