Добрый день. Я создаю приложение с помощью response и добавляю библиотеку @ testing-library / react. Я также устанавливаю use-global-hook, и при запуске теста npm возникла ошибка. кто-нибудь может помочь мне избавиться от этой ошибки. Спасибо
вот мой пакет json. [package.json] [1]
{
"name": "trial",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "^7.9.6",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"use-global-hook": "^0.1.12"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"ie 11",
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.9.6",
"@testing-library/react": "^9.5.0",
"react-test-renderer": "^16.13.1"
}
}
вот подробности ошибки
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Details:
E:\Backups\Projects\React\trial\node_modules\use-global-hook\index.js:60
export default useStore;
^^^^^^
SyntaxError: Unexpected token 'export'
1 | import React from 'react';
> 2 | import globalHook from 'use-global-hook';
| ^
3 | import actions from './actions';
4 | import initState from './initState';
5 |
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at Object.<anonymous> (src/services/useGLobal.js:2:1)