Commit 0afe001c authored by Tobias Koppers's avatar Tobias Koppers

Reduce TLA chunks to 16 and use browser() for client-side test

512 chunks (~90s) timed out on CI machines. Back to 16 chunks which
comfortably fits within the 120s jest timeout on both local and CI.

Fix the client-tla-client test to use next.browser() instead of
next.fetch(), so the client-side TLA loop actually executes in the
browser rather than being skipped during SSR.
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
parent 9d6cc93d
...@@ -4,7 +4,7 @@ const p = Promise.resolve() ...@@ -4,7 +4,7 @@ const p = Promise.resolve()
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
console.log('promises start') console.log('promises start')
for (let chunk = 0; chunk < 2 ** 9; chunk++) { for (let chunk = 0; chunk < 2 ** 4; chunk++) {
await new Promise<void>((resolve) => setTimeout(resolve, 0)) await new Promise<void>((resolve) => setTimeout(resolve, 0))
for (let i = 0; i < 2 ** 16; i++) { for (let i = 0; i < 2 ** 16; i++) {
await p await p
......
...@@ -4,7 +4,7 @@ const p = Promise.resolve() ...@@ -4,7 +4,7 @@ const p = Promise.resolve()
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
console.log('promises start') console.log('promises start')
for (let chunk = 0; chunk < 2 ** 9; chunk++) { for (let chunk = 0; chunk < 2 ** 4; chunk++) {
await new Promise<void>((resolve) => setImmediate(resolve)) await new Promise<void>((resolve) => setImmediate(resolve))
for (let i = 0; i < 2 ** 16; i++) { for (let i = 0; i < 2 ** 16; i++) {
await p await p
......
console.log('promises start') console.log('promises start')
const p = Promise.resolve() const p = Promise.resolve()
for (let chunk = 0; chunk < 2 ** 9; chunk++) { for (let chunk = 0; chunk < 2 ** 4; chunk++) {
await new Promise((resolve) => setImmediate(resolve)) await new Promise((resolve) => setImmediate(resolve))
for (let i = 0; i < 2 ** 16; i++) { for (let i = 0; i < 2 ** 16; i++) {
await p await p
......
...@@ -27,9 +27,8 @@ describe('many-promises', () => { ...@@ -27,9 +27,8 @@ describe('many-promises', () => {
}) })
it('should handle many awaited promises in a Client Component with Top Level Await on the client', async () => { it('should handle many awaited promises in a Client Component with Top Level Await on the client', async () => {
const res = await next.fetch('/client-tla-client') const browser = await next.browser('/client-tla-client')
expect(res.status).toBe(200) const text = await browser.elementByCss('p').text()
const html = await res.text() expect(text).toBe('done')
expect(html).toContain('done')
}) })
}) })
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