SyntaxError-node_modules / react-native/Libraries/polyfills / hata koruması.js: Noktalı virgül eksik. (14:4) react native kütüphanesinde jest çalıştırma hakkında

0

Soru

Bir react yerel kütüphanesi için jest kurmaya çalışıyorum ancak aşağıdaki hatayı alıyorum

SyntaxError: react-native/Libraries/polyfills/error-guard.js: Missing semicolon. (14:4)

      12 | let _inGuard = 0;
      13 |
    > 14 | type ErrorHandler = (error: mixed, isFatal: boolean) => void;
         |     ^
      15 | type Fn<Args, Return> = (...Args) => Return;

react-yerel sürüm: 0.61.5

uygulama.js

import { Dimensions } from 'react-native';

function sum(a, b) {
    return a + b;
}
module.exports = sum;

uygulama.test.js

const sum = require('./app');

test('adds 1 + 2 to equal 3', () => {
  expect(sum(1, 2)).toBe(3);
});

jest.config.js

module.exports ={
    preset : 'react-native',
    transformIgnorePatterns: [
        '/node_modules/(?!(@react-native|react-native)/).*/'
    ]
}

.babilrcname

{
    "presets": ["react-native"]
}

transformİgnorePatterns eklemek gibi önerilen çeşitli çözümleri denedim ama boşuna. biri bana yardım edebilir mi ?

javascript jestjs react-native reactjs
2021-11-23 11:38:02
1

En iyi cevabı

0

Değiştirdikten sonra benim için işe yaradı. .babelrc dosyaya babel.config.js.

2021-11-25 07:14:00

Diğer dillerde

Bu sayfa diğer dillerde

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................