@@ -105,27 +105,27 @@ global.run_spec = (importMeta, parsers, options) => {
105105
106106 // this will only work for php tests (since we're in the php repo)
107107 if ( AST_COMPARE && parsers [ 0 ] === "php" ) {
108- test ( `${ filename } parse` , ( ) => {
109- const parseOptions = Object . assign ( { } , mainOptions ) ;
110- delete parseOptions . cursorOffset ;
111-
112- const originalAst = parse ( input , parseOptions ) ;
113- let formattedAst ;
114-
115- expect ( ( ) => {
116- formattedAst = parse (
117- output . replace ( CURSOR_PLACEHOLDER , "" ) ,
118- parseOptions
119- ) ;
120- } ) . not . toThrow ( ) ;
121- expect ( originalAst ) . toEqual ( formattedAst ) ;
108+ test ( `${ filename } parse` , async ( ) => {
109+ const parseOptions = { ...mainOptions , cursorOffset : undefined } ;
110+
111+ const originalAst = await parse ( input , parseOptions ) ;
112+ const formattedAst = await parse (
113+ output . replace ( CURSOR_PLACEHOLDER , "" ) ,
114+ parseOptions
115+ ) ;
116+
117+ expect ( originalAst ) . toBeDefined ( ) ;
118+ expect ( formattedAst ) . toEqual ( originalAst ) ;
122119 } ) ;
123120 }
124121 } ) ;
125122} ;
126123
127- function parse ( source , options ) {
128- return prettier . __debug . parse ( source , options , /* massage */ true ) . ast ;
124+ async function parse ( source , options ) {
125+ const { ast } = await prettier . __debug . parse ( source , options , {
126+ massage : true ,
127+ } ) ;
128+ return ast ;
129129}
130130
131131async function format ( source , filename , options ) {
0 commit comments