jan/web/jest.config.js
hiento09 bd0e525d66
chore: upgrade to turbo v2 and reduce ci quality gate runtime (#4324)
* chore: upgrade to turbo v2 and reduce ci quality gate runtime

* chore: upgrade to yarn v4 and deprecate turborepo

* chore: reconfigure modules and fix tests

* chore: switch to github-hosted runner

* fix: dependency resolving

* chore: clean redundant step

* chore: headless test

* chore: remove headed param

* fix: resolve dependency version

* fix: ubuntu no-sandbox test

---------

Co-authored-by: Hien To <tominhhien97@gmail.com>
Co-authored-by: Louis <louis@jan.ai>
2024-12-29 17:46:15 +07:00

45 lines
1.3 KiB
JavaScript

const nextJest = require('next/jest')
/** @type {import('jest').Config} */
const createJestConfig = nextJest({})
// Add any custom config to be passed to Jest
const config = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest',
},
moduleNameMapper: {
// ...
'^@/(.*)$': '<rootDir>/$1',
'react-markdown': '<rootDir>/mock/empty-mock.tsx',
'rehype-highlight': '<rootDir>/mock/empty-mock.tsx',
'rehype-katex': '<rootDir>/mock/empty-mock.tsx',
'rehype-raw': '<rootDir>/mock/empty-mock.tsx',
'remark-math': '<rootDir>/mock/empty-mock.tsx',
'^react$': '<rootDir>/node_modules/react',
'^react/jsx-runtime$': '<rootDir>/node_modules/react/jsx-runtime',
'^react-dom$': '<rootDir>/node_modules/react-dom',
},
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
runner: './testRunner.js',
collectCoverageFrom: ['./**/*.{ts,tsx}'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: false,
},
],
},
}
// https://stackoverflow.com/a/72926763/5078746
// module.exports = createJestConfig(config)
module.exports = async () => ({
...(await createJestConfig(config)()),
transformIgnorePatterns: ['/node_modules/(?!(layerr|nanoid|@uppy|preact)/)'],
})