({ start, grant, miss, end })
| 6 | const dc = require('node:diagnostics_channel'); |
| 7 | |
| 8 | function subscribe({ start, grant, miss, end }) { |
| 9 | if (start) dc.subscribe('locks.request.start', start); |
| 10 | if (grant) dc.subscribe('locks.request.grant', grant); |
| 11 | if (miss) dc.subscribe('locks.request.miss', miss); |
| 12 | if (end) dc.subscribe('locks.request.end', end); |
| 13 | |
| 14 | return () => { |
| 15 | if (start) dc.unsubscribe('locks.request.start', start); |
| 16 | if (grant) dc.unsubscribe('locks.request.grant', grant); |
| 17 | if (miss) dc.unsubscribe('locks.request.miss', miss); |
| 18 | if (end) dc.unsubscribe('locks.request.end', end); |
| 19 | }; |
| 20 | } |
| 21 | |
| 22 | describe('Web Locks diagnostics channel', () => { |
| 23 | it('emits start, grant, and end on success', async () => { |
no test coverage detected
searching dependent graphs…