File tree 2 files changed +43
-2
lines changed
2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ const globalThis = require('./globalthis')
5
5
module . exports = {
6
6
supportsFileReader : typeof self !== 'undefined' && 'FileReader' in self ,
7
7
supportsWebRTC : 'RTCPeerConnection' in globalThis &&
8
- ( typeof navigator !== 'undefined' && typeof navigator . mediaDevices !== 'undefined' && 'getUserMedia' in navigator . mediaDevices )
8
+ ( typeof navigator !== 'undefined' && typeof navigator . mediaDevices !== 'undefined' && 'getUserMedia' in navigator . mediaDevices ) ,
9
+ supportsWebRTCDataChannels : 'RTCPeerConnection' in globalThis
9
10
}
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ describe('supports', function () {
62
62
}
63
63
} )
64
64
65
- it ( 'supportsWebRTC should return true in Web Worker' , function ( ) {
65
+ it ( 'supportsWebRTC should return false in Web Worker' , function ( ) {
66
66
if ( env . isWebWorker ) {
67
67
expect ( supports . supportsWebRTC ) . to . be . false ( )
68
68
} else {
@@ -85,4 +85,44 @@ describe('supports', function () {
85
85
this . skip ( )
86
86
}
87
87
} )
88
+
89
+ it ( 'supportsWebRTCDataChannels should return false in node' , function ( ) {
90
+ if ( env . isNode ) {
91
+ expect ( supports . supportsWebRTCDataChannels ) . to . be . false ( )
92
+ } else {
93
+ this . skip ( )
94
+ }
95
+ } )
96
+
97
+ it ( 'supportsWebRTCDataChannels should return true in browser' , function ( ) {
98
+ if ( env . isBrowser ) {
99
+ expect ( supports . supportsWebRTCDataChannels ) . to . be . true ( )
100
+ } else {
101
+ this . skip ( )
102
+ }
103
+ } )
104
+
105
+ it ( 'supportsWebRTCDataChannels should return false in Web Worker' , function ( ) {
106
+ if ( env . isWebWorker ) {
107
+ expect ( supports . supportsWebRTCDataChannels ) . to . be . false ( )
108
+ } else {
109
+ this . skip ( )
110
+ }
111
+ } )
112
+
113
+ it ( 'supportsWebRTCDataChannels should return false in Electron main' , function ( ) {
114
+ if ( env . isElectron && ! env . isElectronRenderer ) {
115
+ expect ( supports . supportsWebRTCDataChannels ) . to . be . false ( )
116
+ } else {
117
+ this . skip ( )
118
+ }
119
+ } )
120
+
121
+ it ( 'supportsWebRTCDataChannels should return true in Electron renderer' , function ( ) {
122
+ if ( env . isElectronRenderer ) {
123
+ expect ( supports . supportsWebRTCDataChannels ) . to . be . true ( )
124
+ } else {
125
+ this . skip ( )
126
+ }
127
+ } )
88
128
} )
You can’t perform that action at this time.
0 commit comments