()
| 20 | |
| 21 | |
| 22 | def test_setInterval_unref(): |
| 23 | async def async_fn(): |
| 24 | obj = {'val': 0} |
| 25 | pm.eval("""(obj) => { |
| 26 | setInterval(()=>{ obj.val++ }, 200).unref() |
| 27 | setTimeout(()=>{ }, 500) |
| 28 | }""")(obj) |
| 29 | await pm.wait() # It should stop after the setTimeout timer's 500ms. |
| 30 | assert obj['val'] == 2 # The setInterval timer should only run twice (500 // 200 == 2) |
| 31 | return True |
| 32 | assert asyncio.run(async_fn()) |
| 33 | |
| 34 | |
| 35 | def test_clearInterval(): |
nothing calls this directly
no test coverage detected