mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor: add deprecation log for addVendor
This commit is contained in:
parent
ba7e6c735b
commit
fe6c524be1
@ -1,6 +1,7 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import hash from 'hash-sum'
|
||||
import consola from 'consola'
|
||||
import { chainFn, sequence } from '../common/utils'
|
||||
|
||||
export default class ModuleContainer {
|
||||
@ -21,8 +22,8 @@ export default class ModuleContainer {
|
||||
await this.nuxt.callHook('modules:done', this)
|
||||
}
|
||||
|
||||
addVendor(vendor) {
|
||||
// Make it silent for backward compatibility with nuxt 1.x
|
||||
addVendor() {
|
||||
consola.warn('addVendor has been deprecated due to webpack4 optimization')
|
||||
}
|
||||
|
||||
addTemplate(template) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { normalize } from 'path'
|
||||
import consola from 'consola'
|
||||
import { loadFixture, getPort, Nuxt, rp } from '../utils'
|
||||
|
||||
let port
|
||||
@ -58,6 +59,15 @@ describe('module', () => {
|
||||
expect(nuxt.__render_context).toBeTruthy()
|
||||
})
|
||||
|
||||
test('AddVendor - deprecated', async () => {
|
||||
jest.spyOn(consola, 'warn')
|
||||
|
||||
nuxt.moduleContainer.addVendor('nuxt-test')
|
||||
expect(consola.warn).toHaveBeenCalledWith('addVendor has been deprecated due to webpack4 optimization')
|
||||
|
||||
consola.warn.mockRestore()
|
||||
})
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
afterAll(async () => {
|
||||
await nuxt.close()
|
||||
|
Loading…
Reference in New Issue
Block a user