Jest -UnhandledPromiseRejection TypeError Path must be a string

时间:2017-10-12 09:43:59

标签: node.js ajax reactjs gulp jest

Trying to run jest after installing all the necessary dependencies (npm install/bower install)all the needed packages are in package.json still-I get an error as shown : when I run jest -( I have tried changing the versions of jest )

Using Jest CLI v0.7.1
(node:9212) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Path must be a string. Received [//path of the file]

I tried to run the application : when I run gulp serve I get the following :

Unhandled promise rejection (rejection id: 3): TypeError: $.ajax is not a function

are these two errors related . Please use the following files for reference:

1) complete source code Im using

https://www.dropbox.com/sh/mc3j9k4qetz7dsm/AADOgMl7AQov0BDzhDDvKdzva?dl=0

2) screen-cast of how errors are shown https://www.dropbox.com/s/v45wlizc47f8kbc/JestAjaxfunction_PromiseRejection.wmv?dl=0

Thanks for any help, Naveen

1 个答案:

答案 0 :(得分:1)

在我的情况下,更新到jest 21后发生了此错误。

修复是在我的jest调用中,包括echo 'export PATH="$HOME/.npm-packages/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile (当前目录)。

破碎:.

已修复:cross-env BABEL_DISABLE_CACHE=1 NODE_ENV=test node --harmony_proxies node_modules/.bin/jest