@@ -4,7 +4,18 @@ import { writeFileSync } from 'node:fs';
4
4
import { collectSuites } from '../lib' ;
5
5
import type { Suites } from '../lib' ;
6
6
7
- function toSuitesList ( suites : Suites ) {
7
+ async function exists ( filePath : string ) {
8
+ const fullPath = path . resolve ( 'src' , 'benchmark' , filePath ) ;
9
+
10
+ try {
11
+ await fs . access ( fullPath ) ;
12
+ return true ;
13
+ } catch {
14
+ return false ;
15
+ }
16
+ }
17
+
18
+ async function toSuitesList ( suites : Suites ) {
8
19
let list = '' ;
9
20
10
21
for ( const [ fullPath , suite ] of Object . entries ( suites ) ) {
@@ -16,7 +27,9 @@ function toSuitesList(suites: Suites) {
16
27
const suiteName = suite . tasks [ i ] . name . replace ( suite . name , '' ) . trim ( ) ;
17
28
const workflowPath = `./suites/workflows/${ suiteId } -${ i + 1 } .json` ;
18
29
19
- list += `- [${ suiteName } ](${ workflowPath } )\n` ;
30
+ list += ( await exists ( workflowPath ) )
31
+ ? `- [${ suiteName } ](${ workflowPath } )\n`
32
+ : `- ${ suiteName } \n` ;
20
33
}
21
34
}
22
35
@@ -37,7 +50,7 @@ async function listSuites() {
37
50
const after = oldDoc . slice ( oldDoc . indexOf ( MARK_END ) ) ;
38
51
39
52
const suites = await collectSuites ( ) ;
40
- const suitesList = toSuitesList ( suites ) ;
53
+ const suitesList = await toSuitesList ( suites ) ;
41
54
42
55
const newDoc = [ before , suitesList , after ] . join ( '\n' ) ;
43
56
0 commit comments