diff --git a/jest.react.config.js b/jest.react.config.js index b88f0b239c..2eb8e151c5 100644 --- a/jest.react.config.js +++ b/jest.react.config.js @@ -1,4 +1,6 @@ module.exports = { verbose: true, testTimeout: 15000, + testRegex: '(/src/client/.*\\.(test|spec))\\.[jt]sx?$', + setupFilesAfterEnv: ['/tests/client/globalSetup.js'], }; diff --git a/package.json b/package.json index 79a2b05c35..5dc089f031 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "lint": "eslint .", "test": "yarn test:int && yarn test:client", "test:int": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.js NODE_ENV=test DISABLE_LOGGING=true jest --forceExit --runInBand", - "test:client": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.js NODE_ENV=test jest --config=jest.react.config.js src/client/client.spec.js" + "test:client": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.js NODE_ENV=test jest --config=jest.react.config.js" }, "dependencies": { "@babel/core": "^7.11.6", diff --git a/src/client/client.spec.js b/src/client/client.spec.js index fa5ff73337..6a1cfd6e59 100644 --- a/src/client/client.spec.js +++ b/src/client/client.spec.js @@ -1,4 +1,3 @@ -import '@testing-library/jest-dom/extend-expect'; import React from 'react'; import { render } from '@testing-library/react'; import Separator from './components/elements/Paginator/Separator'; diff --git a/tests/client/globalSetup.js b/tests/client/globalSetup.js new file mode 100644 index 0000000000..7b0828bfa8 --- /dev/null +++ b/tests/client/globalSetup.js @@ -0,0 +1 @@ +import '@testing-library/jest-dom';