mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Merge pull request #4160 from patrickheeney/custom-cli
Allow custom CLI class instances
This commit is contained in:
commit
184f99ff2e
@ -49,7 +49,7 @@ class Serverless {
|
||||
|
||||
init() {
|
||||
// create a new CLI instance
|
||||
this.cli = new CLI(this);
|
||||
this.cli = new this.classes.CLI(this);
|
||||
|
||||
// get an array of commands and options that should be processed
|
||||
this.processedInput = this.cli.processInput();
|
||||
|
||||
@ -115,6 +115,14 @@ describe('Serverless', () => {
|
||||
expect(serverless.cli).to.be.instanceof(CLI);
|
||||
});
|
||||
|
||||
it('should allow a custom CLI instance', () => {
|
||||
class CustomCLI extends CLI {}
|
||||
serverless.classes.CLI = CustomCLI;
|
||||
serverless.init();
|
||||
expect(serverless.cli).to.be.instanceof(CLI);
|
||||
expect(serverless.cli.constructor.name).to.equal('CustomCLI');
|
||||
});
|
||||
|
||||
// note: we just test that the processedInput variable is set (not the content of it)
|
||||
// the test for the correct input is done in the CLI class test file
|
||||
it('should receive the processed input form the CLI instance', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user