Skip to content

Commit 372d8dd

Browse files
authored
chore: re-enable documenter snapshot tests (#57)
1 parent d2ecef8 commit 372d8dd

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

scripts/docs.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { dashCase, listPublicDirs, writeSourceFile } from "./utils.js";
99
const publicDirs = listPublicDirs("src");
1010
const targetDir = "lib/components/internal/api-docs";
1111

12-
const importedCoreComponents = ["icon"];
13-
1412
componentDocs();
1513
testUtilDocs();
1614

@@ -22,17 +20,8 @@ function validatePublicFiles(definitionFiles) {
2220
}
2321
}
2422

25-
function getNodeModulesInterfacePath(componentName) {
26-
return path.resolve("node_modules/@cloudscape-design/components", componentName, "interfaces.d.ts");
27-
}
28-
2923
function componentDocs() {
30-
const nodeModulesDependencyFilePaths = importedCoreComponents.map(getNodeModulesInterfacePath);
31-
const definitions = documentComponents(
32-
path.resolve("tsconfig.json"),
33-
"src/*/index.tsx",
34-
nodeModulesDependencyFilePaths,
35-
);
24+
const definitions = documentComponents(path.resolve("tsconfig.json"), "src/*/index.tsx");
3625
const outDir = path.join(targetDir, "components");
3726
const fileNames = definitions
3827
.filter((definition) => {

src/__tests__/__snapshots__/documenter.test.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ exports[`definition for avatar matches the snapshot > avatar 1`] = `
1010
"description": "Text to describe the avatar for assistive technology.
1111
When more than one avatar is used, provide a unique label for each.
1212
For example, "Avatar of John Doe" or "Avatar of generative AI assistant".
13-
If \`tooltipText\` is used make sure to include it in the \`ariaLabel\`.
14-
",
13+
14+
If \`tooltipText\` is used make sure to include it in the \`ariaLabel\`.",
1515
"name": "ariaLabel",
1616
"optional": false,
1717
"type": "string",
@@ -36,8 +36,8 @@ Use \`gen-ai\` for AI assistants and \`default\` otherwise.",
3636
"defaultValue": ""user-profile"",
3737
"description": "Specifies the icon to be displayed as Avatar.
3838
Use \`gen-ai\` icon for AI assistants. By default \`user-profile\` icon is used.
39-
If you set both \`iconName\` and \`initials\`, \`initials\` will take precedence.
40-
",
39+
40+
If you set both \`iconName\` and \`initials\`, \`initials\` will take precedence.",
4141
"inlineType": {
4242
"name": "IconProps.Name",
4343
"type": "union",
@@ -76,8 +76,8 @@ Use it to define initials that uniquely identify the avatar's owner.",
7676
},
7777
{
7878
"description": "The text content shown in the avatar's tooltip.
79-
When you use this property, make sure to include it in the \`ariaLabel\`.
80-
",
79+
80+
When you use this property, make sure to include it in the \`ariaLabel\`.",
8181
"name": "tooltipText",
8282
"optional": true,
8383
"type": "string",

src/__tests__/documenter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { expect, test } from "vitest";
44

55
import { getAllComponents, requireComponentDefinition } from "./utils";
66

7-
test.skip.each<string>(getAllComponents())(`definition for %s matches the snapshot`, (componentName: string) => {
7+
test.each<string>(getAllComponents())(`definition for %s matches the snapshot`, (componentName: string) => {
88
const definition = requireComponentDefinition(componentName);
99

1010
// overriding with a fake value so that when there are icon changes in components this test doesn't block it

0 commit comments

Comments
 (0)