Mitul Patel
Mitul Patel

Reputation: 66

npm failed with error code: 1 in azure devops testing pipeline

reference:

https://medium.com/@flu.lund/automated-angular-unit-testing-on-visual-studio-team-services-22c03497265c

I have refer above blog link and followed step to Automated Angular Unit Testing and publish test Result.

as per blog guideline i have followed below step.

step 1

Installed below packages.

  1. npm install phantomjs-prebuilt --save-dev
  2. npm install karma-phantomjs-launcher --save-dev
  3. npm install karma-junit-reporter --save-dev

step 2

Then i have added some configuration in karma.conf.js

  1. require('karma-coverage-istanbul-reporter'), // <- Add plugin
  2. require('karma-junit-reporter'), // <- Add plugin
  3. browsers: ['Chrome', 'PhantomJS'], // <- Add browser

step 3

Then i added script in package.json

"scripts": {
    ...
    "test-single-headless": "ng test --single-run=true --browsers=PhantomJS --reporters=progress,junit",
    ...
  },

step 4

I added below three line in polyfills.ts file

import 'core-js/es6/object';
import 'core-js/es6/string';
import 'core-js/es6/array';

step 5

Added pipeline task you can see in below screenshot.

enter image description here

step 6

after setup all configure all thing as par blog guideline finally i run build.

getting issue is

Then i go to the result log it work form first task to build task result getting success.

when result's come to the " Run test " task.

It will show one Error in "Run test task log ". which i have attached below screenshot.

enter image description here

Please check my step and help me in this issue. i'm facing this issue since last few days.

Upvotes: 0

Views: 14909

Answers (1)

Mitul Patel
Mitul Patel

Reputation: 66

as of now phantomjs is no longer support now, it is deprecated i have used 'ChromeHeadless' browser instead of 'Phantomjs' then it's worked fine for me.

if any test case is failed also build will be failed. so u can solved all case then it will work.

if anyone get this issue Please make changes as per above it will helpful.

Upvotes: 0

Related Questions