flow = weir.create();
flow
.set('grep', /should run/)
.addContextProp('foo', 'bar')
.addContextProp('hello', 'world')
.hideContextProp('it', 'hello')
.addRootDescribe('subject', function() {
this.describe(function() {
this.describe(function() {
this.beforeEach(function() {
// this.foo = 'bar'
// this.hello = 'world';
});
this.it('should run', function() {
// this.foo = 'bar'
// this.hello = undefined
});
this.it('should not run', function() {
// ...
});
});
});
})
.run();
A
describe()
is about to run its collected steps.
flow.on('describePush', function(name) {
console.log('describe() started: %s', name);
});
A
describe()
finished its collected steps, including nesteddescribe()
if any.
flow.on('describePop', function(name) {
console.log('describe() finished: %s', name);
});
An
it()
step is about to run.
flow.on('itPush', function(name) {
console.log('it() started: %s', name);
});
An
it()
step finished.
flow.on('itPop', function(name) {
console.log('it() finished: %s', name);
});
Set a
describeWrap
function if you need to customize the context of each function passed todescribe()
.
flow.set('describeWrap', function (name, cb) {
var secretSauce = {};
// ...
cb.call(secretSauce);
});
Set an
itWrap
function if you need to customize the context of each function passed toit()
.
flow.set('itWrap', function(name, cb) {
var secretSauce = {};
// ...
cb.call(secretSauce);
});
// OR
flow.set('itWrap', function(name, cb, done) {
doSomethingAsync(function() {
var secretSauce = {};
// ...
cb.call(secretSauce);
done();
}):
});