* Captures a "snapshot" of the identifier and status of all fibers in this * test other than the current fiber. Fails with the `void` value if any of * these fibers are not done or suspended. Note that because we cannot * synchronize on the status of multiple fibers at the same time this
()
| 254 | * snapshot may not be fully consistent. |
| 255 | */ |
| 256 | freeze(): Effect.Effect<HashMap.HashMap<FiberId.FiberId, FiberStatus.FiberStatus>, void> { |
| 257 | return core.flatMap(this.supervisedFibers(), (fibers) => |
| 258 | pipe( |
| 259 | fibers, |
| 260 | effect.reduce(HashMap.empty<FiberId.FiberId, FiberStatus.FiberStatus>(), (map, fiber) => |
| 261 | pipe( |
| 262 | fiber.status, |
| 263 | core.flatMap((status) => { |
| 264 | if (FiberStatus.isDone(status)) { |
| 265 | return core.succeed(HashMap.set(map, fiber.id() as FiberId.FiberId, status as FiberStatus.FiberStatus)) |
| 266 | } |
| 267 | if (FiberStatus.isSuspended(status)) { |
| 268 | return core.succeed(HashMap.set(map, fiber.id() as FiberId.FiberId, status as FiberStatus.FiberStatus)) |
| 269 | } |
| 270 | return core.fail(void 0) |
| 271 | }) |
| 272 | )) |
| 273 | )) |
| 274 | } |
| 275 | /** |
| 276 | * Forks a fiber that will display a warning message if a test is using time |
| 277 | * but is not advancing the `TestClock`. |