使用量角器给出错误的端到端测试

anw*_*iar 6 node.js jasmine angularjs protractor

我试图在angularjs.org的angular-phonecat中完成教程.在stetp三中我用量角器进行端到端测试时出错.这是错误代码.

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
Run Code Online (Sandbox Code Playgroud)

什么;在这里出错了?

And*_*ory 3

该问题似乎是由最新的 1.0.0 版本的 minijasminenode 引起的。作为一个临时解决方法,这个黑客有效:

  • 编辑 node_modules/protractor/package.json 并将 minijasminenode 依赖项更改为 <1.0.0,因此它现在如下所示:

"minijasminenode": "<1.0.0",

  • 删除 minijasminenode 目录:

rm -r node_modules/量角器/node_modules/minijasminenode

  • 重新安装所需的模块:

cd node_modules/量角器 && npm install

您的 e2e 测试现在应该可以运行。可能有一种更优雅的方式来实现这一目标。

另请参阅https://github.com/angular/protractor/issues/931