mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-10 09:10:12 -06:00
* Remove useless code * Add code-coverage to reacr devDependencies * Remove react/support imports * Remove some useless code from @cypress/react * Cleanup vue * Make it works :) * Fix react errors * Fix next.js react example Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
example: mount the component inside before hook
Typically we advise to mount the component inside the test or inside the beforeEach hook
// mount the component inside the test
it('does something', () => {
mount(...)
})
// mount the component before each test
describe('component', () => {
beforeEach(() => {
mount(...)
})
it('works 1', () => {
...
})
it('works 2', () => {
...
})
})
This example shows that we can mount the component once and then run tests against it
before(() => {
mount(...)
})
it('works 1', () => {
...
})
it('works 2', () => {
...
})
See spec.js