diff --git a/src/plugin.ts b/src/plugin.ts index 0189df5..95f42a1 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -12,7 +12,8 @@ export default class StackOutputPlugin { private options: Serverless.Options ) { this.hooks = { - 'after:deploy:deploy': this.process.bind(this) + 'after:deploy:deploy': this.process.bind(this), + 'after:info:info': this.process.bind(this) } this.output = this.serverless.service.custom.output diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index 9cf369d..8c16ec6 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -80,4 +80,31 @@ describe('Plugin', () => { expect(test.file).toContain('foo/bar.toml') }) }) + + describe('Plugin attached to hooks', () => { + it('attached to after deploy and info hook', () => { + const config = { + cli: { log: () => null }, + config: { + servicePath: '' + }, + getProvider, + region: 'us-east-1', + service: { + custom: { + output: { + file: 'foo/bar.toml' + } + }, + provider: { + name: 'aws' + } + } + } + const test = new Plugin(config) + + expect(test.hooks).toHaveProperty('after:deploy:deploy') + expect(test.hooks).toHaveProperty('after:info:info') + }) + }) })