* Run `fn` with a console.warn spy and assert the MAX_SIMPLIFY_STEPS guard * never trips (i.e. every simplification stayed below the iteration limit).
(fn: () => T)
| 98 | * never trips (i.e. every simplification stayed below the iteration limit). |
| 99 | */ |
| 100 | function withStepLimitSentinel<T>(fn: () => T): T { |
| 101 | const warn = jest.spyOn(console, 'warn').mockImplementation(() => {}); |
| 102 | try { |
| 103 | const result = fn(); |
| 104 | const tripped = warn.mock.calls.filter((args) => |
| 105 | STEP_LIMIT_WARNING.test(args.map(String).join(' ')) |
| 106 | ); |
| 107 | expect(tripped).toEqual([]); |
| 108 | return result; |
| 109 | } finally { |
| 110 | warn.mockRestore(); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * simplify(simplify(x)): assert termination within the time budget, a stable |
no test coverage detected