From 05a6efd1eb261aefde8301e4cd6e49e45ae67b0f Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Thu, 5 Sep 2019 10:45:39 +0200 Subject: [PATCH] chore: rename setup hook to run:before (#6363) --- packages/cli/src/command.js | 2 +- packages/cli/test/unit/hooks.test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/command.js b/packages/cli/src/command.js index 9850b4c716..08ca1dc938 100644 --- a/packages/cli/src/command.js +++ b/packages/cli/src/command.js @@ -36,7 +36,7 @@ export default class NuxtCommand extends Hookable { } async run () { - await this.callHook('setup', { + await this.callHook('run:before', { argv: this._argv, cmd: this.cmd, rootDir: path.resolve(this.argv._[0] || '.') diff --git a/packages/cli/test/unit/hooks.test.js b/packages/cli/test/unit/hooks.test.js index f9e8632191..6820139efc 100644 --- a/packages/cli/test/unit/hooks.test.js +++ b/packages/cli/test/unit/hooks.test.js @@ -10,28 +10,28 @@ describe('dev', () => { afterEach(() => jest.clearAllMocks()) - test('setup hook', async () => { + test('run:before hook', async () => { const hooks = { - setup: jest.fn() + 'run:before': jest.fn() } await NuxtCommand.run(dev, [], hooks) - expect(hooks.setup).toHaveBeenCalledWith({ + expect(hooks['run:before']).toHaveBeenCalledWith({ argv: [], cmd: dev, rootDir: path.resolve('.') }) }) - test('setup hook (custom CLI options & rootDir)', async () => { + test('run:before hook (custom CLI options & rootDir)', async () => { const hooks = { - setup: jest.fn() + 'run:before': jest.fn() } await NuxtCommand.run(dev, ['-p', '3001', 'path/to/project'], hooks) - expect(hooks.setup).toHaveBeenCalledWith({ + expect(hooks['run:before']).toHaveBeenCalledWith({ argv: ['-p', '3001', 'path/to/project'], cmd: dev, rootDir: path.resolve('path/to/project')