diff --git a/src/hooks/command_not_found/myhook.ts b/src/hooks/command_not_found/myhook.ts index ad7625674b9..3f4077a2324 100644 --- a/src/hooks/command_not_found/myhook.ts +++ b/src/hooks/command_not_found/myhook.ts @@ -1,7 +1,7 @@ import {Hook} from '@oclif/core'; const hook: Hook<'command_not_found'> = async function (opts) { - if (opts.id === 'help') { process.stdout.write(`help hook running ${opts.id}\n`);} + if (opts.id === 'help') { process.stdout.write(`${opts.id} command not found.\n`);} }; export default hook; diff --git a/test/hooks/command_not_found/myhook.spec.ts b/test/hooks/command_not_found/myhook.spec.ts new file mode 100644 index 00000000000..bab80936b07 --- /dev/null +++ b/test/hooks/command_not_found/myhook.spec.ts @@ -0,0 +1,10 @@ +import {expect, test} from '@oclif/test'; + +describe('hooks', () => { + test + .stdout() + .hook('command_not_found', {id: 'help'}) + .do(output => expect(output.stdout).to.contain('help command not found.')) + .it('shows a message'); +}); + diff --git a/test/hooks/command_not_found/myhook.test.ts b/test/hooks/command_not_found/myhook.test.ts deleted file mode 100644 index 29e1413428d..00000000000 --- a/test/hooks/command_not_found/myhook.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {expect, test} from '@oclif/test'; - -describe('hooks', () => { - test - .stdout() - .hook('init', {id: 'mycommand'}) - .do(output => expect(output.stdout).to.contain('example hook running mycommand')) - .it('shows a message'); -});