Ghost/apps/sodo-search/src/setupTests.js
Daniel Lockyer 5875962392 Converted CRA packages to Vite
refs https://github.com/TryGhost/DevOps/issues/50

- we're moving away from CRA in favor of Vite, so this switches the last
  packages over
2023-07-27 09:43:35 +02:00

21 lines
678 B
JavaScript

import {afterEach, expect} from 'vitest';
import {cleanup} from '@testing-library/react';
import {fetch} from 'cross-fetch';
import matchers from '@testing-library/jest-dom/matchers';
// TODO: remove this once we're switched `jest` to `vi` in code
// eslint-disable-next-line no-undef
globalThis.jest = vi;
// eslint-disable-next-line no-undef
globalThis.fetch = fetch;
// Add the cleanup function for React testing library
afterEach(cleanup);
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
expect.extend(matchers);