Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test case for --allowArbitraryExtensions. #4127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api-extractor/src/api/ExtractorMessageId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const enum ExtractorMessageId {
/**
* "Incorrect file type; API Extractor expects to analyze compiler outputs with the .d.ts file extension.
* Troubleshooting tips: `https://api-extractor.com/link/dts-error`"
*
* Note that this is suppressed by the allowArbitraryExtensions TSConfig option
*/
WrongInputFileType = 'ae-wrong-input-file-type'
}
Expand Down
4 changes: 4 additions & 0 deletions build-tests/api-extractor-test-04/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ fsx.emptyDirSync('temp');
// Run the TypeScript compiler
executeCommand('node node_modules/typescript/lib/tsc');

// Copy the arbitraryExtensionModule.d.xyz.ts declaration file to lib
console.log(`==> Copying arbitraryExtensionModule.d.xyz.ts to lib`);
fsx.copySync('src/arbitraryExtensionModule.d.xyz.ts', 'lib/arbitraryExtensionModule.d.xyz.ts');

// Run the API Extractor command-line
if (process.argv.indexOf('--production') >= 0) {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,9 @@ export declare enum RegularEnum {
*/
export declare const variableDeclaration: string;

/**
* @public
*/
export declare const variableFromArbitraryExtensionModule: string;

export { }
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,9 @@ export declare enum RegularEnum {
*/
export declare const variableDeclaration: string;

/**
* @public
*/
export declare const variableFromArbitraryExtensionModule: string;

export { }
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ export declare class PublicClass {

/* Excluded from this release type: variableDeclaration */

/**
* @public
*/
export declare const variableFromArbitraryExtensionModule: string;

export { }
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,9 @@ export declare enum RegularEnum {
*/
export declare const variableDeclaration: string;

/**
* @public
*/
export declare const variableFromArbitraryExtensionModule: string;

export { }
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,7 @@ export enum RegularEnum {
// @beta
export const variableDeclaration: string;

// @public (undocumented)
export const variableFromArbitraryExtensionModule: string;

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @public
*/
export declare const variableFromArbitraryExtensionModule: string;
2 changes: 2 additions & 0 deletions build-tests/api-extractor-test-04/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ export type ExportedAlias = AlphaClass;

export { IPublicComplexInterface } from './IPublicComplexInterface';

export { variableFromArbitraryExtensionModule } from './arbitraryExtensionModule.xyz';

export { Lib1Interface } from 'api-extractor-lib1-test';
5 changes: 3 additions & 2 deletions build-tests/api-extractor-test-04/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"esModuleInterop": true,
"types": [],
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"],
"outDir": "lib"
"outDir": "lib",
"allowArbitraryExtensions": true
},
"include": ["src/**/*.ts", "typings/tsd.d.ts"]
"include": ["src/**/*.ts", "typings/tsd.d.ts", "src/AlphaClass.tsz"]
iclanton marked this conversation as resolved.
Show resolved Hide resolved
}