You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
769 B

/* globals describe, it, before */
var messageLog = [];
var pr = function( msg ){
messageLog.push( msg );
// console.log( '--', msg );
}
function asyncFn( args ){
return function( cb ){
setTimeout( function(){
pr( args.msg );
if( args.error ){
if( args.isThrow ){
throw args.error;
} else {
return cb( args.error );
}
} else {
return cb( );
}
});
}
}
var beforeFn = asyncFn({
msg: 'Before_block',
delay: 100,
error: null,
});
var it1 = asyncFn({
msg: 'It_1',
delay: 10,
error: null,
});
var it2 = asyncFn({
msg: 'It_2',
delay: 500,
error: null,
});
describe( 'describe', function(){
before( beforeFn );
it( 'it1', it1 );
it( 'it2', it2 );
});