mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
deprecate: remove context.isServer/isClient
This commit is contained in:
parent
cc75d844f8
commit
90d9283e70
@ -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,
|
||||
|
@ -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(
|
||||
|
2
test/fixtures/deprecate/pages/index.vue
vendored
2
test/fixtures/deprecate/pages/index.vue
vendored
@ -7,7 +7,5 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
// context.isServer and context.isClient has been deprecated
|
||||
fetch({ isServer, isClient }) {}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user