mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
test: add deprecated cases for vendor and module
This commit is contained in:
parent
f9ab3c4c7c
commit
ca1c2b2ff3
@ -58,6 +58,18 @@ test.serial('Deprecated: nuxt.plugin()', async t => {
|
|||||||
t.true(nuxt.__builder_plugin)
|
t.true(nuxt.__builder_plugin)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test.serial('Deprecated: module.addVendor()', async t => {
|
||||||
|
t.true(buildSpies.warn.calledWithMatch('module: addVendor is no longer necessary'))
|
||||||
|
})
|
||||||
|
|
||||||
|
test.serial('Deprecated: module callback', async t => {
|
||||||
|
t.true(
|
||||||
|
buildSpies.warn.calledWithMatch(
|
||||||
|
'Supporting callbacks is deprecated and will be removed in next releases. Consider using async/await.'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
test.serial('Error: nuxt.plugin()', async t => {
|
test.serial('Error: nuxt.plugin()', async t => {
|
||||||
const error = t.throws(() => nuxt.plugin('build:done', () => {}))
|
const error = t.throws(() => nuxt.plugin('build:done', () => {}))
|
||||||
t.is(error.message, 'nuxt.plugin(\'build:done\',..) is not supported. Use new hooks system.')
|
t.is(error.message, 'nuxt.plugin(\'build:done\',..) is not supported. Use new hooks system.')
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
module.exports = function () {
|
module.exports = function basicModule(options, resolve) {
|
||||||
|
this.addVendor('lodash')
|
||||||
// Note: Plugin is deprecated. Please use new hooks system.
|
// Note: Plugin is deprecated. Please use new hooks system.
|
||||||
this.nuxt.plugin('built', (builder) => {
|
this.nuxt.plugin('built', (builder) => {
|
||||||
this.nuxt.__builder_plugin = true
|
this.nuxt.__builder_plugin = true
|
||||||
})
|
})
|
||||||
|
resolve()
|
||||||
}
|
}
|
2
test/fixtures/deprecate/nuxt.config.js
vendored
2
test/fixtures/deprecate/nuxt.config.js
vendored
@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
modules: ['~/modules/hooks'],
|
modules: ['~/modules/deprecated-apis'],
|
||||||
build: {
|
build: {
|
||||||
stats: false,
|
stats: false,
|
||||||
extend(config, options) {
|
extend(config, options) {
|
||||||
|
Loading…
Reference in New Issue
Block a user