@@ -3,6 +3,10 @@ const assert = require('uvu/assert');
33
44const { NUClearNet } = require ( '..' ) ;
55
6+ // GitHub Actions macOS runners do not support IPv4 multicast loopback used by these tests.
7+ const multicastTestsSupported = ! ( process . platform === 'darwin' && process . env . CI ) ;
8+ const netTest = multicastTestsSupported ? test : test . skip ;
9+
610function randomId ( ) {
711 return String ( Math . random ( ) * 100000000 ) . slice ( 0 , 7 ) ;
812}
@@ -131,7 +135,7 @@ test('NUClearNet.send() throws if used before connect()', () => {
131135 net . destroy ( ) ;
132136} ) ;
133137
134- test ( 'NUClearNet emits join events' , async ( ) => {
138+ netTest ( 'NUClearNet emits join events' , async ( ) => {
135139 // Test set up:
136140 // - Create N network instances and connect all of them
137141 // - Each time one peer joins another, check that they've all joined each other
@@ -179,7 +183,7 @@ test('NUClearNet emits join events', async () => {
179183 ) ;
180184} ) ;
181185
182- test ( 'NUClearNet emits leave events' , async ( ) => {
186+ netTest ( 'NUClearNet emits leave events' , async ( ) => {
183187 // Test set up:
184188 // - Create two network instances (A and B) and connect them
185189 // - Wait for B to join A, then disconnect B to trigger the `nuclear_leave` event on A
@@ -217,7 +221,7 @@ test('NUClearNet emits leave events', async () => {
217221 ) ;
218222} ) ;
219223
220- test ( 'NUClearNet can send and receive reliable targeted messages' , async ( ) => {
224+ netTest ( 'NUClearNet can send and receive reliable targeted messages' , async ( ) => {
221225 // Test set up:
222226 // - Create one sender and N-1 receiver network instances and connect them
223227 // - Wait for receivers to join the sender, and send each receiver a unique payload
@@ -296,7 +300,7 @@ test('NUClearNet can send and receive reliable targeted messages', async () => {
296300 ) ;
297301} ) ;
298302
299- test ( 'NUClearNet can send and receive unreliable targeted messages' , async ( ) => {
303+ netTest ( 'NUClearNet can send and receive unreliable targeted messages' , async ( ) => {
300304 // Test set up:
301305 // - Create one sender and N-1 receiver network instances and connect them
302306 // - Wait for each receiver to join the sender, then start an interval to unreliably send the receiver a unique payload.
@@ -384,7 +388,7 @@ test('NUClearNet can send and receive unreliable targeted messages', async () =>
384388 ) ;
385389} ) ;
386390
387- test ( 'NUClearNet can send and receive reliable untargeted messages' , async ( ) => {
391+ netTest ( 'NUClearNet can send and receive reliable untargeted messages' , async ( ) => {
388392 // Test set up:
389393 // - Create one sender and N-1 receiver network instances and connect them
390394 // - Wait for both all receivers to join the sender, then send the payload with `reliable` set, untargeted
@@ -469,7 +473,7 @@ test('NUClearNet can send and receive reliable untargeted messages', async () =>
469473 ) ;
470474} ) ;
471475
472- test ( 'NUClearNet can send and receive unreliable untargeted messages' , async ( ) => {
476+ netTest ( 'NUClearNet can send and receive unreliable untargeted messages' , async ( ) => {
473477 // Test set up:
474478 // - Create one sender and N-1 receiver network instances and connect them
475479 // - Wait for all receivers to join the sender, then start an interval to unreliably send the same payload, without a target.
@@ -561,7 +565,7 @@ test('NUClearNet can send and receive unreliable untargeted messages', async ()
561565 ) ;
562566} ) ;
563567
564- test ( 'NUClearNet only receives subscribed message types' , async ( ) => {
568+ netTest ( 'NUClearNet only receives subscribed message types' , async ( ) => {
565569 await asyncTest (
566570 ( done , fail ) => {
567571 const [ peerA , peerB ] = createPeers ( 2 ) ;
0 commit comments