Skip to content

Instantly share code, notes, and snippets.

@matt-ball
Created September 23, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-ball/29bacdee7c90b66c7e11770fec415b42 to your computer and use it in GitHub Desktop.
Save matt-ball/29bacdee7c90b66c7e11770fec415b42 to your computer and use it in GitHub Desktop.
Run Newman Asynchronously Cleanly
const newman = require('newman')
const config = [{
collection: 'collection_one.json',
environment: 'env_one.json'
}, {
collection: 'collection_two.json',
environment: 'env_two.json'
}]
const runs = config.map((cfg, i) => {
return new Promise((resolve, reject) => {
newman.run(cfg, (err, summary) => {
if (err) reject(err)
else resolve(summary)
})
})
})
Promise.all(runs).then((results) => {
console.log(results)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment