|
|
@@ -29,6 +29,7 @@ describe('SSR Suspense', () => {
|
|
|
|
|
|
test('reject', async () => {
|
|
|
const Comp = {
|
|
|
+ errorCaptured: jest.fn(() => false),
|
|
|
render() {
|
|
|
return h(Suspense, null, {
|
|
|
default: h(RejectingAsync),
|
|
|
@@ -38,10 +39,8 @@ describe('SSR Suspense', () => {
|
|
|
}
|
|
|
|
|
|
expect(await renderToString(createApp(Comp))).toBe(`<!---->`)
|
|
|
- expect('Uncaught error in async setup').toHaveBeenWarned()
|
|
|
- expect(
|
|
|
- 'Unhandled error during execution of setup function'
|
|
|
- ).toHaveBeenWarned()
|
|
|
+
|
|
|
+ expect(Comp.errorCaptured).toHaveBeenCalledTimes(1)
|
|
|
expect('missing template').toHaveBeenWarned()
|
|
|
})
|
|
|
|
|
|
@@ -62,6 +61,7 @@ describe('SSR Suspense', () => {
|
|
|
|
|
|
test('resolving component + rejecting component', async () => {
|
|
|
const Comp = {
|
|
|
+ errorCaptured: jest.fn(() => false),
|
|
|
render() {
|
|
|
return h(Suspense, null, {
|
|
|
default: h('div', [h(ResolvingAsync), h(RejectingAsync)]),
|
|
|
@@ -73,15 +73,14 @@ describe('SSR Suspense', () => {
|
|
|
expect(await renderToString(createApp(Comp))).toBe(
|
|
|
`<div><div>async</div><!----></div>`
|
|
|
)
|
|
|
- expect('Uncaught error in async setup').toHaveBeenWarned()
|
|
|
- expect(
|
|
|
- 'Unhandled error during execution of setup function'
|
|
|
- ).toHaveBeenWarned()
|
|
|
+
|
|
|
+ expect(Comp.errorCaptured).toHaveBeenCalledTimes(1)
|
|
|
expect('missing template or render function').toHaveBeenWarned()
|
|
|
})
|
|
|
|
|
|
test('failing suspense in passing suspense', async () => {
|
|
|
const Comp = {
|
|
|
+ errorCaptured: jest.fn(() => false),
|
|
|
render() {
|
|
|
return h(Suspense, null, {
|
|
|
default: h('div', [
|
|
|
@@ -99,15 +98,14 @@ describe('SSR Suspense', () => {
|
|
|
expect(await renderToString(createApp(Comp))).toBe(
|
|
|
`<div><div>async</div><div><!----></div></div>`
|
|
|
)
|
|
|
- expect('Uncaught error in async setup').toHaveBeenWarned()
|
|
|
- expect(
|
|
|
- 'Unhandled error during execution of setup function'
|
|
|
- ).toHaveBeenWarned()
|
|
|
+
|
|
|
+ expect(Comp.errorCaptured).toHaveBeenCalledTimes(1)
|
|
|
expect('missing template').toHaveBeenWarned()
|
|
|
})
|
|
|
|
|
|
test('passing suspense in failing suspense', async () => {
|
|
|
const Comp = {
|
|
|
+ errorCaptured: jest.fn(() => false),
|
|
|
render() {
|
|
|
return h(Suspense, null, {
|
|
|
default: h('div', [
|
|
|
@@ -125,10 +123,7 @@ describe('SSR Suspense', () => {
|
|
|
expect(await renderToString(createApp(Comp))).toBe(
|
|
|
`<div><!----><div><div>async</div></div></div>`
|
|
|
)
|
|
|
- expect('Uncaught error in async setup').toHaveBeenWarned()
|
|
|
- expect(
|
|
|
- 'Unhandled error during execution of setup function'
|
|
|
- ).toHaveBeenWarned()
|
|
|
+ expect(Comp.errorCaptured).toHaveBeenCalledTimes(1)
|
|
|
expect('missing template').toHaveBeenWarned()
|
|
|
})
|
|
|
})
|