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(
53
53
const goldenFilePath = path . join ( goldenDir , goldenName ) ;
54
54
const moduleName = normalizePathToPosix ( path . join ( packageJson . name , subpath ) ) ;
55
55
56
- const expected = fs . readFileSync ( goldenFilePath , 'utf8' ) ;
57
56
const actual = await testApiGolden (
58
57
typesEntryPointPath ,
59
58
stripExportPattern ,
@@ -67,17 +66,17 @@ async function main(
67
66
process . exit ( 1 ) ;
68
67
}
69
68
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.
76
76
outdatedGoldens . push ( goldenName ) ;
77
+ allTestsSucceeding = false ;
77
78
}
78
79
}
79
-
80
- allTestsSucceeding = allTestsSucceeding && actual === expected ;
81
80
}
82
81
83
82
if ( outdatedGoldens . length ) {
You can’t perform that action at this time.
0 commit comments