在写一些测试前几天,我正在使用玩笑和酶来编写反应成分的单元测试,并且在运行它们时它们运行良好。但是今天我试图运行以前可以用的测试用例,但我开了一个玩笑的错误
(node:17020) UnhandledPromiseRejectionWarning: TypeError: projects.filter is not a function
我尝试重新安装jest-cli,升级节点,npm和nvm,但是什么也没有。我正在使用create-react-app附带的jestversión
这是我运行npm test
命令时获得的堆栈跟踪
> marvelproject@0.1.0 test /home/jose.miguez/Desktop/MarvelProject/marvelproject
> react-scripts test --env=jsdom --coverage
(node:17020) UnhandledPromiseRejectionWarning: TypeError: projects.filter is not a function
at readConfigs (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/jest-config/build/index.js:398:8)
at Object.<anonymous> (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:155:58)
at Generator.next (<anonymous>)
at asyncGeneratorStep (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:108:24)
at _next (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:128:9)
at /home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:133:7
at new Promise (<anonymous>)
at Object.<anonymous> (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:125:12)
at Object.runCLI (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest-cli/node_modules/@jest/core/build/cli/index.js:226:19)
at Object.run (/home/jose.miguez/Desktop/MarvelProject/marvelproject/node_modules/jest/node_modules/jest-cli/build/cli/index.js:42:17)
(node:17020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code
我希望您能帮助我!