Global Chai Declarations #9618
Answered
by
bahmutov
kpowerz
asked this question in
Questions and Help
Replies: 1 comment 1 reply
-
Well, it would be nice to limit the number of global variables, agree. But
historically every spec would need to
import `cypress` and `expect` and whatever else. At the start we have
decided to make it easier to do testing
by having everything ready to go.
Maybe with time we could transition to being local and explicit like
const {it, describe, expect, cy} = require('cypress')
describe('my tests', () => {
it('...', () => {
expect(1).to.equal(1)
})
})
…On Thu, Dec 10, 2020 at 11:32 AM Kyle ***@***.***> wrote:
Please excuse me for I've only been using cypress for a month now, but I
was curious as to why cypress declares the expect and assert globally?
Isn't there a way where the expect and assert can be declared on a
'cypress' level'? As in only within the cypress folder?
Obviously, this is something I can resolve myself but I was curious as to
why this is done by default.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#9618>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ4BJRXVA3QFI74UVYVNITSUDZ2ZANCNFSM4UVIN3QQ>
.
--
Dr. Gleb Bahmutov, PhD
Schedule video chat / phone call / meeting with me via
https://calendly.com/bahmutov
[email protected] @bahmutov <https://twitter.com/@bahmutov>
https://glebbahmutov.com/ https://glebbahmutov.com/blog
https://github.com/bahmutov
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kpowerz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Please excuse me for I've only been using cypress for a month now, but I was curious as to why cypress declares the expect and assert globally?
Isn't there a way where the expect and assert can be declared on a 'cypress' level'? As in only within the cypress folder?
Obviously, this is something I can resolve myself but I was curious as to why this is done by default.
Beta Was this translation helpful? Give feedback.
All reactions