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

Example using Jest and Cypress with TypeScript in a single repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:TypeScript 90.8%Language:JavaScript 9.2%