File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ async function main(
5353 const goldenFilePath = path . join ( goldenDir , goldenName ) ;
5454 const moduleName = normalizePathToPosix ( path . join ( packageJson . name , subpath ) ) ;
5555
56- const expected = fs . readFileSync ( goldenFilePath , 'utf8' ) ;
5756 const actual = await testApiGolden (
5857 typesEntryPointPath ,
5958 stripExportPattern ,
@@ -67,17 +66,17 @@ async function main(
6766 process . exit ( 1 ) ;
6867 }
6968
70- // Keep track of outdated goldens.
71- if ( actual !== expected ) {
72- if ( approveGolden ) {
73- fs . mkdirSync ( path . dirname ( goldenFilePath ) , { recursive : true } ) ;
74- fs . writeFileSync ( goldenFilePath , actual , 'utf8' ) ;
75- } else {
69+ if ( approveGolden ) {
70+ fs . mkdirSync ( path . dirname ( goldenFilePath ) , { recursive : true } ) ;
71+ fs . writeFileSync ( goldenFilePath , actual , 'utf8' ) ;
72+ } else {
73+ const expected = fs . readFileSync ( goldenFilePath , 'utf8' ) ;
74+ if ( actual !== expected ) {
75+ // Keep track of outdated goldens for error message.
7676 outdatedGoldens . push ( goldenName ) ;
77+ allTestsSucceeding = false ;
7778 }
7879 }
79-
80- allTestsSucceeding = allTestsSucceeding && actual === expected ;
8180 }
8281
8382 if ( outdatedGoldens . length ) {
You can’t perform that action at this time.
0 commit comments