Unit testing stage in jenkins is failing with below error,
22:26:53  > mocha app-test.js --timeout 10000 --reporter mocha-junit-reporter --exit
22:26:53
22:26:54  (node:311670) [MONGOOSE] DeprecationWarning: Mongoose: the strictQuery option will be switched back to false by default in Mongoose 7. Use mongoose.set('strictQuery', false); if you want to prepare for this change. Or use mongoose.set('strictQuery', true); to suppress this warning.
22:26:54  (Use node --trace-deprecation ... to show where the warning was created)
22:26:54  /jenkinsdata/devops_playground/gb-testing/gb-public-cicd/workspace/node_modules/mocha-junit-reporter/index.js:217
22:26:54      return testsuites[testsuites.length - 1].testsuite;
22:26:54                                               ^
22:26:54
22:26:54  TypeError: Cannot read properties of undefined (reading ‘testsuite’)
22:26:54      at lastSuite (/jenkinsdata/devops_playground/gb-testing/gb-public-cicd/workspace/node_modules/mocha-junit-reporter/index.js:217:46)
22:26:54      at MochaJUnitReporter. (/jenkinsdata/devops_playground/gb-testing/gb-public-cicd/workspace/node_modules/mocha-junit-reporter/index.js:262:5)
22:26:54      at Runner.emit (node:events:519:35)
22:26:54      at Runner.fail (/jenkinsdata/devops_playground/gb-testing/gb-public-cicd/workspace/node_modules/mocha/lib/runner.js:502:8)
22:26:54      at Runner._uncaught (/jenkinsdata/devops_playground/gb-testing/gb-public-cicd/workspace/node_modules/mocha/lib/runner.js:1032:12)
22:26:54      at process.emit (node:events:507:28)
22:26:54      at process._fatalException (node:internal/process/execution:154:25)
22:26:54
22:26:54  Node.js v23.8.0
But working fine in local,
npm test
Solar [email protected] test
mocha app-test.js --timeout 10000 --reporter mocha-junit-reporter --exit
(node:21064) [MONGOOSE] DeprecationWarning: Mongoose: the strictQuery option will be switched back to false by default in Mongoose 7. Use mongoose.set('strictQuery', false); if you want to prepare for this change. Or use mongoose.set('strictQuery', true); to suppress this warning.
(Use node --trace-deprecation ... to show where the warning was created)
Server successfully running on port - 3000
PS solar-system-23> echo $?
True
Can anyone suggest something here?