mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 16:04:04 +00:00
feat: support run single test
This commit is contained in:
19
test/unit/selector.js
Normal file
19
test/unit/selector.js
Normal 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);
|
||||
});
|
Reference in New Issue
Block a user