Skip to content

Commit 7b6b87a

Browse files
authored
Merge pull request #60 from nulllpc/npc/refactor-tests
Refactor tests
2 parents 7af0e0c + acb470f commit 7b6b87a

53 files changed

Lines changed: 8588 additions & 2985 deletions

Some content is hidden

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

babel.config.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:@react-native/babel-preset'],
3+
};

eslint.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export default [
99
ignores: [
1010
'dist/',
1111
'node_modules/',
12-
'src/__mocks__/',
13-
'src/__tests__/',
12+
'tests',
1413
],
1514
},
1615
pluginJs.configs.recommended,

jest.config.cjs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
module.exports = {
2-
preset: 'ts-jest',
3-
testEnvironment: 'node',
4-
roots: ['<rootDir>/src'],
5-
testMatch: ['**/__tests__/**/*.test.ts', '**/__tests__/**/*.test.tsx'],
2+
preset: 'react-native',
3+
roots: ['<rootDir>/tests'],
4+
testMatch: ['**/*.test.ts', '**/*.test.tsx'],
65
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
7-
transform: {
8-
'^.+\\.(ts|tsx)$': [
9-
'ts-jest',
10-
{
11-
diagnostics: {
12-
ignoreCodes: [151002], // Ignore "Could not find a declaration file" warnings
13-
},
14-
},
15-
],
16-
},
176
collectCoverageFrom: [
187
'src/**/*.{ts,tsx}',
198
'!src/**/*.d.ts',
20-
'!src/**/__tests__/**',
219
'!src/index.ts',
2210
],
2311
coverageThreshold: {
@@ -29,15 +17,15 @@ module.exports = {
2917
},
3018
},
3119
moduleNameMapper: {
32-
'^@tetherto/wdk-react-native-secure-storage$': '<rootDir>/src/__mocks__/secureStorage.ts',
33-
'^react$': '<rootDir>/src/__mocks__/react.ts',
20+
'^@src/(.*)$': '<rootDir>/src/$1',
21+
'^@tetherto/wdk-react-native-secure-storage$': '<rootDir>/tests/__mocks__/secureStorage.ts'
3422
},
35-
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
23+
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
3624
// Ignore React Native modules if not available
3725
modulePathIgnorePatterns: ['<rootDir>/node_modules/'],
3826
// Allow tests to run without all dependencies
3927
transformIgnorePatterns: [
40-
'node_modules/(?!(react-native|@react-native|react-native-mmkv|react-native-bare-kit|@tetherto/pear-wrk-wdk)/)',
28+
'node_modules/(?!(react-native|@react-native|react-native-mmkv|react-native-bare-kit|@tetherto/pear-wrk-wdk|immer)/)',
4129
],
4230
};
4331

0 commit comments

Comments
 (0)