相关疑难解决方法(0)

ReferenceError:您正在尝试在 Jest 环境被拆除后“导入”一个文件:在 loadCjsDefault

我正在测试使用 jest 构建一个带有汇总的包,每当我使用 async/await 时都会抛出错误。我不知道出了什么问题。我尝试了不同的灵魂,但它不起作用。


ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.

      at loadCjsDefault (node_modules/@babel/core/lib/config/files/module-types.js:77:18)
      at loadCjsOrMjsDefault (node_modules/@babel/core/lib/config/files/module-types.js:49:16)
          at loadCjsOrMjsDefault.next (<anonymous>)
      at readConfigJS (node_modules/@babel/core/lib/config/files/configuration.js:190:47)
          at readConfigJS.next (<anonymous>)

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.

      at _parser (node_modules/@babel/core/lib/parser/index.js:9:16)
      at parser (node_modules/@babel/core/lib/parser/index.js:54:18)
          at parser.next (<anonymous>)
      at normalizeFile (node_modules/@babel/core/lib/transformation/normalize-file.js:93:38)
          at normalizeFile.next (<anonymous>)

  ?  Cannot log after tests are done. Did you forget to wait for …
Run Code Online (Sandbox Code Playgroud)

javascript jestjs babeljs babel-jest

2
推荐指数
2
解决办法
2351
查看次数

标签 统计

babel-jest ×1

babeljs ×1

javascript ×1

jestjs ×1