我试图搞“摩卡咖啡”。在我的构建上运行。但是,我在CLI中收到以下错误:
> wym-app@0.52.0 mocha /var/www/wym/wym-app_main
> cross-env NODE_ENV=test mocha "lib/*.spec.js" --compilers js:babel- core/register --recursive
module.js:341
throw err;
^
Error: Cannot find module 'apiConfig'
....
几点:
Mocha既安装在本地也安装在全局
我的网站包构建工作正常
Mocha全球版本为3.1.2
安装的devDependencies是:
"babel-cli": "^6.7.5",
"babel-core": "^6.7.6",
"babel-loader": "^6.2.4",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-register": "^6.7.2",
"cross-env": "^1.0.8",
"mocha": "^2.5.3",
...
我的package.json有以下命令用于运行mocha测试:
" mocha":" cross-env NODE_ENV = test mocha \" lib / * .spec.js \" --compilers js:babel-core / register --recursive",
目录路径如下所示:
...