我正在尝试阅读 angularjs.org 的 angular-phonecat 中的教程。在步骤三中,我在使用 Protractor 进行端到端测试时遇到错误。这是错误代码。
Using ChromeDriver directly...
Cannot read property 'matcherFn_' of undefined
[launcher] Runner Process Exited With Error Code: 1
npm ERR! angular-phonecat@0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 protractor script.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! cwd c:\angular-phonecat\angular-phonecat
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\angular-phonecat\angular-phonecat\npm-debug.log
npm ERR! not ok code 0
这里出了什么问题?
最佳答案
问题好像是最新的1.0.0版本的minijasminenode引起的。 作为一个临时的解决方法,这个 hack 起作用了:
- 编辑 node_modules/protractor/package.json 并将 minijasminenode 依赖项更改为 <1.0.0 因此它现在如下所示:
"minijasminenode": "<1.0.0",
- 删除 minijasminenode 目录:
rm -r node_modules/protractor/node_modules/minijasminenode
- 重新安装所需的模块:
cd node_modules/protractor && npm install
您的端到端测试现在应该可以运行了。可能有更优雅的方式来实现这一目标。
关于node.js - 使用 Protractor 给出错误的端到端测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24217987/