mocha-runnable-generators
使 mocha runables 带生成器,所以你可以做到(函数 *() )
用法
文件树:
测试/
索引.js
测试.js
索引.js
require ( 'mocha-runnable-generators' ) ;
测试.js
var q = require ( 'q' ) ;
it ( 'should wait' , function * ( ) {
yield q . Promise ( function ( resolve ) { // NOTE: This doens't test anything, just an example promise
setTimeout ( resolve , 100 ) ;
} ) ;
} ) ;
命令:
node --harmony ./node
1