优化前端 CI 测试分工并去除 AGC 重复执行
新增继承根配置的前端 CI 测试入口,排除由 AGC 专属任务执行的测试目录 增加实际测试文件集合校验,确保分组互斥且覆盖原有全量 同步更新 CI 工作流、开发运维文档和共享开发流程
This commit is contained in:
@@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createVitest } from 'vitest/node';
|
||||
|
||||
const workflow = readFileSync(
|
||||
resolve(process.cwd(), '.gitea/workflows/project-ci.yml'),
|
||||
@@ -397,7 +398,10 @@ describe('project CI workflow', () => {
|
||||
|
||||
it('keeps frontend, operations fixture, and native shell gates in dedicated jobs', () => {
|
||||
const frontendJob = jobSection('frontend-tests');
|
||||
expect(frontendJob).toContain('run: npm run test');
|
||||
expect(frontendJob).toMatch(/^ {8}run: npm run test:ci:frontend$/mu);
|
||||
expect(rootPackageJson.scripts?.['test:ci:frontend']).toBe(
|
||||
'vitest run --config vitest.frontend-ci.config.ts',
|
||||
);
|
||||
expect(frontendJob).toContain('run: npm run bgfilter-worker:smoke-test');
|
||||
expect(frontendJob).toContain(
|
||||
'run: npm run check:production-health-patrol',
|
||||
@@ -419,6 +423,39 @@ describe('project CI workflow', () => {
|
||||
expect(nativeJob).toContain('cargo fetch --locked');
|
||||
});
|
||||
|
||||
it('partitions frontend and AGC test files without gaps or duplicates', async () => {
|
||||
expect(rootPackageJson.scripts?.test).toBe('vitest run');
|
||||
const full = await createVitest('test', {
|
||||
config: resolve('vitest.config.ts'),
|
||||
watch: false,
|
||||
});
|
||||
try {
|
||||
const allFiles = (await full.globTestFiles()).map(([, file]) => file);
|
||||
const agcFiles = (
|
||||
await full.globTestFiles(['apps/ai-game-creator-shell/tests'])
|
||||
).map(([, file]) => file);
|
||||
const frontend = await createVitest('test', {
|
||||
config: resolve('vitest.frontend-ci.config.ts'),
|
||||
watch: false,
|
||||
});
|
||||
try {
|
||||
const frontendFiles = (await frontend.globTestFiles()).map(
|
||||
([, file]) => file,
|
||||
);
|
||||
expect(agcFiles.length).toBeGreaterThan(0);
|
||||
expect(frontendFiles.length).toBeGreaterThan(0);
|
||||
expect(frontendFiles.filter((file) => agcFiles.includes(file))).toEqual(
|
||||
[],
|
||||
);
|
||||
expect([...frontendFiles, ...agcFiles].sort()).toEqual(allFiles.sort());
|
||||
} finally {
|
||||
await frontend.close();
|
||||
}
|
||||
} finally {
|
||||
await full.close();
|
||||
}
|
||||
}, 30_000);
|
||||
|
||||
it('runs every native shell gate group exactly once across the split jobs', () => {
|
||||
for (const [group, script] of Object.entries(nativeShellGateGroupScripts)) {
|
||||
expect(rootPackageJson.scripts?.[`check:native-shells:${group}`]).toBe(
|
||||
|
||||
Reference in New Issue
Block a user