我想newman
从 node.js 模块执行,但它不起作用。并且没有显示错误。
从命令行运行良好
newman run postman-tests/collection.json -e postman-tests/environment.json
// newman installed globally for this command
但波纹管节点模块代码不起作用:
var newman = require('newman'),
Promise = require('bluebird'),
newmanRun = Promise.promisify(newman.run);
//.. other working grunt task here ...
// added new task postman-test
grunt.registerTask('postman-test','postman task running ', function() {
Promise.coroutine(function*() {
try {
console.log('test start-----');
var response = yield newmanRun({
collection: require('./postman-tests/collection.json'),
environment: require('./postman-tests/environment.json'),
reporters: 'cli'
});
console.log('run complete-----', response);
} catch (e) {
console.log('postman test catch error: ', e);
}
})();
});
当我运行仅在控制台中显示的“grunt postman-test”命令"test start-----"
并显示Done, without errors.
但不执行测试时
我的代码有什么问题?谁能帮我?