由于错误,我无法运行npm测试:

●测试套件无法运行

/home/nrl/repo/frontend/node_modules/react-router-dom/es/Link.js:11
import React from 'react';
       ^^^^^

SyntaxError: Unexpected identifier

这是我的测试文件 .

import React from 'react';

import { Footer } from "../components/Footer";

function sum(a, b) {
  return a + b;
}

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

这是Footer.js

import React from 'react'
import Link from "react-router-dom/es/Link"

export const Footer = () =>{
    return(
        <footer>
             ...
        </footer>
    )
};

问题似乎与react-router-dom / es / Link有关 . 因为它修复了我从footer.js文件中删除import Link行 . 我不能测试这样的组件吗?