Files
zhangxiang 0f8b29874f chore: 清理旧测试基础设施并添加新测试框架
- 清理废弃的 CI/CD 工作流文件与 dogfood 输出
- 添加 vitest 测试环境配置(mocks、setup 文件)
- 添加算法、服务、页面、工具类的单元测试
- 更新 vitest 配置、依赖与文档
2026-08-12 18:53:15 +08:00

100 lines
2.5 KiB
Groovy

pipeline {
agent any
environment {
NODE_VERSION = '20'
PROJECT_DIR = 'everything-is-suitable-uniapp'
}
stages {
stage('Install Dependencies') {
steps {
dir(env.PROJECT_DIR) {
sh 'npm ci'
}
}
}
stage('Lint') {
steps {
dir(env.PROJECT_DIR) {
sh 'npx eslint src/ --ext .ts,.vue --max-warnings 0 || true'
}
}
}
stage('Unit Tests') {
steps {
dir(env.PROJECT_DIR) {
sh 'npm run test:coverage'
}
}
post {
always {
dir(env.PROJECT_DIR) {
junit allowEmptyResults: true, testResults: 'coverage/junit.xml'
publishHTML(target: [
reportDir: 'coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report'
])
}
}
}
}
stage('Build H5') {
steps {
dir(env.PROJECT_DIR) {
sh 'npm run build:h5'
}
}
}
stage('Build WeChat Mini Program') {
when {
branch 'main'
}
steps {
dir(env.PROJECT_DIR) {
sh 'npm run build:mp-weixin'
}
}
}
stage('E2E Tests') {
steps {
dir(env.PROJECT_DIR) {
sh 'npx playwright install --with-deps chromium'
sh 'npm run test:e2e || true'
}
}
post {
always {
dir(env.PROJECT_DIR) {
publishHTML(target: [
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'E2E Report'
])
}
}
}
}
}
post {
always {
dir(env.PROJECT_DIR) {
cleanWs()
}
}
success {
echo 'Pipeline completed successfully'
}
failure {
echo 'Pipeline failed - check stage logs for details'
}
}
}