Skip to content

Commit a2a24af

Browse files
authored
chore: refactoring analytics client to lock down public interface (#382)
* chore: refactoring analytics client to lock down public interface * fix: ts-jest for core and plugins
1 parent 73a9328 commit a2a24af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2008
-1983
lines changed

jest.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
2+
const { compilerOptions } = require('./tsconfig');
3+
14
module.exports = {
25
preset: 'react-native',
36
setupFiles: ['./packages/core/src/__tests__/__helpers__/setup.js'],
47
testPathIgnorePatterns: ['./packages/core/src/__tests__/__helpers__/'],
58
modulePathIgnorePatterns: ['/lib/'],
9+
globals: {
10+
'ts-jest': {
11+
tsconfig: 'tsconfig.json',
12+
},
13+
},
14+
transform: {
15+
'^.+\\.tsx?$': 'ts-jest',
16+
},
17+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
18+
modulePaths: [compilerOptions.baseUrl],
19+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
620
};

jesttemplate

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
2+
const { compilerOptions } = require('./tsconfig');
3+
4+
module.exports = {
5+
preset: 'react-native',
6+
roots: ['<rootDir>'],
7+
setupFiles: ['../../core/src/__tests__/__helpers__/setup.js'],
8+
testPathIgnorePatterns: ['.../../core/src/__tests__/__helpers__/'],
9+
modulePathIgnorePatterns: ['/lib/'],
10+
transform: {
11+
'^.+\\.tsx?$': 'ts-jest',
12+
},
13+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
14+
modulePaths: [compilerOptions.baseUrl],
15+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
16+
};

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@
4444
"eslint-config-prettier": "^7.0.0",
4545
"eslint-plugin-prettier": "^3.1.3",
4646
"husky": "^4.2.5",
47-
"jest": "^26.0.1",
47+
"jest": "^27.3.1",
4848
"pod-install": "^0.1.27",
4949
"prettier": "^2.3.2",
5050
"react": "17.0.2",
5151
"react-native": "0.65.1",
5252
"react-native-builder-bob": "^0.18.1",
5353
"release-it": "^14.2.2",
5454
"release-it-yarn-workspaces": "^2.0.1",
55-
"typescript": "^4.1.3"
55+
"typescript": "^4.1.3",
56+
"ts-jest": "^27.0.7"
5657
},
5758
"engines": {
5859
"node": ">=12"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Persistor } from 'redux-persist';
2+
3+
export const mockPersistor: Persistor = {
4+
pause: jest.fn(),
5+
persist: jest.fn(),
6+
flush: jest.fn(),
7+
purge: jest.fn(),
8+
dispatch: jest.fn(),
9+
getState: jest.fn(),
10+
subscribe: jest.fn(),
11+
};

0 commit comments

Comments
 (0)