24 lines
668 B
TypeScript
24 lines
668 B
TypeScript
import { TestHistoryManager } from './src/utils/test-history';
|
|
|
|
const historyManager = new TestHistoryManager();
|
|
|
|
export async function globalTeardown(config: any, result: any) {
|
|
console.log('📊 记录测试执行历史...');
|
|
|
|
for (const suite of result.suites) {
|
|
for (const spec of suite.suites) {
|
|
for (const test of spec.tests) {
|
|
const testId = `${spec.file}::${test.title}`;
|
|
historyManager.recordExecution(
|
|
testId,
|
|
spec.file,
|
|
test.title,
|
|
test.results[0]?.duration || 0,
|
|
test.results[0]?.status === 'passed'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
console.log('✅ 历史记录完成');
|
|
} |