Skip to content

bahmutov/local-cypress-and-jest-typescript-example

 
 

Repository files navigation

cypress-and-jest-typescript-example

cypress version local-cypress version ci status badges status renovate-app badge

Example using Jest and Cypress with TypeScript in a single repo

If you are using Jest and Cypress types in the same project, they might conflict because both test runners use globals like expect. This project uses local-cypress to remove global Cypress types and explicitly import them.

// cypress/integration/spec.ts
import {cy, expect} from 'local-cypress'
it('works', () => {
  // Cypress commands
  cy.wrap('foo').should('equal', 'foo')
  // Chai assertions
  expect('bar').to.equal('bar')
})
npm install
npm run lint
npm run lint:cypress

Also see cypress-io/cypress-and-jest-typescript-example that does not use local-cypress and isolated the types instead.

About

Example using Jest and Cypress with TypeScript in a single repo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.8%
  • JavaScript 9.2%