chore: rename setup hook to run:before (#6363)

This commit is contained in:
Kevin Marrec 2019-09-05 10:45:39 +02:00 committed by Pooya Parsa
parent a972849406
commit 05a6efd1eb
2 changed files with 7 additions and 7 deletions

View File

@ -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] || '.')

View File

@ -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')