Browse Source

[run] Support for multiple expect per test item

0.7.0-breaking-rewrite
Muthu Kumar 6 years ago
parent
commit
a7a7eedf4f
  1. 13
      gunner/lib/runTests.js
  2. 2
      package.json

13
gunner/lib/runTests.js

@ -1,11 +1,12 @@
'use strict'; 'use strict';
const { pass, fail } = require('../constants'); const { pass, fail } = require('./constants');
const runTests = tests => Promise.all(tests.map(test => const runTests = tests => Promise.all(tests.map(each => {
test.test() const pred = each.test();
.then(() => ({ description: test.description, result: pass })) return (Array.isArray(pred) ? Promise.all(pred) : pred)
.catch(e => ({ description: test.description, result: fail, error: e })) .then(() => ({ description: each.description, result: pass }))
)); .catch(e => ({ description: each.description, result: fail, error: e }));
}));
module.exports = runTests; module.exports = runTests;

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "@klenty/gunner", "name": "@klenty/gunner",
"version": "0.0.1", "version": "0.1.0",
"description": "Multi-strategy test runner.", "description": "Multi-strategy test runner.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

Loading…
Cancel
Save