Skip to content

Commit c99d31a

Browse files
committed
fix(builder): always update snapshots regardless of versions.ts changes
- Fix critical logic bug where snapshots weren't updated when versions.ts was already current - Ensures snapshots always match current package versions - Resolves snapshot test failures in changesets PRs like #116 - Snapshots are now updated unconditionally to prevent stale snapshot issues
1 parent 7126d24 commit c99d31a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

scripts/update-export-versions.cjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ const updateVersionsFile = () => {
7777
if (versionsUpdated) {
7878
fs.writeFileSync(versionsFilePath, fileContent, 'utf8');
7979
console.log('\n🎉 Successfully synchronized versions.ts!');
80-
updateSnapshots();
8180
} else {
8281
console.log('\n✅ All versions in versions.ts are already up to date.');
8382
}
83+
84+
// Always update snapshots to ensure they match current versions
85+
console.log('\n📸 Ensuring snapshots match current versions...');
86+
updateSnapshots();
8487
};
8588

8689
const updateSnapshots = () => {
@@ -89,10 +92,13 @@ const updateSnapshots = () => {
8992

9093
try {
9194
// Update snapshots for the export tests specifically (these are the tests that use package versions)
92-
execSync('pnpm --filter @openzeppelin/contracts-ui-builder-app test src/export/__tests__/ -- -u', {
93-
cwd: path.resolve(__dirname, '..'),
94-
stdio: 'inherit',
95-
});
95+
execSync(
96+
'pnpm --filter @openzeppelin/contracts-ui-builder-app test src/export/__tests__/ -- -u',
97+
{
98+
cwd: path.resolve(__dirname, '..'),
99+
stdio: 'inherit',
100+
}
101+
);
96102
console.log('✅ Snapshots updated successfully!');
97103
} catch (error) {
98104
console.error('❌ Failed to update snapshots:', error.message);

0 commit comments

Comments
 (0)