Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit cb53139

Browse files
Blackbaud-PaulCrowderBobby Earl
authored and
Bobby Earl
committed
Removed process.exit(0) from the generate module so the generate command can be passed through to plugins (#351)
* Removed process.exit(0) from generate() module the generate command can be passed through to plugins * Updated unit test to reflect new logic
1 parent d8a62d6 commit cb53139

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cli/generate.js

-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ function generate(argv) {
155155
generateComponent(name);
156156
break;
157157
}
158-
159-
process.exit(0);
160158
} catch (err) {
161159
process.exit(1);
162160
}

test/cli-generate.spec.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ describe('cli generate', () => {
7474
});
7575

7676
if (expectedExitCode === 0) {
77+
// process.exit() should not be called on success so that other Builder
78+
// plugins can tap into the generate command.
79+
expect(process.exit).not.toHaveBeenCalled();
80+
7781
expect(fsMock.ensureDirSync).toHaveBeenCalledWith(
7882
path.resolve('src', 'app', ...expectedPathParts)
7983
);
@@ -98,9 +102,9 @@ export class ${expectedClassName}`
98102

99103
validateSpecFile(`describe('${expectedDescribe}', () => {`);
100104
validateSpecFile(`const fixture = TestBed.createComponent(${expectedClassName});`);
105+
} else {
106+
expect(process.exit).toHaveBeenCalledWith(expectedExitCode);
101107
}
102-
103-
expect(process.exit).toHaveBeenCalledWith(expectedExitCode);
104108
}
105109

106110
afterEach(() => {

0 commit comments

Comments
 (0)