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';
const { pass, fail } = require('../constants');
const { pass, fail } = require('./constants');
const runTests = tests => Promise.all(tests.map(test =>
test.test()
.then(() => ({ description: test.description, result: pass }))
.catch(e => ({ description: test.description, result: fail, error: e }))
));
const runTests = tests => Promise.all(tests.map(each => {
const pred = each.test();
return (Array.isArray(pred) ? Promise.all(pred) : pred)
.then(() => ({ description: each.description, result: pass }))
.catch(e => ({ description: each.description, result: fail, error: e }));
}));
module.exports = runTests;

2
package.json

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

Loading…
Cancel
Save