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:
@@ -39,8 +39,8 @@ export const MOCK_DB = {
|
||||
},
|
||||
_notify(path) {
|
||||
// notify exact doc path subscribers (wrapped in act for test isolation).
|
||||
// Set flag true around cb: RTL asyncWrapper (waitFor) flips it false
|
||||
// during poll, making raw react act() warn 'not configured'.
|
||||
// Set flag true around cb: testing-library asyncWrapper (waitFor) flips it
|
||||
// false during poll, which makes raw react act() warn 'not configured'.
|
||||
if (state.subscribers.has(path)) state.subscribers.get(path).forEach(cb => {
|
||||
try {
|
||||
const { act } = require('react');
|
||||
|
||||
Reference in New Issue
Block a user