Skip to content

Commit 15fd3de

Browse files
committed
fix(app): wrong additional folder provided, exit with code 0
fix #1146
1 parent 2b6af73 commit 15fd3de

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/app/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export class Application {
239239
},
240240
errorMessage => {
241241
logger.error(errorMessage);
242+
process.exit(0);
242243
}
243244
);
244245
},
@@ -251,6 +252,7 @@ export class Application {
251252
},
252253
errorMessage1 => {
253254
logger.error(errorMessage1);
255+
process.exit(0);
254256
}
255257
);
256258
}

test/src/cli/cli-additional.spec.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const eol = require('os').EOL;
22
import * as chai from 'chai';
3-
import { temporaryDir, shell, pkg, exists, exec, read, shellAsync } from '../helpers';
3+
import { temporaryDir, shell, spawn, exists, read, exec } from '../helpers';
44

55
const expect = chai.expect;
66
const tmp = temporaryDir();
@@ -85,4 +85,43 @@ describe('CLI Additional documentation', () => {
8585
`<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>`
8686
);
8787
});
88+
89+
it('should exit with code 0 if wrong folder provided', () => {});
90+
});
91+
92+
describe('CLI Additional documentation - wrong folder', () => {
93+
let exitCode = 1;
94+
95+
const distFolder = tmp.name + '-additional-wrong-folder';
96+
97+
before(done => {
98+
tmp.create(distFolder);
99+
const ls = exec(
100+
'node' +
101+
[
102+
'',
103+
'./bin/index-cli.js',
104+
'-p',
105+
'./test/fixtures/todomvc-ng2/src/tsconfig.json',
106+
'-d',
107+
distFolder,
108+
'-a',
109+
'./test/fixtures/todomvc-ng2/screenshots',
110+
'--includes',
111+
'./test/fixtures/todomvc-ng2/additional-doc-wrong',
112+
'--includesName',
113+
'"Additional documentation"'
114+
].join(' ')
115+
);
116+
ls.on('close', code => {
117+
exitCode = code;
118+
done();
119+
});
120+
});
121+
after(() => tmp.clean(distFolder));
122+
123+
it('should exit with code 0 if wrong folder provided', () => {
124+
expect(exitCode).to.equal(0);
125+
// expect(stderrString).to.contain('Error during Additional documentation generation');
126+
});
88127
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy