Skip to content

Commit a7fbe01

Browse files
authored
test: Fix flakey Playwright tests due to static assets (#13199)
Our playwright tests can be flakey caused by the build process when generating static assets. Even though we check if file exists before symlinking, it can at times fail because file already exists. I have not dug/thought about why this happens -- just catch/ignore and move on. Closes #11902
1 parent 5f3f531 commit a7fbe01

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dev-packages/browser-integration-tests/utils/staticAssets.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@ export function addStaticAssetSymlink(localOutPath: string, originalPath: string
2727

2828
// Only copy files once
2929
if (!fs.existsSync(newPath)) {
30-
fs.symlinkSync(originalPath, newPath);
30+
try {
31+
fs.symlinkSync(originalPath, newPath);
32+
} catch (error) {
33+
// There must be some race condition here as some of our tests flakey
34+
// because the file already exists. Let's catch and ignore
35+
// only ignore these kind of errors
36+
if (!`${error}`.includes('file already exists')) {
37+
throw error;
38+
}
39+
}
3140
}
3241

3342
symlinkAsset(newPath, path.join(localOutPath, fileName));

0 commit comments

Comments
 (0)