You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating Realm to 1.27.0, any realm import inside my *.test.ts or inside my application code it throws an Error, that it cannot find module 'realm'.
But if i start my react native (expo) application, everything works fine.
My Jest Config:
import { pathsToModuleNameMapper } from 'ts-jest';
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
// which contains the path mapping (ie the `compilerOptions.paths` option):
import type { JestConfigWithTsJest } from 'ts-jest';
import { compilerOptions } from './tsconfig.json';
const jestConfig: JestConfigWithTsJest = {
preset: 'jest-expo', // Use the react native preset instead of jest-expo
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
},
/** Either execute tests from global __tests__ directory or those matched by file name with *.test.ts(x) pattern */
testMatch: ['**/src/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(test).[jt]s?(x)'],
coverageReporters: ['cobertura', 'lcov'],
collectCoverage: true,
testResultsProcessor: 'jest-sonar-reporter',
coveragePathIgnorePatterns: [
'node_modules',
'jest.setup.tsx',
'<rootDir>/src/__tests__',
],
setupFilesAfterEnv: [
'./node_modules/react-native-gesture-handler/jestSetup.js',
'./node_modules/jest-expo/src/preset/setup.js',
'./src/__tests__/jest.setup.tsx',
],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/src/__tests__/jest.setup.tsx',
'<rootDir>/src/__tests__/__mocks__/',
'<rootDir>/src/__tests__/__mockdata__/',
'<rootDir>/src/__tests__/__utils__/',
],
testEnvironment: 'jsdom',
roots: ['<rootDir>'],
modulePaths: [compilerOptions.baseUrl], // <-- This will be set to 'baseUrl' value
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths /* , { prefix: '<rootDir>/' } */),
'\\.svg': '<rootDir>/src/__tests__/__mocks__/svgMock.ts',
},
moduleDirectories: ['node_modules', 'src/__tests__/__utils__', '__dirname'],
verbose: true,
};
export default jestConfig;
How frequently does the bug occur?
Always
Description
After updating Realm to 1.27.0, any realm import inside my *.test.ts or inside my application code it throws an Error, that it cannot find module 'realm'.
But if i start my react native (expo) application, everything works fine.
My Jest Config:
Babel Config:
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
npx jest
Version
1.27.0
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
MacOS 14.4.1
Build environment
"expo": "~50.0.8",
"react-native": "0.73.5",
"ts-jest": "^29.1.2",
"babel-jest": "^29.7.0",
"jest-expo": "~50.0.2",
"jest-junit": "^16.0.0",
"jest-sonar-reporter": "^2.0.0",
"jest-specific-snapshot": "^8.0.0",
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: