Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
run: pnpm i

- name: Build site
run: pnpm scripts run build
run: pnpm build

- name: ESLint
run: pnpm cli --filter vue-devui -- code-check -t eslint

- name: Unit test
run: pnpm scripts run tests.test
run: pnpm cli --filter vue-devui -- code-check -t unit-test
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ignore:
- packages/devui-cli/node_modules
# devui-theme
- packages/devui-theme/dist
- packages/devui-theme/build
- packages/devui-theme/node_modules
- packages/devui-theme/src/styles-var
# devui-vue
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"precommit": "lint-staged",
"scripts": "better-scripts",
"dev": "pnpm scripts run dev",
"build": "pnpm scripts run build"
"build": "pnpm scripts run build",
"build:lib": "pnpm scripts run build:lib",
"test": "pnpm scripts run tests.test"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
Expand Down
18 changes: 10 additions & 8 deletions packages/devui-vue/devui-cli/commands/code-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ const chalk = require('chalk');
const { isReadyToRelease } = require('../shared/utils');

const log = console.log;

const chalkEslint = chalk.hex('#4b32c3');

const chalkUnitTest = chalk.hex('#99425b');

const chalkError = chalk.hex('#F66F6A');

const chalkSuccess = chalk.hex('#3DCCA6');

const entryDir = path.resolve(__dirname, '../../devui');

const unitTestFailedComponents = [];

const completeComponents = fs.readdirSync(entryDir).filter((name) => {
Expand Down Expand Up @@ -87,8 +81,16 @@ const unitTestSome = async (components) => {
};

const unitTestAll = async () => {
for (const name of completeComponents) {
await unitTestSingle(name);
// 单个组件执行单元测试,总耗时太长
// for (const name of completeComponents) {
// await unitTestSingle(name);
// }

const unitTestResult = await shell.exec('pnpm --filter vue-devui test --reporter default');
// 解决单元测试报错,但PR合入门禁不中断问题
if (/failed|ERR_/.test(unitTestResult.stderr)) {
shell.echo(chalkError('Error: Unit test failed.'));
shell.exit(1);
}

log(chalkSuccess('\nCongratulations, all components have passed the unit test!'));
Expand Down
6 changes: 3 additions & 3 deletions scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"build": {
"alias": "Build",
"desc": "Build theme and docs",
"command": "pnpm --filter vue-devui build"
"command": "pnpm --filter vue-devui build --reporter default"
},
"build:lib": {
"alias": "Build lib",
"desc": "Build components and release",
"command": "pnpm --filter vue-devui build:lib"
"command": "pnpm --filter vue-devui build:lib --reporter default"
},
"build:cli": {
"alias": "Build cli",
Expand All @@ -34,7 +34,7 @@
"alias": "Tests",
"desc": "Select a test script to run",
"scripts": {
"test": ["pnpm --filter vue-devui test", "Test vue-devui"],
"test": ["pnpm --filter vue-devui test --reporter default", "Test vue-devui"],
"coverage": ["pnpm --filter vue-devui coverage", "Test vue-devui and gen coverage"]
}
}
Expand Down