@@ -3,9 +3,6 @@ import * as babel from '@babel/core';
3
3
import { readFile } from 'fs-extra' ;
4
4
import glob from 'fast-glob' ;
5
5
6
- const workspaceRoot = path . join ( __dirname , '../../../' ) ;
7
- const babelConfigPath = path . join ( workspaceRoot , 'babel.config.js' ) ;
8
-
9
6
function getTestFilesNames ( filepath : string ) {
10
7
return glob . sync (
11
8
path
@@ -18,15 +15,14 @@ function getTestFilesNames(filepath: string) {
18
15
) ;
19
16
}
20
17
21
- async function parseWithConfig ( filename : string , configFilePath : string ) {
18
+ async function parseWithConfig ( filename : string ) {
22
19
const source = await readFile ( filename , { encoding : 'utf8' } ) ;
23
20
const partialConfig = babel . loadPartialConfig ( {
24
- configFile : configFilePath ,
25
21
filename,
26
22
} ) ;
27
23
28
24
if ( partialConfig === null ) {
29
- throw new Error ( `Could not load a babel config for ${ filename } located at ${ configFilePath } .` ) ;
25
+ throw new Error ( `Could not load a babel config for ${ filename } .` ) ;
30
26
}
31
27
32
28
return babel . parseAsync ( source , partialConfig . options ) ;
@@ -139,15 +135,19 @@ export default async function parseTest(componentFilename: string): Promise<Pars
139
135
140
136
let descriptor : ReturnType < typeof findConformanceDescriptor > = null ;
141
137
142
- // eslint-disable-next-line no-restricted-syntax
143
- for await ( const testFilename of testFilenames ) {
144
- if ( descriptor === null ) {
145
- const babelParseResult = await parseWithConfig ( testFilename , babelConfigPath ) ;
146
- if ( babelParseResult === null ) {
147
- throw new Error ( `Could not parse ${ testFilename } .` ) ;
138
+ try {
139
+ // eslint-disable-next-line no-restricted-syntax
140
+ for await ( const testFilename of testFilenames ) {
141
+ if ( descriptor === null ) {
142
+ const babelParseResult = await parseWithConfig ( testFilename ) ;
143
+ if ( babelParseResult === null ) {
144
+ throw new Error ( `Could not parse ${ testFilename } .` ) ;
145
+ }
146
+ descriptor = findConformanceDescriptor ( babelParseResult ) ;
148
147
}
149
- descriptor = findConformanceDescriptor ( babelParseResult ) ;
150
148
}
149
+ } catch ( error ) {
150
+ console . error ( error ) ;
151
151
}
152
152
153
153
const result : ParseResult = {
0 commit comments