You would just replace you’re static require
statement with the URL of the Collection, using the Postman API.
It would be something like this:
const newman = require('newman');
newman.run({
collection: "https://api.getpostman.com/collections/{{collection_uid}}?apikey={{API_TOKEN}}",
environment: require('.\\Innovations odc Lab01.postman_environment.json'),
reporters: 'htmlextra',
reporter: {
htmlextra: {
export: '.\\htmlResults.html',
}
}
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});
You can also use the environment URL from the Postman API in the same way.