mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-02 10:27:15 +00:00
chore: rename setup hook to run:before (#6363)
This commit is contained in:
parent
a972849406
commit
05a6efd1eb
@ -36,7 +36,7 @@ export default class NuxtCommand extends Hookable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run () {
|
async run () {
|
||||||
await this.callHook('setup', {
|
await this.callHook('run:before', {
|
||||||
argv: this._argv,
|
argv: this._argv,
|
||||||
cmd: this.cmd,
|
cmd: this.cmd,
|
||||||
rootDir: path.resolve(this.argv._[0] || '.')
|
rootDir: path.resolve(this.argv._[0] || '.')
|
||||||
|
@ -10,28 +10,28 @@ describe('dev', () => {
|
|||||||
|
|
||||||
afterEach(() => jest.clearAllMocks())
|
afterEach(() => jest.clearAllMocks())
|
||||||
|
|
||||||
test('setup hook', async () => {
|
test('run:before hook', async () => {
|
||||||
const hooks = {
|
const hooks = {
|
||||||
setup: jest.fn()
|
'run:before': jest.fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
await NuxtCommand.run(dev, [], hooks)
|
await NuxtCommand.run(dev, [], hooks)
|
||||||
|
|
||||||
expect(hooks.setup).toHaveBeenCalledWith({
|
expect(hooks['run:before']).toHaveBeenCalledWith({
|
||||||
argv: [],
|
argv: [],
|
||||||
cmd: dev,
|
cmd: dev,
|
||||||
rootDir: path.resolve('.')
|
rootDir: path.resolve('.')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setup hook (custom CLI options & rootDir)', async () => {
|
test('run:before hook (custom CLI options & rootDir)', async () => {
|
||||||
const hooks = {
|
const hooks = {
|
||||||
setup: jest.fn()
|
'run:before': jest.fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
await NuxtCommand.run(dev, ['-p', '3001', 'path/to/project'], hooks)
|
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'],
|
argv: ['-p', '3001', 'path/to/project'],
|
||||||
cmd: dev,
|
cmd: dev,
|
||||||
rootDir: path.resolve('path/to/project')
|
rootDir: path.resolve('path/to/project')
|
||||||
|
Loading…
Reference in New Issue
Block a user