尝试使用`import`时出现Jest错误

时间:2020-06-14 21:19:07

标签: javascript jestjs

我正在使用Jest在我的JS代码上运行测试。
但目前,我遇到了一个错误: Cannot use import statement outside a module
我该如何解决?
我看过这里,但不是我要找的东西:How to resolve "Cannot use import statement outside a module" in jest

这是我的模块:

class Path {
  // code in here
}

export default Path;

这是从中导出的测试文件:

import Path from "./Path";
// test() ...

这是我的文件夹结构:
enter image description here

0 个答案:

没有答案