File tree Expand file tree Collapse file tree 2 files changed +26
-13
lines changed
packages/angular/cli/models
tests/legacy-cli/e2e/tests/misc Expand file tree Collapse file tree 2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,11 @@ export async function runCommand(
115115
116116 // if no commands were found, use `help`.
117117 if ( commandName === undefined ) {
118- commandName = 'help' ;
118+ if ( args . length === 1 && args [ 0 ] === '--version' ) {
119+ commandName = 'version' ;
120+ } else {
121+ commandName = 'help' ;
122+ }
119123 }
120124
121125 let description : CommandDescription | null = null ;
Original file line number Diff line number Diff line change 1- import { deleteFile } from '../../utils/fs' ;
2- import { ng } from '../../utils/process' ;
3-
4-
5- export default function ( ) {
6- return ng ( 'version' )
7- . then ( ( ) => deleteFile ( 'angular.json' ) )
8- // doesn't fail on a project with missing angular.json
9- . then ( ( ) => ng ( 'version' ) )
10- // Doesn't fail outside a project.
11- . then ( ( ) => process . chdir ( '/' ) )
12- . then ( ( ) => ng ( 'version' ) ) ;
1+ import { deleteFile } from '../../utils/fs' ;
2+ import { ng } from '../../utils/process' ;
3+
4+
5+ export default async function ( ) {
6+ const { stdout : commandOutput } = await ng ( 'version' ) ;
7+ const { stdout : optionOutput } = await ng ( '--version' ) ;
8+ if ( ! optionOutput . includes ( 'Angular CLI:' ) ) {
9+ throw new Error ( 'version not displayed' ) ;
10+ }
11+ if ( commandOutput !== optionOutput ) {
12+ throw new Error ( 'version variants have differing output' ) ;
13+ }
14+
15+ // doesn't fail on a project with missing angular.json
16+ await deleteFile ( 'angular.json' ) ;
17+ await ng ( 'version' ) ;
18+
19+ // Doesn't fail outside a project.
20+ await process . chdir ( '/' ) ;
21+ await ng ( 'version' ) ;
1322}
You can’t perform that action at this time.
0 commit comments