当我为我的 React 项目运行测试脚本 npm run test
时,它抛出了一些错误,我没有太多的笑话知识,但我想摆脱这些错误。
我正在使用 core-ui。
D:\octal\Chum\chum-admin\node_modules\@coreui\icons\js\index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { brandSet } from './brand/brand-set.js'
^^^^^^
SyntaxError: Cannot use import statement outside a module
1 | import React from 'react'
> 2 | import { freeSet } from '@coreui/icons'
| ^
3 | import CIcon from '@coreui/icons-react'
4 | import { NavLink } from 'react-router-dom'
5 |
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (src/_nav.js:2:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 3.415 s
Ran all test suites.