Repository navigation
Commit 748ee2d
authored
test: avoid missing worker exit events (#65)
## Motivation
The worker lifecycle test waited for the worker message before
registering its exit listener. Node can drain a queued message and emit
`exit` in the same turn, causing the test to miss the exit event and
time out intermittently in CI.
## Description
- Register the worker `message` and `exit` listeners before yielding.
- Await both events together with `node:events` `once()`, which also
propagates worker errors.
- Assert a successful worker exit and check the restored refcount
without an arbitrary delay.
Validated by running the worker lifecycle suite 50 consecutive times.1 parent fff76f3 commit 748ee2d
1 file changed
Lines changed: 9 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| 721 | + | |
721 | 722 | | |
722 | 723 | | |
723 | 724 | | |
| |||
738 | 739 | | |
739 | 740 | | |
740 | 741 | | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
753 | 748 | | |
754 | | - | |
755 | | - | |
756 | | - | |
| 749 | + | |
| 750 | + | |
757 | 751 | | |
758 | 752 | | |
759 | 753 | | |
| |||
0 commit comments