From aa67851770431cc8220b4ce00f3625ba7bf66c75 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sat, 3 Feb 2018 14:04:07 -0800 Subject: [PATCH] fix: let command call the init hook --- src/config.ts | 1 - test/typescript.test.ts | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/config.ts b/src/config.ts index 56148cfc..c15f2fc9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -155,7 +155,6 @@ export class Config extends Plugin.Plugin implements IConfig { } async runCommand(id: string, argv: string[] = []) { - await this.runHook('init', {id}) debug('runCommand %s %o', id, argv) const cmd = this.findCommand(id, {must: true}).load() await this.runHook('prerun', {Command: cmd, argv}) diff --git a/test/typescript.test.ts b/test/typescript.test.ts index 5dca3377..77f1b7d0 100644 --- a/test/typescript.test.ts +++ b/test/typescript.test.ts @@ -20,8 +20,15 @@ describe('typescript', () => { withConfig .stdout() - .it('runs ts command init, and prerun hooks', async ctx => { + .it('runs ts command and prerun hooks', async ctx => { await ctx.config.runCommand('foo:bar:baz') - expect(ctx.stdout).to.equal('running ts init hook\nrunning ts prerun hook\nit works!\n') + expect(ctx.stdout).to.equal('running ts prerun hook\nit works!\n') + }) + + withConfig + .stdout() + .it('runs init hook', async ctx => { + await ctx.config.runHook('init', {id: 'foo'}) + expect(ctx.stdout).to.equal('running ts init hook\n') }) })