0

I have started using the protractor with jasmine on an ionic2 application.I have 2 major doubts that did not gets cleared on searching on web:

1.)When any of my specs fails the tests, the error is displayed with npm errors, shown in the below:

1) App Component navigates to the next pagr on click
  - Expected 'Ionic Blank' to match 'Page1'.

Executed 2 of 2 specs (1 FAILED) in 7 secs.
[20:22:55] I/launcher - 0 instance(s) of WebDriver still running
[20:22:55] I/launcher - chrome #01 failed 1 test(s)
[20:22:55] I/launcher - overall: 1 failed spec(s)
[20:22:55] E/launcher - Process exited with error code 1

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e-test"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@0.0.0 e2e-test: `protractor ./test-config/protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@0.0.0 e2e-test script 'protractor ./test-config/protractor.conf.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     protractor ./test-config/protractor.conf.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Lenovo\testing\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@0.0.0 e2e: `npm run e2e-update && npm run e2e-test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@0.0.0 e2e script 'npm run e2e-update && npm run e2e-test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run e2e-update && npm run e2e-test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Lenovo\testing\npm-debug.log

2.)What is the reason behind te addtion of these errors with logs?

Aditya
  • 2,358
  • 6
  • 35
  • 61

1 Answers1

0

NPM is throwing an error because Protractor is reporting an error back - that error being that your tests failed. The 'npm err' lines are standard NPM error reporting designed to help people using external packages and usually don't have a lot of helpful information in them.

I've found that you can prevent this by adding || true to the end of your npm script or by invoking it with || true:

npm e2e || true

This is only really useful if an error will stop something else from happening - in my case I needed a Jenkins build not to fail.

Ted N.
  • 101
  • 1