diff --git a/test/deprecate.test.js b/test/deprecate.test.js index 46feac5930..0b93bec0e5 100644 --- a/test/deprecate.test.js +++ b/test/deprecate.test.js @@ -58,6 +58,18 @@ test.serial('Deprecated: nuxt.plugin()', async t => { 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 => { const error = t.throws(() => nuxt.plugin('build:done', () => {})) t.is(error.message, 'nuxt.plugin(\'build:done\',..) is not supported. Use new hooks system.') diff --git a/test/fixtures/deprecate/modules/hooks/index.js b/test/fixtures/deprecate/modules/deprecated-apis/index.js similarity index 60% rename from test/fixtures/deprecate/modules/hooks/index.js rename to test/fixtures/deprecate/modules/deprecated-apis/index.js index 883fe0e0ba..849b751805 100644 --- a/test/fixtures/deprecate/modules/hooks/index.js +++ b/test/fixtures/deprecate/modules/deprecated-apis/index.js @@ -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. this.nuxt.plugin('built', (builder) => { this.nuxt.__builder_plugin = true }) + resolve() } diff --git a/test/fixtures/deprecate/nuxt.config.js b/test/fixtures/deprecate/nuxt.config.js index 35c9321941..f53f162aea 100644 --- a/test/fixtures/deprecate/nuxt.config.js +++ b/test/fixtures/deprecate/nuxt.config.js @@ -1,5 +1,5 @@ module.exports = { - modules: ['~/modules/hooks'], + modules: ['~/modules/deprecated-apis'], build: { stats: false, extend(config, options) {