From 90d9283e705349f0367df645fe583801e353e219 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Thu, 15 Mar 2018 17:19:36 +0800 Subject: [PATCH] deprecate: remove context.isServer/isClient --- lib/app/utils.js | 8 -------- test/deprecate.test.js | 21 +-------------------- test/fixtures/deprecate/pages/index.vue | 2 -- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/lib/app/utils.js b/lib/app/utils.js index f90876156a..3e6293db51 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -104,14 +104,6 @@ export async function setContext(app, context) { // If context not defined, create it if (!app.context) { app.context = { - get isServer() { - console.warn('context.isServer has been deprecated, please use process.server instead.') - return process.server - }, - get isClient() { - console.warn('context.isClient has been deprecated, please use process.client instead.') - return process.client - }, isStatic: process.static, isDev: <%= isDev %>, isHMR: false, diff --git a/test/deprecate.test.js b/test/deprecate.test.js index 0b93bec0e5..92187220a6 100644 --- a/test/deprecate.test.js +++ b/test/deprecate.test.js @@ -1,11 +1,9 @@ import test from 'ava' import { resolve } from 'path' -import rp from 'request-promise-native' import { Nuxt, Builder } from '..' -import { intercept, interceptWarn, release } from './helpers/console' +import { intercept } from './helpers/console' const port = 4010 -const url = route => 'http://localhost:' + port + route let nuxt = null let builder = null @@ -29,23 +27,6 @@ test.serial('Init Nuxt.js', async t => { t.true(buildSpies.log.calledWithMatch('OPEN')) }) -test.serial('Deprecated: context.isServer and context.isClient', async t => { - const warnSpy = await interceptWarn() - await rp(url('/')) - t.true( - warnSpy.calledWith( - 'context.isServer has been deprecated, please use process.server instead.' - ) - ) - t.true( - warnSpy.calledWith( - 'context.isClient has been deprecated, please use process.client instead.' - ) - ) - t.true(warnSpy.calledTwice) - release() -}) - test.serial('Deprecated: dev in build.extend()', async t => { t.true( buildSpies.warn.calledWithMatch( diff --git a/test/fixtures/deprecate/pages/index.vue b/test/fixtures/deprecate/pages/index.vue index 600aa6eb97..0b7a26d04d 100644 --- a/test/fixtures/deprecate/pages/index.vue +++ b/test/fixtures/deprecate/pages/index.vue @@ -7,7 +7,5 @@