Skip to content

Commit 88a9229

Browse files
committed
fix: add back tests and allow for external topics
1 parent b27bf13 commit 88a9229

File tree

6 files changed

+2751
-120
lines changed

6 files changed

+2751
-120
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@semantic-release/changelog": "^5.0.0",
2323
"@semantic-release/git": "^9.0.0",
2424
"husky": "^4.2.3",
25+
"salesforcedx": "^48.4.1",
2526
"semantic-release": "^17.0.4"
2627
},
2728
"engines": {
@@ -49,7 +50,8 @@
4950
}
5051
},
5152
"devPlugins": [
52-
"@oclif/plugin-help"
53+
"@oclif/plugin-help",
54+
"salesforcedx"
5355
]
5456
},
5557
"repository": "forcedotcom/plugin-command-reference",
@@ -62,6 +64,7 @@
6264
"format": "yarn sfdx-format",
6365
"lint": "yarn sfdx-lint",
6466
"postpack": "rm -f oclif.manifest.json",
67+
"pretest": "./bin/run commandreference:generate --plugins salesforcedx --outputdir test/tmp",
6568
"posttest": "tslint -p test -t stylish",
6669
"prepack": "yarn sfdx-build",
6770
"test": "yarn sfdx-test",

src/ditamap/command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export class Command extends Ditamap {
2626
if (!flag.longDescription) {
2727
events.emit(
2828
'warning',
29-
`No flag longDescription for command ${chalk.bold(
30-
command.id
31-
)} on flag ${flagName}. That command owner must add the longDescription to the flag definition.`
29+
`No flag longDescription for command "${chalk.bold(command.id)}" on flag "${chalk.bold(
30+
flagName
31+
)}". That command owner must add the longDescription to the flag definition.`
3232
);
3333
}
3434
return Object.assign(flag, {

src/ditamap/main-topic-intro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class MainTopicIntro extends Ditamap {
2323
trailblazerCommunityName = community.name;
2424
}
2525

26-
if (!subTopicMeta.longDescription) {
26+
if (!subTopicMeta.longDescription && !subTopicMeta.external) {
2727
events.emit(
2828
'warning',
2929
`No long description for topic ${chalk.bold(

src/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Docs {
4848
public async populateTopic(topic: string, subtopics: Dictionary<Dictionary | Dictionary[]>) {
4949
const topicMeta = ensureJsonMap(this.topicMeta[topic]);
5050
let description = asString(topicMeta.longDescription);
51-
if (!description) {
51+
if (!description && !topicMeta.external) {
5252
description = asString(topicMeta.description);
5353
if (!description) {
5454
events.emit(

test/endtoend.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ function loadTestDitamapFile(path: string) {
2525
return readFileSync(join(testFilesPath, path), 'utf8');
2626
}
2727

28-
describe.skip('salesforcedx', () => {
28+
describe('salesforcedx', () => {
2929
before(async () => {
30-
await require('@oclif/command').run([
31-
'commandreference:generate',
32-
'--plugins',
33-
'salesforcedx',
34-
'--outputdir',
35-
testFilesPath
36-
]);
30+
try {
31+
await fs.access(testFilesPath);
32+
} catch (e) {
33+
throw new Error('Could not read generated test docs. Ensure the "pretest" has run or run it manually.');
34+
}
3735
});
3836
after(async () => {
3937
await fs.remove(testFilesPath);

0 commit comments

Comments
 (0)