Skip to content

Commit

Permalink
Use common js for jest setup
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarah committed Feb 28, 2024
1 parent 77cf1a6 commit 033113b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import nextJest from 'next/jest';
import type {Config} from 'jest';
const nextJest = require('next/jest');

const createJestConfig = nextJest();

const customJestConfig: Config = {
/** @type {import('jest').Config} */
const customJestConfig = {
testTimeout: 60000,
testMatch: ['**/*.test.ts(x)?'],
collectCoverage: true,
setupFiles: ['<rootDir>/jest.setup.ts'],
setupFiles: ['<rootDir>/jest.setup.cjs'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
Expand All @@ -27,7 +27,7 @@ const customJestConfig: Config = {
* @link https://github.com/vercel/next.js/issues/36077#issuecomment-1096635363
*/

module.exports = async (): Promise<Config> => ({
module.exports = async () => ({
...(await createJestConfig(customJestConfig)()),

transformIgnorePatterns: ['node_modules/(?!(next-intl)/)'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {loadEnvConfig} from '@next/env';
const {loadEnvConfig} = require('@next/env');

// Make sure the environment variables for testing are loaded in the same way Next handles these
module.exports = async () => {
Expand Down
1 change: 0 additions & 1 deletion packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"display": "Default",
"extends": "../../node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"module": "nodenext",
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "node",
Expand Down

0 comments on commit 033113b

Please sign in to comment.