Skip to content

Commit 04d22f2

Browse files
Update get-props test to be able to run in CI
In CI we put the working directory at /home/github/polaris/polaris This double use of /polaris isn't compatible with the path normalization that get-props does, it'll replace the first /polaris/ but not the second, and so the files won't end up matching the snapshots in the test file. To properly normalize this, we need to remove _any_ number of /polaris/ path components in a row. This didn't fail previously because this test wasn't part of a workspace so it was never run in CI
1 parent ca10747 commit 04d22f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

polaris.shopify.com/scripts/get-props/src/get-props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function normalizePath(path: string): string {
2424
if (normalizedPath.startsWith('.')) {
2525
normalizedPath = normalizedPath.replace(/^\.{1,2}\//, '');
2626
} else if (normalizedPath.includes('/polaris/')) {
27-
normalizedPath = normalizedPath.split('/polaris/')[1];
27+
normalizedPath = normalizedPath.split(/\/(polaris\/)+/).at(-1)!;
2828
} else if (normalizedPath.startsWith('/')) {
2929
normalizedPath = normalizedPath.replace('/', '');
3030
}

0 commit comments

Comments
 (0)