Skip to content

Commit 15922af

Browse files
committed
Convert more tests to use the new config file schema
1 parent 873a33b commit 15922af

File tree

8 files changed

+95
-84
lines changed

8 files changed

+95
-84
lines changed

apps/api-extractor/src/cli/RunAction.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ export class RunAction extends CommandLineAction {
122122
console.log(`Using configuration from ${configFilename}` + os.EOL + os.EOL);
123123
}
124124

125-
const mergedConfig: Partial<IExtractorConfig> = ExtractorConfig.loadJsonFileWithInheritance(configFilename);
125+
const configFullPath: string = path.resolve(configFilename);
126+
const mergedConfig: Partial<IExtractorConfig> = ExtractorConfig.loadJsonFileWithInheritance(configFullPath);
126127

127128
const extractorConfig: ExtractorConfig = ExtractorConfig.parseConfigObject({
128129
configObject: mergedConfig,
129-
configObjectFullPath: configFilename,
130-
packageJsonFullPath: lookup.tryGetPackageJsonFilePathFor(configFilename)
130+
configObjectFullPath: configFullPath,
131+
packageJsonFullPath: lookup.tryGetPackageJsonFilePathFor(configFullPath)
131132
});
132133

133134
const extractorResult: ExtractorResult = Extractor.invokeUsingConfig(extractorConfig,

build-tests/api-documenter-test/config/api-extractor.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

8-
"project": {
9-
"entryPointSourceFile": "lib/index.d.ts"
10+
"dtsRollup": {
11+
"enabled": false
1012
},
1113

12-
"apiJsonFile": {
14+
"docModel": {
1315
"enabled": true,
14-
"outputFolder": "etc"
16+
"apiJsonFilePath": "./etc/<unscopedPackageName>.api.json"
1517
},
1618

1719
"testMode": true

build-tests/api-extractor-lib1-test/config/api-extractor.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

810
"dtsRollup": {
9-
"enabled": true
11+
"enabled": true,
12+
13+
"untrimmedFilePath": "./dist/internal/<unscopedPackageName>.d.ts"
1014
},
1115

12-
"project": {
13-
"entryPointSourceFile": "lib/index.d.ts"
16+
"docModel": {
17+
"enabled": true
1418
},
1519

1620
"testMode": true

build-tests/api-extractor-lib2-test/config/api-extractor.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

810
"dtsRollup": {
9-
"enabled": true
11+
"enabled": true,
12+
13+
"untrimmedFilePath": "./dist/internal/<unscopedPackageName>.d.ts"
1014
},
1115

12-
"project": {
13-
"entryPointSourceFile": "lib/index.d.ts"
16+
"docModel": {
17+
"enabled": true
1418
},
1519

1620
"testMode": true

build-tests/api-extractor-lib3-test/config/api-extractor.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

810
"dtsRollup": {
9-
"enabled": true
11+
"enabled": true,
12+
13+
"untrimmedFilePath": "./dist/internal/<unscopedPackageName>.d.ts"
1014
},
1115

12-
"project": {
13-
"entryPointSourceFile": "lib/index.d.ts"
16+
"docModel": {
17+
"enabled": true
1418
},
1519

1620
"testMode": true

build-tests/api-extractor-scenarios/src/runScenarios.ts

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ function executeCommand(command: string, args: string[]): void {
77
console.log(`---> ${command} ${args.join(' ')}`);
88

99
// Redirect STDERR --> STDOUT since we don't want this warning to break the Rush build:
10-
// "You have changed the public API signature for this project"
10+
// 'You have changed the public API signature for this project'
1111
//
12-
// TODO: Remove this after the "Create an empty file" workaround below is removed
12+
// TODO: Remove this after the 'Create an empty file' workaround below is removed
1313
const result = Executable.spawnSync(command, args, { stdio: [ 0, 1, 1 ] });
1414

1515
if (result.error) {
@@ -29,58 +29,44 @@ export function runScenarios(buildConfigPath: string): void {
2929
// TODO: Eliminate this workaround
3030
// See GitHub issue https://github.com/Microsoft/web-build-tools/issues/1017
3131
for (const scenarioFolderName of buildConfig.scenarioFolderNames) {
32-
const apiExtractorJson =
33-
{
34-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
35-
"compiler" : {
36-
"configType": "tsconfig",
37-
"rootFolder": "."
38-
},
32+
const apiExtractorJson = {
33+
'$schema': 'https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json',
3934

40-
"apiReviewFile": {
41-
"enabled": true,
42-
"apiReviewFolder": `./etc/test-outputs/${scenarioFolderName}`,
43-
"tempFolder": "./temp"
44-
},
35+
'mainEntryPointFile': `./lib/${scenarioFolderName}/index.d.ts`,
4536

46-
"apiJsonFile": {
47-
"enabled": true,
48-
"outputFolder": `./etc/test-outputs/${scenarioFolderName}`
37+
'apiReport': {
38+
'enabled': true,
39+
'reportFolder': `./etc/test-outputs/${scenarioFolderName}`,
40+
'tempFolder': './temp'
4941
},
5042

51-
"dtsRollup": {
52-
"enabled": true,
53-
"trimming": false,
54-
55-
"publishFolder": ".",
56-
57-
"publishFolderForInternal": ".",
58-
"publishFolderForBeta": ".",
59-
"publishFolderForPublic": ".",
43+
'dtsRollup': {
44+
'enabled': true,
6045

61-
"mainDtsRollupPath": `./etc/test-outputs/${scenarioFolderName}/rollup.d.ts`
46+
'untrimmedFilePath': `./etc/test-outputs/${scenarioFolderName}/rollup.d.ts`
6247
},
6348

64-
"project": {
65-
"entryPointSourceFile": `./lib/${scenarioFolderName}/index.d.ts`
49+
'docModel': {
50+
'enabled': true,
51+
'apiJsonFilePath': `./etc/test-outputs/${scenarioFolderName}/<unscopedPackageName>.api.json`
6652
},
6753

68-
"messages": {
69-
"extractorMessageReporting": {
54+
'messages': {
55+
'extractorMessageReporting': {
7056
// For test purposes, write these warnings into .api.md
7157
// TODO: Capture the full list of warnings in the tracked test output file
72-
"ae-cyclic-inherit-doc": {
73-
"logLevel": "warning",
74-
"addToApiReviewFile": true
58+
'ae-cyclic-inherit-doc': {
59+
'logLevel': 'warning',
60+
'addToApiReviewFile': true
7561
},
76-
"ae-unresolved-link": {
77-
"logLevel": "warning",
78-
"addToApiReviewFile": true
62+
'ae-unresolved-link': {
63+
'logLevel': 'warning',
64+
'addToApiReviewFile': true
7965
}
8066
}
8167
},
8268

83-
"testMode": true
69+
'testMode': true
8470
};
8571

8672
const apiExtractorJsonPath: string = `./temp/configs/api-extractor-${scenarioFolderName}.json`;

build-tests/api-extractor-test-02/config/api-extractor.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

810
"dtsRollup": {
911
"enabled": true,
10-
"trimming": true
12+
13+
"untrimmedFilePath": "./dist/internal/<unscopedPackageName>.d.ts",
14+
"betaTrimmedFilePath": "./dist/beta/<unscopedPackageName>.d.ts",
15+
"publicTrimmedFilePath": "./dist/public/<unscopedPackageName>.d.ts",
1116
},
1217

13-
"project": {
14-
"entryPointSourceFile": "lib/index.d.ts"
18+
"docModel": {
19+
"enabled": true
1520
},
1621

1722
"testMode": true

build-tests/api-extractor-test-04/config/api-extractor.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3-
"compiler" : {
4-
"configType": "tsconfig",
5-
"rootFolder": "."
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFile": "lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
68
},
79

810
"dtsRollup": {
911
"enabled": true,
10-
"trimming": true
12+
13+
"untrimmedFilePath": "./dist/internal/<unscopedPackageName>.d.ts",
14+
"betaTrimmedFilePath": "./dist/beta/<unscopedPackageName>.d.ts",
15+
"publicTrimmedFilePath": "./dist/public/<unscopedPackageName>.d.ts",
1116
},
1217

13-
"project": {
14-
"entryPointSourceFile": "lib/index.d.ts"
18+
"docModel": {
19+
"enabled": true
1520
},
1621

1722
"testMode": true

0 commit comments

Comments
 (0)