Skip to content

Commit e485167

Browse files
committed
chore: Migrate to new test-utils documenter
1 parent 5b14429 commit e485167

File tree

4 files changed

+26213
-69211
lines changed

4 files changed

+26213
-69211
lines changed

build-tools/tasks/docs.js

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
const path = require('path');
4-
const { writeComponentsDocumentation, documentTestUtils } = require('@cloudscape-design/documenter');
5-
const { writeFile } = require('../utils/files');
4+
const { writeComponentsDocumentation, writeTestUtilsDocumentation } = require('@cloudscape-design/documenter');
65
const workspace = require('../utils/workspace');
76

87
module.exports = function docs() {
98
writeComponentsDocumentation({
109
outDir: path.join(workspace.apiDocsPath, 'components'),
10+
1111
tsconfigPath: require.resolve('../../tsconfig.json'),
1212
publicFilesGlob: 'src/*/index.tsx',
1313
extraExports: {
1414
FileDropzone: ['useFilesDragging'],
1515
TagEditor: ['getTagsDiff'],
1616
},
1717
});
18-
testUtilDocs();
18+
writeTestUtilsDocumentation({
19+
outDir: path.join(workspace.apiDocsPath, 'test-utils-doc'),
20+
tsconfigPath: require.resolve('../../src/test-utils/tsconfig.json'),
21+
domUtils: {
22+
root: 'src/test-utils/dom/index.ts',
23+
extraExports: ['default', 'ElementWrapper'],
24+
},
25+
selectorsUtils: {
26+
root: 'src/test-utils/selectors/index.ts',
27+
extraExports: ['default', 'ElementWrapper'],
28+
},
29+
});
1930
return Promise.resolve();
2031
};
21-
22-
function testUtilDocs() {
23-
['dom', 'selectors'].forEach(testUtilType => {
24-
const baseWrapperDefinitions = require(`@cloudscape-design/test-utils-core/test-utils-doc/${testUtilType}`);
25-
const componentWrapperDefinitions = documentTestUtils(
26-
{
27-
tsconfig: require.resolve('../../src/test-utils/tsconfig.json'),
28-
},
29-
`**/{${testUtilType},types}/**/*`
30-
);
31-
32-
const definitions = [...baseWrapperDefinitions.classes, ...componentWrapperDefinitions];
33-
const indexContent = `module.exports = {
34-
classes: ${JSON.stringify(definitions)}
35-
}
36-
`;
37-
38-
const outPath = path.join(workspace.apiDocsPath, 'test-utils-doc', `${testUtilType}.js`);
39-
writeFile(outPath, indexContent);
40-
});
41-
}

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default tsEslint.config(
2525
includeIgnoreFile(path.resolve('.gitignore')),
2626
{
2727
// this code does not run, only used as a text content
28-
ignores: ['pages/code-editor/samples/**'],
28+
ignores: ['pages/code-editor/samples/**', 'test-utils-new'],
2929
},
3030
{
3131
settings: {

0 commit comments

Comments
 (0)