diff --git a/apps/api-extractor/build-tests.cmd b/apps/api-extractor/build-tests.cmd index f2ae7a2cc93..cc33d4a4554 100644 --- a/apps/api-extractor/build-tests.cmd +++ b/apps/api-extractor/build-tests.cmd @@ -1,3 +1,3 @@ @ECHO OFF @SETLOCAL -rush test -t api-extractor-lib1-test -t api-extractor-lib2-test -t api-extractor-lib3-test -t api-extractor-scenarios -t api-extractor-test-01 -t api-extractor-test-02 -t api-extractor-test-03 -t api-extractor-test-04 -t api-documenter-test +rush test -t tag:api-extractor-tests diff --git a/apps/api-extractor/src/generators/ApiReportGenerator.ts b/apps/api-extractor/src/generators/ApiReportGenerator.ts index 5ea92974d11..31f6e4ce0bb 100644 --- a/apps/api-extractor/src/generators/ApiReportGenerator.ts +++ b/apps/api-extractor/src/generators/ApiReportGenerator.ts @@ -259,7 +259,7 @@ export class ApiReportGenerator { ): void { // Should we process this declaration at all? // eslint-disable-next-line no-bitwise - if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) { + if (!ApiReportGenerator._shouldIncludeInReport(astDeclaration)) { span.modification.skipAll(); return; } @@ -402,23 +402,27 @@ export class ApiReportGenerator { astDeclaration ); - if (sortChildren) { - span.modification.sortChildren = true; - child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore( - childAstDeclaration.astSymbol.localName - ); - } + if (ApiReportGenerator._shouldIncludeInReport(childAstDeclaration)) { + if (sortChildren) { + span.modification.sortChildren = true; + child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore( + childAstDeclaration.astSymbol.localName + ); + } - if (!insideTypeLiteral) { - const messagesToReport: ExtractorMessage[] = - collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration); - const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis( - collector, - childAstDeclaration, - messagesToReport - ); + if (!insideTypeLiteral) { + const messagesToReport: ExtractorMessage[] = + collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration); - child.modification.prefix = aedocSynopsis + child.modification.prefix; + // NOTE: This generates ae-undocumented messages as a side effect + const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis( + collector, + childAstDeclaration, + messagesToReport + ); + + child.modification.prefix = aedocSynopsis + child.modification.prefix; + } } } @@ -427,6 +431,12 @@ export class ApiReportGenerator { } } + private static _shouldIncludeInReport(astDeclaration: AstDeclaration): boolean { + // Private declarations are not included in the API report + // eslint-disable-next-line no-bitwise + return (astDeclaration.modifierFlags & ts.ModifierFlags.Private) === 0; + } + /** * For declarations marked as `@preapproved`, this is used instead of _modifySpan(). */ diff --git a/common/changes/@microsoft/api-extractor/octogonz-ae-undocumented-fix_2023-10-13-23-13.json b/common/changes/@microsoft/api-extractor/octogonz-ae-undocumented-fix_2023-10-13-23-13.json new file mode 100644 index 00000000000..f56ef8a8b6e --- /dev/null +++ b/common/changes/@microsoft/api-extractor/octogonz-ae-undocumented-fix_2023-10-13-23-13.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/api-extractor", + "comment": "Fix an issue where \"ae-undocumented\" was incorrectly reported for private members", + "type": "patch" + } + ], + "packageName": "@microsoft/api-extractor" +} \ No newline at end of file diff --git a/rush.json b/rush.json index cae1e828681..2823a89fa45 100644 --- a/rush.json +++ b/rush.json @@ -483,61 +483,71 @@ "packageName": "api-documenter-test", "projectFolder": "build-tests/api-documenter-test", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-documenter-scenarios", "projectFolder": "build-tests/api-documenter-scenarios", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-lib1-test", "projectFolder": "build-tests/api-extractor-lib1-test", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-lib2-test", "projectFolder": "build-tests/api-extractor-lib2-test", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-lib3-test", "projectFolder": "build-tests/api-extractor-lib3-test", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-scenarios", "projectFolder": "build-tests/api-extractor-scenarios", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-test-01", "projectFolder": "build-tests/api-extractor-test-01", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-test-02", "projectFolder": "build-tests/api-extractor-test-02", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-test-03", "projectFolder": "build-tests/api-extractor-test-03", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "api-extractor-test-04", "projectFolder": "build-tests/api-extractor-test-04", "reviewCategory": "tests", - "shouldPublish": false + "shouldPublish": false, + "tags": ["api-extractor-tests"] }, { "packageName": "eslint-7-7-test",