Created
September 23, 2019 23:18
-
-
Save matt-ball/29bacdee7c90b66c7e11770fec415b42 to your computer and use it in GitHub Desktop.
Run Newman Asynchronously Cleanly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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