Skip to content

Commit

Permalink
fix: add back tests and allow for external topics
Browse files Browse the repository at this point in the history
  • Loading branch information
amphro committed Mar 9, 2020
1 parent b27bf13 commit 88a9229
Show file tree
Hide file tree
Showing 6 changed files with 2,751 additions and 120 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@semantic-release/changelog": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"husky": "^4.2.3",
"salesforcedx": "^48.4.1",
"semantic-release": "^17.0.4"
},
"engines": {
Expand Down Expand Up @@ -49,7 +50,8 @@
}
},
"devPlugins": [
"@oclif/plugin-help"
"@oclif/plugin-help",
"salesforcedx"
]
},
"repository": "forcedotcom/plugin-command-reference",
Expand All @@ -62,6 +64,7 @@
"format": "yarn sfdx-format",
"lint": "yarn sfdx-lint",
"postpack": "rm -f oclif.manifest.json",
"pretest": "./bin/run commandreference:generate --plugins salesforcedx --outputdir test/tmp",
"posttest": "tslint -p test -t stylish",
"prepack": "yarn sfdx-build",
"test": "yarn sfdx-test",
Expand Down
6 changes: 3 additions & 3 deletions src/ditamap/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export class Command extends Ditamap {
if (!flag.longDescription) {
events.emit(
'warning',
`No flag longDescription for command ${chalk.bold(
command.id
)} on flag ${flagName}. That command owner must add the longDescription to the flag definition.`
`No flag longDescription for command "${chalk.bold(command.id)}" on flag "${chalk.bold(
flagName
)}". That command owner must add the longDescription to the flag definition.`
);
}
return Object.assign(flag, {
Expand Down
2 changes: 1 addition & 1 deletion src/ditamap/main-topic-intro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class MainTopicIntro extends Ditamap {
trailblazerCommunityName = community.name;
}

if (!subTopicMeta.longDescription) {
if (!subTopicMeta.longDescription && !subTopicMeta.external) {
events.emit(
'warning',
`No long description for topic ${chalk.bold(
Expand Down
2 changes: 1 addition & 1 deletion src/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Docs {
public async populateTopic(topic: string, subtopics: Dictionary<Dictionary | Dictionary[]>) {
const topicMeta = ensureJsonMap(this.topicMeta[topic]);
let description = asString(topicMeta.longDescription);
if (!description) {
if (!description && !topicMeta.external) {
description = asString(topicMeta.description);
if (!description) {
events.emit(
Expand Down
14 changes: 6 additions & 8 deletions test/endtoend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ function loadTestDitamapFile(path: string) {
return readFileSync(join(testFilesPath, path), 'utf8');
}

describe.skip('salesforcedx', () => {
describe('salesforcedx', () => {
before(async () => {
await require('@oclif/command').run([
'commandreference:generate',
'--plugins',
'salesforcedx',
'--outputdir',
testFilesPath
]);
try {
await fs.access(testFilesPath);
} catch (e) {
throw new Error('Could not read generated test docs. Ensure the "pretest" has run or run it manually.');
}
});
after(async () => {
await fs.remove(testFilesPath);
Expand Down
Loading

0 comments on commit 88a9229

Please sign in to comment.