Use Jest globals in Cypress component testing

Viewed 48

I'm using Cypress Component Testing, and I'm unable to use the jest global variable.

Here's my code:

import { mount } from '@cypress/vue';

describe('Foo', () => {
  jest.mock('vue-router', () => ({
    useRoute: jest.fn(() => ({ query: { foo: 'bar' } }))
  }))

But when I run the test in the browser, I get this error:

The following error originated from your test code, not from Cypress.

  > jest is not defined
0 Answers
Related