Browse Source

[Runner] fixed Gunner/Runner for newer version

master
Muthu Kumar 6 years ago
parent
commit
a6d557b24c
  1. 2
      package.json
  2. 21
      src/runner/index.js

2
package.json

@ -1,6 +1,6 @@
{
"name": "@klenty/gunner",
"version": "0.10.7",
"version": "0.11.0",
"description": "Zero magic, fast test-runner and assertion framework. No magic globals.",
"main": "es6/index.js",
"repository": {

21
src/runner/index.js

@ -1,7 +1,15 @@
const { flatten } = require('../util');
const reporters = require('../reporters');
const isBrowser =
new Function("try { return this === window } catch (e) { return false }");
const runner = instances => (options = {}) => {
if(isBrowser())
throw new Error(
'Runner is not adapted for browsers yet.'
+ ' Use regular Gunner');
instances = Array.isArray(instances) ? instances : [ instances ];
if(!instances.length)
@ -21,11 +29,18 @@ const runner = instances => (options = {}) => {
return Promise.all(RunInstances.map(instance => {
return (
instance
.run(options)
.run({ reporter: 'min' })
);
}))
.then(results => {
return flatten(results);
return options.request
? {
default: results,
[options.request]: reporters[options.request].convert(results)
}
: results;
});
};

Loading…
Cancel
Save