github.com/oinume/lekcije@v0.0.0-20231017100347-5b4c5eb6ab24/frontend/jest.config.js (about)

     1  /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
     2  module.exports = {
     3    moduleNameMapper: {
     4      '^lodash-es$': 'lodash',
     5    },
     6    preset: 'ts-jest',
     7    rootDir: '.',
     8    testEnvironment: 'jest-environment-jsdom',
     9    testPathIgnorePatterns: ['.next', 'node_modules'],
    10    transform: {
    11      '^.+\\.(ts|tsx)$': 'ts-jest',
    12    },
    13    // https://github.com/zeit/next.js/issues/8663#issue-490553899
    14    globals: {
    15      // we must specify a custom tsconfig for tests because we need the typescript transform
    16      // to transform jsx into js rather than leaving it jsx such as the next build requires. you
    17      // can see this setting in tsconfig.jest.json -> "jsx": "react"
    18      'ts-jest': {
    19        tsconfig: 'tsconfig.jest.json',
    20      },
    21    },
    22  };