kef-kit-buffet
Version:
buffet kit
31 lines (28 loc) • 1.03 kB
JavaScript
// test/init.test.js
const path = require('path');
const Def = require('@ali/def-core');
const def = new Def({
'home': path.resolve('../.def'), // 设置 DEF Home
'silent': true, // 关闭 track\error report\notify 等测试期间不需要的功能
'disableCheckUpdate': true, // 关闭自动更新检查(测试期间不需要)
'store': { // 设置 DEF Store 目录
'storeDir': path.resolve('../node_modules'), // DEF Store 查找目录为项目下的 node_modules
'flatten': true // 使用拉平的目录结构
}
});
describe('.init', function() {
// 每个测试用例前都注册好模块
beforeEach(function* () {
yield def.init();
yield def.useKit('buffet', { // 注册为 cake 套件
'pkg': require('../package.json'),
'fn': require('../')
});
});
it('should init app', function* () {
yield def.run({
'argv': ['_', 'def', 'init', 'cake', '--app']
});
// assert here
});
});