feat: support run single test

This commit is contained in:
陈嘉涵
2017-08-24 20:36:42 +08:00
parent c6b8de3541
commit 057049c15a
5 changed files with 126 additions and 93 deletions

19
test/unit/selector.js Normal file
View File

@@ -0,0 +1,19 @@
/**
* 运行单个测试文件
*/
const fs = require('fs');
const inquirer = require('inquirer');
const path = require('path');
const shell = require('shelljs');
const files = fs.readdirSync(path.resolve(__dirname, './specs'));
inquirer.prompt([{
type: 'list',
name: 'select',
message: '请选择要运行的测试文件:',
choices: files
}], (result) => {
const file = result.select.replace('.spec.js', '');
shell.exec('karma start test/unit/karma.conf.js --color alway --file ' + file);
});