File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,14 +50,15 @@ export interface TestHarness {
5050 * single active harness per test.
5151 *
5252 * CRITICAL: ESM static imports resolve before any module body runs. This means
53- * spawn/renderer.ts registers the production frame scheduler at import time,
54- * and createTestHarness() (called in beforeEach) always wins because tests
55- * import this module after production modules. Never use dynamic import() to
56- * load spawn/renderer.ts after createTestHarness () — the production scheduler
57- * would overwrite the test one.
53+ * spawn/renderer.ts registers the production frame scheduler at import time.
54+ * The test harness replaces the frame scheduler with a fresh test scheduler.
55+ * This works correctly as long as test-utils.ts is imported before spawn/renderer.ts
56+ * in the module graph. Never use dynamic import () to load spawn/renderer.ts after
57+ * createTestHarness() — the production scheduler would overwrite the test one.
5858 */
5959export function createTestHarness ( ) : TestHarness {
6060 const previousSingletons = getSingletons ( ) ;
61+
6162 const singletons : RuntimeSingletons = {
6263 writeLock : createWriteLock ( ) ,
6364 writeContext : new AsyncLocalStorage < true > ( ) ,
@@ -90,4 +91,4 @@ export function createTestHarness(): TestHarness {
9091 console . error = originalError ;
9192 } ,
9293 } ;
93- }
94+ }
You can’t perform that action at this time.
0 commit comments