test: kill act env warnings + remove debug console noise
Root cause: mock _notify cb fires during waitFor poll, but testing-library asyncWrapper flips IS_REACT_ACT_ENVIRONMENT=false. Raw react act() then warns 'not configured to support act' (146 warnings). Fix: _notify sets globalThis.IS_REACT_ACT_ENVIRONMENT=true around act(), restores after. setupTests sets flag globally. Both together = 0 warnings. Also: - Remove 4 debug console.log from App.js (encounter start/end, drag, add chars) - Remove always-fires scenario summary console.log - Add fastWaitFor helper (5ms poll) to testHelpers - Swap scenario waitFor -> fastWaitFor Tests: 77 pass / 0 fail / 0 warnings / 0 console noise.
This commit is contained in:
@@ -23,6 +23,10 @@ console.warn = (...args) => {
|
||||
};
|
||||
import { resetMockDb } from './__mocks__/firebase/_mock-db';
|
||||
|
||||
// Tell React this is an act environment. Without it, every act() call
|
||||
// emits 'current testing environment is not configured to support act'.
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
||||
|
||||
// polyfill crypto.randomUUID for jsdom (used by generateId in App.js).
|
||||
if (!global.crypto) global.crypto = {};
|
||||
if (!global.crypto.randomUUID) {
|
||||
|
||||
Reference in New Issue
Block a user