-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler-cli): support ignoring specific doc entries during …
…extraction (#55053) This commit adds support for ignoring specific doc entries when extracting doc entries. This allows us to drop e.g. `InputFunction` from the API docs, given that the `input` API entry holds all the relevant information. `InputFunction` only exists for type purposes in the `.d.ts`. PR Close #55053
- Loading branch information
1 parent
b63afb9
commit ee76001
Showing
5 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/compiler-cli/test/ngtsc/doc_extraction/docs_private_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {DocEntry} from '@angular/compiler-cli/src/ngtsc/docs/src/entities'; | ||
import {runInEachFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/testing'; | ||
|
||
import {NgtscTestEnvironment} from '../env'; | ||
|
||
runInEachFileSystem(() => { | ||
describe('ngtsc docs: @docsPrivate tag', () => { | ||
let env: NgtscTestEnvironment; | ||
|
||
beforeEach(() => { | ||
env = NgtscTestEnvironment.setup({}); | ||
env.tsconfig(); | ||
}); | ||
|
||
function test(input: string): DocEntry[] { | ||
env.write('index.ts', input); | ||
return env.driveDocsExtraction('index.ts'); | ||
} | ||
|
||
it('should omit constant annotated with `@docsPrivate`', () => { | ||
expect(test(` | ||
/** @docsPrivate <reason> */ | ||
export const bla = true; | ||
`)).toEqual([]); | ||
}); | ||
|
||
it('should omit class annotated with `@docsPrivate`', () => { | ||
expect(test(` | ||
/** @docsPrivate <reason> */ | ||
export class Bla {} | ||
`)).toEqual([]); | ||
}); | ||
|
||
it('should omit function annotated with `@docsPrivate`', () => { | ||
expect(test(` | ||
/** @docsPrivate <reason> */ | ||
export function bla() {}; | ||
`)).toEqual([]); | ||
}); | ||
|
||
it('should omit interface annotated with `@docsPrivate`', () => { | ||
expect(test(` | ||
/** @docsPrivate <reason> */ | ||
export interface BlaFunction {} | ||
`)).toEqual([]); | ||
}); | ||
|
||
it('should error if marked as private without reasoning', () => { | ||
expect(() => test(` | ||
/** @docsPrivate */ | ||
export interface BlaFunction {} | ||
`)).toThrowError(/Entry "BlaFunction" is marked as "@docsPrivate" but without reasoning./); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters