Postman Packages throwing Object.eval error from Jenkins

Hi Team,

While using Packages in Scripts tab, I am able to run it from my local machine, but when I am running it through Jenkins, it is failing the tests where I am using these packages.

I am getting Object.eval sandbox-script.js:1:2

In package library I have added below code:

function verifyStatus(statusCode){
pm.test("Verify Response status code is "+statusCode, function () {
    pm.response.to.have.status(statusCode);
});

}
module.exports ={
    verifyStatus
}

And in one of my tests I am using it :

const verifyStatusCode = pm.require('@raj/verify-status-code');

verifyStatusCode.verifyStatus(200);

I am able to run it from my local but it is failing when I am running it from Jenkins.
Is it a bug or currently Postman does not support Packages run from Jenkins.

Hey @rajneesh.kaundal :wave:

Welcome to the Postman community :postman:

It depends what you mean by “running it in Jenkins”?

Are you using the Postman CLI or Newman to run the Collection?

Hi @danny-dainton I am using Newman.

Newman does not support that functionality.

The latest version of the Postman CLI does support that but only on specific plans.