Skip to content

Commit 7e4367f

Browse files
authored
chore: Migrate to new test-utils doc generator (#92)
1 parent 6211e4a commit 7e4367f

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

scripts/docs.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
import path from "node:path";
44

5-
import { documentTestUtils, writeComponentsDocumentation } from "@cloudscape-design/documenter";
6-
7-
import { writeSourceFile } from "./utils.js";
5+
import { writeComponentsDocumentation, writeTestUtilsDocumentation } from "@cloudscape-design/documenter";
86

97
const targetDir = "lib/components/internal/api-docs";
108

@@ -20,16 +18,16 @@ function componentDocs() {
2018
}
2119

2220
function testUtilDocs() {
23-
const tsconfig = path.resolve("src/test-utils/tsconfig.json");
24-
["dom", "selectors"].forEach((testUtilType) => {
25-
const componentWrapperDefinitions = documentTestUtils({ tsconfig }, `**/{${testUtilType},types}/**/*`);
26-
27-
const indexContent = `module.exports = {
28-
classes: ${JSON.stringify(componentWrapperDefinitions)}
29-
}
30-
`;
31-
32-
const outPath = path.join(targetDir, "test-utils-doc", `${testUtilType}.js`);
33-
writeSourceFile(outPath, indexContent);
21+
writeTestUtilsDocumentation({
22+
outDir: path.join(targetDir, "test-utils-doc"),
23+
tsconfigPath: path.resolve("src/test-utils/tsconfig.json"),
24+
domUtils: {
25+
root: "src/test-utils/dom/index.ts",
26+
extraExports: ["default", "ElementWrapper"],
27+
},
28+
selectorsUtils: {
29+
root: "src/test-utils/selectors/index.ts",
30+
extraExports: ["default", "ElementWrapper"],
31+
},
3432
});
3533
}

0 commit comments

Comments
 (0)