Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stupid-gorillas-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-icons': patch
---

Added better error documentation on icon validation
12 changes: 8 additions & 4 deletions polaris-icons/tests/validate-svg-content.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ const allIconFiles = globby

const iconSource = fs.readFileSync(absoluteIconPath, 'utf-8');

const {viewbox, colors} = configPerSet.get([set].filter(Boolean).join('_'));

const svg = configPerSet.get([set].filter(Boolean).join('_'));
if (svg == null) {
throw new Error(
`SVG config not found for ${absoluteIconPath}. Make sure your icon contains "Major" or "Minor" in its name.`,
);
}
return {
iconPath: path.relative(path.join(__dirname, '..'), absoluteIconPath),
iconSource,
iconAst: unified()
.use(parse, {fragment: true, space: 'svg'})
.parse(iconSource),
expectedViewbox: viewbox,
expectedFillColors: colors,
expectedViewbox: svg.viewbox,
expectedFillColors: svg.colors,
};
});

Expand Down