forked from charmverse/app.charmverse.io
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.nodejs.ts
56 lines (43 loc) · 1.71 KB
/
jest.config.nodejs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { Config } from '@jest/types';
import nextJest from 'next/jest';
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './'
});
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
/**
* Configuration copied from
* https://nextjs.org/docs/testing
* */
export const jestConfig: Omit<Config.InitialOptions, 'transform'> = {
// Automatically clear mock calls, instances and results before every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: false,
modulePathIgnorePatterns: ['__e2e__'],
// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: ['node_modules', '<rootDir>'],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['./jest.setup.ts'],
// Teardown function after all tests run
globalTeardown: '<rootDir>/jest.teardown-init.js',
// The test environment that will be used for testing
testEnvironment: 'jest-environment-node',
// This is needed so CI environment does not attempt to run tests in the permissions_api folder
testPathIgnorePatterns: ['<rootDir>/permissions_api'],
testTimeout: 240000
// roots: ['<rootDir>', './testing/jest/']
};
export default async function makeConfig(testDir: string) {
return createJestConfig({
...jestConfig,
rootDir: __dirname,
moduleNameMapper: {
'lodash-es': 'lodash'
},
testMatch: [`${testDir}/**/*.spec.ts`]
});
}