Fix stdout/stderr interceptors

This commit is contained in:
pimlie 2017-12-17 22:14:05 +01:00
parent fffe741986
commit ada5ffb84e
2 changed files with 5 additions and 5 deletions

View File

@ -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'))

View File

@ -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) {