Jenkins pipeline fails on npm test with mocha-junit-reporter: TypeError: Cannot read properties of undefined (reading 'testsuite')

jenkins Pipelines
Level: Associate
chapter
Unit Testing and Analyze JUnit Reports

What does your Jenkinsfile look like for this job? The most common reason for this the nodejs code is not getting access to the environment variables it needs to run. So either you are not passing those variables in Jenkins correctly, or the credentials you are using are wrong.

@rob_kodekloud Thanks for your support! :raised_hands: You were absolutely right — the issue was with credentials not being passed correctly in Jenkins. After fixing the environment variable bindings and updating the correct credentials, unit test now running successfully. Appreciate your guidance!

1 Like