Skip to content

Commit

Permalink
fix(app): wrong additional folder provided, exit with code 0
Browse files Browse the repository at this point in the history
fix #1146
  • Loading branch information
vogloblinsky committed Dec 6, 2021
1 parent 2b6af73 commit 15fd3de
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/application.ts
Expand Up @@ -239,6 +239,7 @@ export class Application {
},
errorMessage => {
logger.error(errorMessage);
process.exit(0);
}
);
},
Expand All @@ -251,6 +252,7 @@ export class Application {
},
errorMessage1 => {
logger.error(errorMessage1);
process.exit(0);
}
);
}
Expand Down
41 changes: 40 additions & 1 deletion test/src/cli/cli-additional.spec.ts
@@ -1,6 +1,6 @@
const eol = require('os').EOL;
import * as chai from 'chai';
import { temporaryDir, shell, pkg, exists, exec, read, shellAsync } from '../helpers';
import { temporaryDir, shell, spawn, exists, read, exec } from '../helpers';

const expect = chai.expect;
const tmp = temporaryDir();
Expand Down Expand Up @@ -85,4 +85,43 @@ describe('CLI Additional documentation', () => {
`<li class="link for-chapter3">${eol} <a href="additional-documentation/edition/edition-of-a-todo/edit-level3.html" data-type="entity-link" data-context="sub-entity" data-context-id="additional">edit-level3</a>${eol} </li>${eol} <li class="link for-chapter4">${eol} <a href="additional-documentation/edition/edition-of-a-todo/edit-level3/edit-level4.html" data-type="entity-link" data-context="sub-entity" data-context-id="additional">edit-level4</a>`
);
});

it('should exit with code 0 if wrong folder provided', () => {});
});

describe('CLI Additional documentation - wrong folder', () => {
let exitCode = 1;

const distFolder = tmp.name + '-additional-wrong-folder';

before(done => {
tmp.create(distFolder);
const ls = exec(
'node' +
[
'',
'./bin/index-cli.js',
'-p',
'./test/fixtures/todomvc-ng2/src/tsconfig.json',
'-d',
distFolder,
'-a',
'./test/fixtures/todomvc-ng2/screenshots',
'--includes',
'./test/fixtures/todomvc-ng2/additional-doc-wrong',
'--includesName',
'"Additional documentation"'
].join(' ')
);
ls.on('close', code => {
exitCode = code;
done();
});
});
after(() => tmp.clean(distFolder));

it('should exit with code 0 if wrong folder provided', () => {
expect(exitCode).to.equal(0);
// expect(stderrString).to.contain('Error during Additional documentation generation');
});
});

0 comments on commit 15fd3de

Please sign in to comment.