mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-23 15:36:23 +08:00
parent
b62e3f6721
commit
6870be2029
@ -152,30 +152,33 @@ export abstract class SchematicCommand extends Command {
|
|||||||
logger: this.logger as any,
|
logger: this.logger as any,
|
||||||
allowPrivate: this.allowPrivateSchematics,
|
allowPrivate: this.allowPrivateSchematics,
|
||||||
})
|
})
|
||||||
.subscribe({
|
.subscribe({
|
||||||
error: (err: Error) => {
|
error: (err: Error) => {
|
||||||
// In case the workflow was not successful, show an appropriate error message.
|
// In case the workflow was not successful, show an appropriate error message.
|
||||||
if (err instanceof UnsuccessfulWorkflowExecution) {
|
if (err instanceof UnsuccessfulWorkflowExecution) {
|
||||||
// "See above" because we already printed the error.
|
// "See above" because we already printed the error.
|
||||||
this.logger.fatal('The Schematic workflow failed. See above.');
|
this.logger.fatal('The Schematic workflow failed. See above.');
|
||||||
} else if (debug) {
|
} else if (debug) {
|
||||||
this.logger.fatal(`An error occured:\n${err.message}\n${err.stack}`);
|
this.logger.fatal(`An error occured:\n${err.message}\n${err.stack}`);
|
||||||
} else {
|
} else {
|
||||||
this.logger.fatal(err.message);
|
this.logger.fatal(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
reject(1);
|
reject(1);
|
||||||
},
|
},
|
||||||
complete: () => {
|
complete: () => {
|
||||||
// Output the logging queue, no error happened.
|
// Output the logging queue, no error happened.
|
||||||
loggingQueue.forEach(log => this.logger.info(log));
|
loggingQueue.forEach(log => this.logger.info(log));
|
||||||
|
|
||||||
if (nothingDone) {
|
if (nothingDone) {
|
||||||
this.logger.info('Nothing to be done.');
|
this.logger.info('Nothing to be done.');
|
||||||
}
|
}
|
||||||
resolve();
|
if (dryRun) {
|
||||||
},
|
this.logger.warn(`\nNOTE: Run with "dry run" no changes were made.`);
|
||||||
});
|
}
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,5 +4,10 @@ import {expectGitToBeClean} from '../../../utils/git';
|
|||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return ng('generate', 'service', 'test-service', '--module', 'app.module.ts', '--dry-run')
|
return ng('generate', 'service', 'test-service', '--module', 'app.module.ts', '--dry-run')
|
||||||
|
.then(({stdout}) => {
|
||||||
|
if (!/NOTE: Run with "dry run" no changes were made/.test(stdout)) {
|
||||||
|
throw 'Dry run warning not shown.';
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(() => expectGitToBeClean());
|
.then(() => expectGitToBeClean());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user