-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclient.jest.config.ts
64 lines (61 loc) · 2.21 KB
/
client.jest.config.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
57
58
59
60
61
62
63
64
import {lstatSync, readdirSync} from 'fs';
import path from 'path';
import type {InitialOptionsTsJest} from 'ts-jest/dist/types';
const sharedBasePath = path.resolve(__dirname, 'packages');
const sharedModules = readdirSync(sharedBasePath).filter(name => {
return lstatSync(path.join(sharedBasePath, name)).isDirectory();
});
const config: InitialOptionsTsJest = {
preset: 'ts-jest',
testEnvironment: '<rootDir>/tests/jest-environment-jsdom.ts',
resolver: '<rootDir>/tests/resolver.js',
setupFiles: ['<rootDir>/tests/setupTests.ts', 'jest-canvas-mock'],
setupFilesAfterEnv: [
'<rootDir>/tests/setupTestsAfterEnv.ts',
'jest-extended/all',
],
testMatch: ['<rootDir>/**/?(*.)+(spec|test).[jt]sx'],
transform: {
'^.+\\.css$': 'jest-transform-css',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: 'tsconfig.json',
isolatedModules: false,
},
],
},
moduleDirectories: ['node_modules', '<rootDir>/server'],
testPathIgnorePatterns: ['/node_modules/', '/build/'],
moduleNameMapper: {
['@bugsnag/(.*)']: '<rootDir>/tests/mocks/empty.js',
['viem/chains']: '<rootDir>/tests/mocks/empty.js',
['@xmtp/(.*)']: '<rootDir>/tests/mocks/empty.js',
['@uauth/(.*)']: '<rootDir>/tests/mocks/empty.js',
['@pushprotocol/(.*)']: '<rootDir>/tests/mocks/empty.js',
['@ipld/(.*)']: '<rootDir>/tests/mocks/empty.js',
['@ucanto/(.*)']: '<rootDir>/tests/mocks/empty.js',
'web3.storage': '<rootDir>/tests/mocks/empty.js',
['wagmi']: '<rootDir>/tests/mocks/empty.js',
['is-ipfs']: '<rootDir>/tests/mocks/empty.js',
'react-medium-image-zoom': '<rootDir>/tests/mocks/empty.js',
'swiper/react': '<rootDir>/tests/mocks/swiper-react/index.tsx',
['swiper']: '<rootDir>/node_modules/swiper/swiper-bundle.js',
...sharedModules.reduce(
(acc, name) => ({
...acc,
[`@unstoppabledomains/${name}/src/(.*)$`]: `<rootDir>/packages/${name}/src/$1`,
[`@unstoppabledomains/${name}(.*)$`]: `<rootDir>/packages/${name}/src/$1`,
}),
{},
),
...['styles', 'tests'].reduce(
(acc, name) => ({
...acc,
[`^${name}/(.*)$`]: `<rootDir>/server/${name}/$1`,
}),
{},
),
},
};
export default config;