WIP: add debug channel test app

parent 5712c05c
......@@ -27,7 +27,7 @@ export function connectReactDebugChannel(
const reader = debugChannel.readable
.pipeThrough(
// We're sending the chunks in batches to reduce overhead in the browser.
createBufferedTransformStream({ maxBufferByteLength: 128 * 1024 })
createBufferedTransformStream({ maxBufferByteLength: 128 * 10024 })
)
.getReader()
......
import { ReactNode } from 'react'
export default function Root({ children }: { children: ReactNode }) {
return (
<html>
<body>{children}</body>
</html>
)
}
import Link from 'next/link'
export default function Page() {
return (
<div>
<p>other page</p>
<p>
<Link href="/">Go to home page</Link>
</p>
</div>
)
}
import Link from 'next/link'
export default function Page() {
// console.error(new Error('test'))
return (
<div key="foo">
<p>home page</p>
<p>
<Link href="/other">Go to other page</Link>
</p>
</div>
)
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
// Force React's experimental build to be used.
taint: true,
// reactDebugChannel: true,
},
}
module.exports = nextConfig
import { nextTestSetup } from 'e2e-utils'
describe('react-debug-channel', () => {
const { next } = nextTestSetup({
files: __dirname,
})
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API.
it('should work using cheerio', async () => {
const $ = await next.render$('/')
expect($('p').text()).toBe('hello world')
})
// Recommended for tests that need a full browser
it('should work using browser', async () => {
const browser = await next.browser('/')
expect(await browser.elementByCss('p').text()).toBe('hello world')
})
// In case you need the full HTML. Can also use $.html() with cheerio.
it('should work with html', async () => {
const html = await next.render('/')
expect(html).toContain('hello world')
})
// In case you need to test the response object
it('should work with fetch', async () => {
const res = await next.fetch('/')
const html = await res.text()
expect(html).toContain('hello world')
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment