File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,15 +13,23 @@ export async function parse(this: WorkerMetaContext, options: ReadSpecsOptions)
1313 const normalizeSpecPath = path . normalize ( spec )
1414 this . log . debug ( `Parse spec file: ${ normalizeSpecPath } ` )
1515 const contents = await fs . readFile ( normalizeSpecPath , { encoding : 'utf8' } )
16+ try {
17+ const testCases = isCucumberFeatureFile ( normalizeSpecPath )
18+ ? parseCucumberFeature . call ( this , contents , normalizeSpecPath ) // Parse Cucumber feature file
19+ : parseTestCases . call ( this , contents , normalizeSpecPath ) // Parse JavaScript/TypeScript test file
1620
17- const testCases = isCucumberFeatureFile ( normalizeSpecPath )
18- ? parseCucumberFeature . call ( this , contents , normalizeSpecPath ) // Parse Cucumber feature file
19- : parseTestCases . call ( this , contents , normalizeSpecPath ) // Parse JavaScript/TypeScript test file
20-
21- this . log . debug ( `Successfully parsed: ${ normalizeSpecPath } ` )
22- return {
23- spec : normalizeSpecPath ,
24- tests : testCases ,
21+ this . log . debug ( `Successfully parsed: ${ normalizeSpecPath } ` )
22+ return {
23+ spec : normalizeSpecPath ,
24+ tests : testCases ,
25+ }
26+ } catch ( error ) {
27+ const errorMessage = error instanceof Error ?error . message : String ( error )
28+ this . log . error ( `Parse error: ${ errorMessage } ` )
29+ return {
30+ spec : normalizeSpecPath ,
31+ tests : [ ] ,
32+ }
2533 }
2634 } )
2735 )
You can’t perform that action at this time.
0 commit comments