Commit 9b6f00d9 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

add test

parent dfcc363b
import { B } from './B'
export function A(n: number) {
if (n > 0) {
B(n - 1)
}
}
import { C } from './C'
import { asyncImportFn } from './asyncImportFn'
export function B(n: number) {
if (n > 0) {
C(n - 1)
asyncImportFn()
}
}
import { A } from './A'
export function C(n: number) {
if (n > 0) {
A(n - 1)
}
}
import { C } from './C'
export function D(n: number) {
if (n > 0) {
C(n - 1)
}
}
import { B } from './B'
export function E(n: number) {
if (n > 0) {
B(n - 1)
}
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
await sleep(0)
console.log('Imported asyncImportFn')
export function asyncImportFn() {}
import { A } from './A'
import { D } from './D'
/*
* {A,B,C,D}.ts and asyncImportFn.ts have an import graph topology that
* exposes a bug in `compute_async_module_info_single` in turbopack. Requesting
* this page (localhost:3000/api/test) will fail with:
* TypeError: (0 , t.C) is not a function
* This is because C has been marked as an async module, but D hasn't.
*
* route
* | \
* v v
* A<- D
* | \ |
* v \v
* B--->C
* |
* v
* async
*/
it('should handle cycles in async modules', () => {
A(10)
D(10)
expect(true).toBe(true)
})
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