mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Fix stdout/stderr interceptors
This commit is contained in:
parent
fffe741986
commit
ada5ffb84e
@ -38,7 +38,7 @@ test.serial('Init Nuxt.js', async t => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test.serial('remove mixins in live reloading', async t => {
|
test.serial('remove mixins in live reloading', async t => {
|
||||||
const spies = await intercept()
|
const spies = await intercept({ log: true, error: true, stderr: true })
|
||||||
await nuxt.renderRoute(url('/'))
|
await nuxt.renderRoute(url('/'))
|
||||||
t.true(spies.log.calledWith('I am mixin'))
|
t.true(spies.log.calledWith('I am mixin'))
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ export async function intercept(levels, msg, cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (levels && levels.stderr) {
|
if (levels && levels.stderr) {
|
||||||
context.stdout = process.stderr.write
|
context.stderr = process.stderr.write
|
||||||
spies.stdout = process.stderr.write = sinon.spy()
|
spies.stderr = process.stderr.write = sinon.spy()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb) {
|
if (cb) {
|
||||||
@ -126,8 +126,8 @@ export async function interceptError(msg, cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function interceptStdout(msg, cb) {
|
export async function interceptStdout(msg, cb) {
|
||||||
const { stderr } = await intercept({ stdout: true }, msg, cb)
|
const { stdout } = await intercept({ stdout: true }, msg, cb)
|
||||||
return stderr
|
return stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function interceptStderr(msg, cb) {
|
export async function interceptStderr(msg, cb) {
|
||||||
|
Loading…
Reference in New Issue
Block a user