From 7cf143dd4f5529fd108e6433745bfbe6029e7e83 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 25 Mar 2021 16:06:02 -0400 Subject: [PATCH] chore: fix test --- packages/runtime-core/src/component.ts | 3 ++- packages/server-renderer/__tests__/render.spec.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 48f6f6e5..79847225 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -673,7 +673,8 @@ function finishComponentSetup( // 1. the render function may already exist, returned by `setup` // 2. otherwise try to use the `Component.render` // 3. if the component doesn't have a render function, - // set `instance.render` to NOOP so that it can inherit the render function from mixins/extend + // set `instance.render` to NOOP so that it can inherit the render + // function from mixins/extend instance.render = (instance.render || Component.render || NOOP) as InternalRenderFunction diff --git a/packages/server-renderer/__tests__/render.spec.ts b/packages/server-renderer/__tests__/render.spec.ts index e2ec13c0..85d53762 100644 --- a/packages/server-renderer/__tests__/render.spec.ts +++ b/packages/server-renderer/__tests__/render.spec.ts @@ -781,8 +781,10 @@ function testRender(type: string, render: typeof renderToString) { test('effect onInvalidate does not error', async () => { const noop = () => {} const app = createApp({ - setup: () => watchEffect(onInvalidate => onInvalidate(noop)), - render: noop, + setup: () => { + watchEffect(onInvalidate => onInvalidate(noop)) + }, + render: noop }) expect(await render(app)).toBe('') })