@@ -811,14 +811,15 @@ suites.forEach(function (testSuite) {
811811 const actualCode = actual . code ;
812812
813813 if ( actualCode ) {
814- const actualAst = parse ( actualCode , {
814+ const parserOpts = {
815815 filename : actual . loc ,
816816 plugins : task . options . plugins || [ ] ,
817817 strictMode : task . options . strictMode === false ? false : true ,
818818 sourceType : "module" ,
819819 sourceMaps : ! ! task . sourceMap ,
820820 ...task . options . parserOpts ,
821- } ) ;
821+ } ;
822+ const actualAst = parse ( actualCode , parserOpts ) ;
822823 const options = {
823824 sourceFileName : path . relative (
824825 path . dirname ( fileURLToPath ( import . meta. url ) ) ,
@@ -832,7 +833,7 @@ suites.forEach(function (testSuite) {
832833 return generate ( actualAst , options , actualCode ) ;
833834 } ;
834835
835- const throwMsg = task . options . throws ;
836+ const throwMsg = options . throws ;
836837 if ( throwMsg ) {
837838 expect ( ( ) => run ( ) ) . toThrow (
838839 throwMsg === true ? undefined : throwMsg ,
@@ -864,6 +865,11 @@ suites.forEach(function (testSuite) {
864865 } else {
865866 try {
866867 expect ( result . code ) . toBe ( expected . code ) ;
868+ if ( ! options . expectedReParseError ) {
869+ expect ( ( ) => {
870+ parse ( result . code , parserOpts ) ;
871+ } ) . not . toThrow ( ) ;
872+ }
867873 } catch ( e ) {
868874 if ( ! process . env . OVERWRITE ) throw e ;
869875 console . log ( `Updated test file: ${ expected . loc } ` ) ;
0 commit comments