-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (36 loc) · 1.37 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* jslint node: true */
/* global featureFile, scenarios, steps */
// "use strict";
var path = require('path');
var Yadda = require('yadda');
Yadda.plugins.mocha.StepLevelPlugin.init();
// new Yadda.FeatureFileSearch('./test/unit/features').each(function(file) {
// featureFile(file, function(feature) {
// var library = require('./test/unit/steps/bottle.js');
// var yadda = Yadda.createInstance(library);
// scenarios(feature.scenarios, function(scenario) {
// steps(scenario.steps, function(step, done) {
// yadda.run(step, done);
// });
// });
// });
// });
new Yadda.FeatureFileSearch('./test/unit/features').each(function(file) {
// console.log(file)
featureFile(file, function(feature) {
var libraries = require_feature_libraries(feature);
var yadda = Yadda.createInstance(libraries);
scenarios(feature.scenarios, function(scenario) {
steps(scenario.steps, function(step,done) {
yadda.run(step,done);
});
});
});
});
function require_feature_libraries(feature) {
// console.log(`feature ${JSON.stringify(feature,null,2)}`)
return feature.annotations.step.split(', ').reduce(require_library, []);
}
function require_library(libraries, library) {
return libraries.concat(require('./test/unit/steps/' + library));
}