react-native-collapsible jest SyntaxError: Cannot use import statement outside a module

33 Views Asked by At

I used 'react-native-collapsible/Accordion' in my component and the snapshot test of the component failed with the error SyntaxError: Cannot use import statement outside a module, how should I fix it?

this is my jest.config.js

const config = {
"displayName": 'DIS',
"bail": 1,
"preset": "react-native",
"verbose": true,
"moduleFileExtensions": [
    "js",
    "json",
    "ts",
    "tsx"
],
"testPathIgnorePatterns": [
    '\\.snap$',
    './__tests__/__mocks__/',
    '../../node_modules/',
    './lib/',
    './example/',
],
"setupFiles": ['./jest.setup.js'],
"snapshotSerializers": ["enzyme-to-json/serializer"],
"testRunner": 'jest-jasmine2',
"setupFilesAfterEnv": ["@testing-library/jest-native/extend-expect"],
"testTimeout": 360000000,
// "testSequencer": './jest.sequencer.js',
// "slowTestThreshold": 1,
// "testResultsProcessor": "./jest.testTesultsProcessor.js"};
0

There are 0 best solutions below