deprecate: remove context.isServer/isClient

This commit is contained in:
Clark Du 2018-03-15 17:19:36 +08:00
parent cc75d844f8
commit 90d9283e70
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9
3 changed files with 1 additions and 30 deletions

View File

@ -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,

View File

@ -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(

View File

@ -7,7 +7,5 @@
<script>
export default {
// context.isServer and context.isClient has been deprecated
fetch({ isServer, isClient }) {}
}
</script>