node-datachannel 0.12.0 → 0.20.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/.eslintignore +5 -1
  2. package/.eslintrc.json +27 -0
  3. package/.prettierrc +12 -0
  4. package/CMakeLists.txt +13 -13
  5. package/dist/cjs/index.cjs +11 -0
  6. package/dist/cjs/index.cjs.map +1 -0
  7. package/dist/cjs/lib/datachannel-stream.cjs +101 -0
  8. package/dist/cjs/lib/datachannel-stream.cjs.map +1 -0
  9. package/dist/cjs/lib/index.cjs +61 -0
  10. package/dist/cjs/lib/index.cjs.map +1 -0
  11. package/dist/cjs/lib/node-datachannel.cjs +14 -0
  12. package/dist/cjs/lib/node-datachannel.cjs.map +1 -0
  13. package/dist/cjs/lib/websocket-server.cjs +44 -0
  14. package/dist/cjs/lib/websocket-server.cjs.map +1 -0
  15. package/dist/cjs/lib/websocket.cjs +8 -0
  16. package/dist/cjs/lib/websocket.cjs.map +1 -0
  17. package/dist/cjs/polyfill/Events.cjs +37 -0
  18. package/dist/cjs/polyfill/Events.cjs.map +1 -0
  19. package/dist/cjs/polyfill/Exception.cjs +34 -0
  20. package/dist/cjs/polyfill/Exception.cjs.map +1 -0
  21. package/dist/cjs/polyfill/RTCCertificate.cjs +31 -0
  22. package/dist/cjs/polyfill/RTCCertificate.cjs.map +1 -0
  23. package/dist/cjs/polyfill/RTCDataChannel.cjs +179 -0
  24. package/dist/cjs/polyfill/RTCDataChannel.cjs.map +1 -0
  25. package/dist/cjs/polyfill/RTCDtlsTransport.cjs +52 -0
  26. package/dist/cjs/polyfill/RTCDtlsTransport.cjs.map +1 -0
  27. package/dist/cjs/polyfill/RTCError.cjs +76 -0
  28. package/dist/cjs/polyfill/RTCError.cjs.map +1 -0
  29. package/dist/cjs/polyfill/RTCIceCandidate.cjs +129 -0
  30. package/dist/cjs/polyfill/RTCIceCandidate.cjs.map +1 -0
  31. package/dist/cjs/polyfill/RTCIceTransport.cjs +84 -0
  32. package/dist/cjs/polyfill/RTCIceTransport.cjs.map +1 -0
  33. package/dist/cjs/polyfill/RTCPeerConnection.cjs +417 -0
  34. package/dist/cjs/polyfill/RTCPeerConnection.cjs.map +1 -0
  35. package/dist/cjs/polyfill/RTCSctpTransport.cjs +61 -0
  36. package/dist/cjs/polyfill/RTCSctpTransport.cjs.map +1 -0
  37. package/dist/cjs/polyfill/RTCSessionDescription.cjs +37 -0
  38. package/dist/cjs/polyfill/RTCSessionDescription.cjs.map +1 -0
  39. package/dist/cjs/polyfill/index.cjs +42 -0
  40. package/dist/cjs/polyfill/index.cjs.map +1 -0
  41. package/dist/esm/index.mjs +8 -0
  42. package/dist/esm/index.mjs.map +1 -0
  43. package/dist/esm/lib/datachannel-stream.mjs +78 -0
  44. package/dist/esm/lib/datachannel-stream.mjs.map +1 -0
  45. package/dist/esm/lib/index.mjs +44 -0
  46. package/dist/esm/lib/index.mjs.map +1 -0
  47. package/dist/esm/lib/node-datachannel.mjs +18 -0
  48. package/dist/esm/lib/node-datachannel.mjs.map +1 -0
  49. package/dist/esm/lib/websocket-server.mjs +42 -0
  50. package/dist/esm/lib/websocket-server.mjs.map +1 -0
  51. package/dist/esm/lib/websocket.mjs +6 -0
  52. package/dist/esm/lib/websocket.mjs.map +1 -0
  53. package/dist/esm/polyfill/Events.mjs +34 -0
  54. package/dist/esm/polyfill/Events.mjs.map +1 -0
  55. package/dist/esm/polyfill/Exception.mjs +28 -0
  56. package/dist/esm/polyfill/Exception.mjs.map +1 -0
  57. package/dist/esm/polyfill/RTCCertificate.mjs +27 -0
  58. package/dist/esm/polyfill/RTCCertificate.mjs.map +1 -0
  59. package/dist/esm/polyfill/RTCDataChannel.mjs +175 -0
  60. package/dist/esm/polyfill/RTCDataChannel.mjs.map +1 -0
  61. package/dist/esm/polyfill/RTCDtlsTransport.mjs +48 -0
  62. package/dist/esm/polyfill/RTCDtlsTransport.mjs.map +1 -0
  63. package/dist/esm/polyfill/RTCError.mjs +72 -0
  64. package/dist/esm/polyfill/RTCError.mjs.map +1 -0
  65. package/dist/esm/polyfill/RTCIceCandidate.mjs +125 -0
  66. package/dist/esm/polyfill/RTCIceCandidate.mjs.map +1 -0
  67. package/dist/esm/polyfill/RTCIceTransport.mjs +80 -0
  68. package/dist/esm/polyfill/RTCIceTransport.mjs.map +1 -0
  69. package/dist/esm/polyfill/RTCPeerConnection.mjs +413 -0
  70. package/dist/esm/polyfill/RTCPeerConnection.mjs.map +1 -0
  71. package/dist/esm/polyfill/RTCSctpTransport.mjs +57 -0
  72. package/dist/esm/polyfill/RTCSctpTransport.mjs.map +1 -0
  73. package/dist/esm/polyfill/RTCSessionDescription.mjs +33 -0
  74. package/dist/esm/polyfill/RTCSessionDescription.mjs.map +1 -0
  75. package/dist/esm/polyfill/index.mjs +27 -0
  76. package/dist/esm/polyfill/index.mjs.map +1 -0
  77. package/dist/types/lib/datachannel-stream.d.ts +24 -0
  78. package/dist/types/lib/index.d.ts +164 -0
  79. package/dist/types/lib/types.d.ts +106 -0
  80. package/dist/types/lib/websocket-server.d.ts +13 -0
  81. package/dist/types/lib/websocket.d.ts +25 -0
  82. package/dist/types/polyfill/Events.d.ts +15 -0
  83. package/dist/types/polyfill/RTCCertificate.d.ts +8 -0
  84. package/dist/types/polyfill/RTCDataChannel.d.ts +29 -0
  85. package/dist/types/polyfill/RTCDtlsTransport.d.ts +17 -0
  86. package/dist/types/polyfill/RTCError.d.ts +16 -0
  87. package/dist/types/polyfill/RTCIceCandidate.d.ts +21 -0
  88. package/dist/types/polyfill/RTCIceTransport.d.ts +24 -0
  89. package/dist/types/polyfill/RTCPeerConnection.d.ts +56 -0
  90. package/dist/types/polyfill/RTCSctpTransport.d.ts +17 -0
  91. package/dist/types/polyfill/RTCSessionDescription.d.ts +9 -0
  92. package/{polyfill → dist/types/polyfill}/index.d.ts +3 -14
  93. package/jest.config.ts +14 -0
  94. package/package.json +47 -43
  95. package/rollup.config.mjs +63 -0
  96. package/src/index.ts +10 -0
  97. package/{lib/datachannel-stream.js → src/lib/datachannel-stream.ts} +16 -11
  98. package/src/lib/index.ts +180 -0
  99. package/src/lib/node-datachannel.ts +13 -0
  100. package/src/lib/types.ts +126 -0
  101. package/{lib/websocket-server.js → src/lib/websocket-server.ts} +10 -8
  102. package/src/lib/websocket.ts +26 -0
  103. package/src/polyfill/Events.ts +33 -0
  104. package/src/polyfill/Exception.ts +37 -0
  105. package/src/polyfill/RTCCertificate.ts +17 -0
  106. package/{polyfill/RTCDataChannel.js → src/polyfill/RTCDataChannel.ts} +43 -40
  107. package/src/polyfill/RTCDtlsTransport.ts +47 -0
  108. package/src/polyfill/RTCError.ts +71 -0
  109. package/{polyfill/RTCIceCandidate.js → src/polyfill/RTCIceCandidate.ts} +35 -35
  110. package/{polyfill/RTCIceTransport.js → src/polyfill/RTCIceTransport.ts} +22 -20
  111. package/{polyfill/RTCPeerConnection.js → src/polyfill/RTCPeerConnection.ts} +128 -114
  112. package/{polyfill/RTCSctpTransport.js → src/polyfill/RTCSctpTransport.ts} +16 -14
  113. package/{polyfill/RTCSessionDescription.js → src/polyfill/RTCSessionDescription.ts} +7 -12
  114. package/{polyfill/index.js → src/polyfill/index.ts} +10 -10
  115. package/tsconfig.json +20 -13
  116. package/.eslintrc.cjs +0 -8
  117. package/.github/FUNDING.yml +0 -2
  118. package/.github/workflows/build-linux.yml +0 -109
  119. package/.github/workflows/build-mac-m1.yml +0 -38
  120. package/.github/workflows/build-mac-x64.yml +0 -40
  121. package/.github/workflows/build-win.yml +0 -74
  122. package/.github/workflows/lint.yml +0 -20
  123. package/.github/workflows/npm-publish-manual.yml +0 -23
  124. package/.prettierrc.cjs +0 -8
  125. package/build-containers/Dockerfile.alpine +0 -6
  126. package/build-containers/Dockerfile.debian +0 -7
  127. package/cmake/toolchain/ci.cmake +0 -23
  128. package/examples/client-server/README.md +0 -22
  129. package/examples/client-server/client-benchmark.js +0 -230
  130. package/examples/client-server/client-periodic.js +0 -189
  131. package/examples/client-server/client.js +0 -111
  132. package/examples/client-server/package-lock.json +0 -289
  133. package/examples/client-server/package.json +0 -16
  134. package/examples/client-server/signaling-server.js +0 -39
  135. package/examples/electron-demo/README.md +0 -58
  136. package/examples/electron-demo/forge.config.js +0 -49
  137. package/examples/electron-demo/package-lock.json +0 -15877
  138. package/examples/electron-demo/package.json +0 -44
  139. package/examples/electron-demo/src/index.css +0 -7
  140. package/examples/electron-demo/src/index.html +0 -29
  141. package/examples/electron-demo/src/main.js +0 -53
  142. package/examples/electron-demo/src/node-datachannel.js +0 -123
  143. package/examples/electron-demo/src/preload.js +0 -28
  144. package/examples/electron-demo/src/renderer.js +0 -58
  145. package/examples/electron-demo/webpack.main.config.js +0 -21
  146. package/examples/electron-demo/webpack.renderer.config.js +0 -13
  147. package/examples/electron-demo/webpack.rules.js +0 -35
  148. package/examples/media/README.md +0 -34
  149. package/examples/media/main.html +0 -45
  150. package/examples/media/media.js +0 -54
  151. package/examples/simple-peer-usage/main.js +0 -28
  152. package/examples/simple-peer-usage/package-lock.json +0 -317
  153. package/examples/simple-peer-usage/package.json +0 -16
  154. package/examples/websocket/websocket-client.js +0 -20
  155. package/examples/websocket/websocket-server.js +0 -22
  156. package/jest.config.cjs +0 -7
  157. package/lib/index.cjs +0 -194
  158. package/lib/index.d.cts +0 -300
  159. package/lib/index.d.ts +0 -300
  160. package/lib/index.js +0 -58
  161. package/lib/node-datachannel.js +0 -7
  162. package/polyfill/Events.d.ts +0 -9
  163. package/polyfill/Events.js +0 -29
  164. package/polyfill/Exception.js +0 -23
  165. package/polyfill/RTCCertificate.d.ts +0 -7
  166. package/polyfill/RTCCertificate.js +0 -17
  167. package/polyfill/RTCDataChannel.d.ts +0 -35
  168. package/polyfill/RTCDtlsTransport.d.ts +0 -10
  169. package/polyfill/RTCDtlsTransport.js +0 -47
  170. package/polyfill/RTCError.d.ts +0 -11
  171. package/polyfill/RTCError.js +0 -65
  172. package/polyfill/RTCIceCandidate.d.ts +0 -20
  173. package/polyfill/RTCIceTransport.d.ts +0 -18
  174. package/polyfill/RTCPeerConnection.d.ts +0 -62
  175. package/polyfill/RTCSctpTransport.d.ts +0 -10
  176. package/polyfill/RTCSessionDescription.d.ts +0 -8
  177. package/polyfill/index.cjs +0 -1333
  178. package/polyfill/index.d.cts +0 -37
  179. package/test/connectivity.js +0 -86
  180. package/test/jest-tests/basic.test.js +0 -37
  181. package/test/jest-tests/multiple-run.test.js +0 -73
  182. package/test/jest-tests/p2p.test.js +0 -99
  183. package/test/jest-tests/polyfill.test.js +0 -10
  184. package/test/jest-tests/streams.test.js +0 -48
  185. package/test/jest-tests/websocket.test.js +0 -69
  186. package/test/polyfill-connectivity.js +0 -89
  187. package/test/websockets.js +0 -50
  188. package/test/wpt-tests/README.md +0 -46
  189. package/test/wpt-tests/chrome-failed-tests.js +0 -42
  190. package/test/wpt-tests/index.js +0 -96
  191. package/test/wpt-tests/last-test-results.md +0 -301
  192. package/test/wpt-tests/package-lock.json +0 -1712
  193. package/test/wpt-tests/package.json +0 -19
  194. package/test/wpt-tests/wpt-test-list.js +0 -139
  195. package/test/wpt-tests/wpt.js +0 -131
  196. /package/src/{data-channel-wrapper.cpp → cpp/data-channel-wrapper.cpp} +0 -0
  197. /package/src/{data-channel-wrapper.h → cpp/data-channel-wrapper.h} +0 -0
  198. /package/src/{main.cpp → cpp/main.cpp} +0 -0
  199. /package/src/{media-audio-wrapper.cpp → cpp/media-audio-wrapper.cpp} +0 -0
  200. /package/src/{media-audio-wrapper.h → cpp/media-audio-wrapper.h} +0 -0
  201. /package/src/{media-direction.cpp → cpp/media-direction.cpp} +0 -0
  202. /package/src/{media-direction.h → cpp/media-direction.h} +0 -0
  203. /package/src/{media-rtcpreceivingsession-wrapper.cpp → cpp/media-rtcpreceivingsession-wrapper.cpp} +0 -0
  204. /package/src/{media-rtcpreceivingsession-wrapper.h → cpp/media-rtcpreceivingsession-wrapper.h} +0 -0
  205. /package/src/{media-track-wrapper.cpp → cpp/media-track-wrapper.cpp} +0 -0
  206. /package/src/{media-track-wrapper.h → cpp/media-track-wrapper.h} +0 -0
  207. /package/src/{media-video-wrapper.cpp → cpp/media-video-wrapper.cpp} +0 -0
  208. /package/src/{media-video-wrapper.h → cpp/media-video-wrapper.h} +0 -0
  209. /package/src/{peer-connection-wrapper.cpp → cpp/peer-connection-wrapper.cpp} +0 -0
  210. /package/src/{peer-connection-wrapper.h → cpp/peer-connection-wrapper.h} +0 -0
  211. /package/src/{rtc-wrapper.cpp → cpp/rtc-wrapper.cpp} +0 -0
  212. /package/src/{rtc-wrapper.h → cpp/rtc-wrapper.h} +0 -0
  213. /package/src/{thread-safe-callback.cpp → cpp/thread-safe-callback.cpp} +0 -0
  214. /package/src/{thread-safe-callback.h → cpp/thread-safe-callback.h} +0 -0
  215. /package/src/{web-socket-server-wrapper.cpp → cpp/web-socket-server-wrapper.cpp} +0 -0
  216. /package/src/{web-socket-server-wrapper.h → cpp/web-socket-server-wrapper.h} +0 -0
  217. /package/src/{web-socket-wrapper.cpp → cpp/web-socket-wrapper.cpp} +0 -0
  218. /package/src/{web-socket-wrapper.h → cpp/web-socket-wrapper.h} +0 -0
  219. /package/{polyfill → src/polyfill}/README.md +0 -0
@@ -1,19 +0,0 @@
1
- {
2
- "name": "wpt-tests",
3
- "version": "1.0.0",
4
- "description": "git clone https://github.com/web-platform-tests/wpt.git cd wpt ./wpt make-hosts-file | sudo tee -a /etc/hosts ./wpt serve",
5
- "type": "module",
6
- "main": "wpt.js",
7
- "scripts": {
8
- "test": "npm run run:wpt & (sleep 8 && (npm run run:test | tee last-test-results.md) )",
9
- "run:wpt": "cd wpt && ./wpt serve",
10
- "run:test": "node index.js"
11
- },
12
- "keywords": [],
13
- "author": "",
14
- "license": "ISC",
15
- "devDependencies": {
16
- "jsdom": "^24.1.0",
17
- "puppeteer": "^22.12.1"
18
- }
19
- }
@@ -1,139 +0,0 @@
1
- export default [
2
- '/webrtc/getstats.html',
3
- '/webrtc/historical.html',
4
- '/webrtc/no-media-call.html',
5
- '/webrtc/promises-call.html',
6
- '/webrtc/receiver-track-live.https.html',
7
- '/webrtc/recvonly-transceiver-can-become-sendrecv.https.html',
8
- '/webrtc/RollbackEvents.https.html',
9
- '/webrtc/RTCCertificate.html',
10
- '/webrtc/RTCConfiguration-bundlePolicy.html',
11
- '/webrtc/RTCConfiguration-iceCandidatePoolSize.html',
12
- '/webrtc/RTCConfiguration-iceServers.html',
13
- '/webrtc/RTCConfiguration-iceTransportPolicy.html',
14
- '/webrtc/RTCConfiguration-rtcpMuxPolicy.html',
15
- '/webrtc/RTCConfiguration-validation.html',
16
- '/webrtc/RTCDataChannel-bufferedAmount.html',
17
- '/webrtc/RTCDataChannelEvent-constructor.html',
18
- '/webrtc/RTCDataChannel-iceRestart.html',
19
- '/webrtc/RTCDataChannel-id.html',
20
- '/webrtc/RTCDataChannel-send-blob-order.html',
21
- '/webrtc/RTCDtlsTransport-getRemoteCertificates.html',
22
- '/webrtc/RTCDtlsTransport-state.html',
23
- '/webrtc/RTCDTMFSender-insertDTMF.https.html',
24
- '/webrtc/RTCDTMFSender-ontonechange.https.html',
25
- '/webrtc/RTCDTMFSender-ontonechange-long.https.html',
26
- '/webrtc/RTCError.html',
27
- '/webrtc/RTCIceCandidate-constructor.html',
28
- '/webrtc/RTCIceConnectionState-candidate-pair.https.html',
29
- '/webrtc/RTCIceTransport.html',
30
- '/webrtc/RTCPeerConnection-addIceCandidate-connectionSetup.html',
31
- '/webrtc/RTCPeerConnection-addIceCandidate.html',
32
- '/webrtc/RTCPeerConnection-addIceCandidate-timing.https.html',
33
- '/webrtc/RTCPeerConnection-addTcpIceCandidate.html',
34
- // '/webrtc/RTCPeerConnection-addTrack.https.html',
35
- // '/webrtc/RTCPeerConnection-add-track-no-deadlock.https.html',
36
- // '/webrtc/RTCPeerConnection-addTransceiver.https.html',
37
- // '/webrtc/RTCPeerConnection-candidate-in-sdp.https.html',
38
- // '/webrtc/RTCPeerConnection-canTrickleIceCandidates.html',
39
- // '/webrtc/RTCPeerConnection-capture-video.https.html',
40
- // '/webrtc/RTCPeerConnection-connectionState.https.html',
41
- // '/webrtc/RTCPeerConnection-constructor.html',
42
- // '/webrtc/RTCPeerConnection-createAnswer.html',
43
- // '/webrtc/RTCPeerConnection-createDataChannel.html',
44
- // '/webrtc/RTCPeerConnection-createOffer.html',
45
- // '/webrtc/RTCPeerConnection-description-attributes-timing.https.html',
46
- // '/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html',
47
- // '/webrtc/RTCPeerConnection-GC.https.html',
48
- // '/webrtc/RTCPeerConnection-generateCertificate.html',
49
- // '/webrtc/RTCPeerConnection-getStats.https.html',
50
- // '/webrtc/RTCPeerConnection-getTransceivers.html',
51
- // '/webrtc/RTCPeerConnection-helper-test.html',
52
- // '/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html',
53
- // '/webrtc/RTCPeerConnection-iceConnectionState.https.html',
54
- // '/webrtc/RTCPeerConnectionIceErrorEvent.html',
55
- // '/webrtc/RTCPeerConnectionIceEvent-constructor.html',
56
- // '/webrtc/RTCPeerConnection-iceGatheringState.html',
57
- // '/webrtc/RTCPeerConnection-mandatory-getStats.https.html',
58
- // '/webrtc/RTCPeerConnection-ondatachannel.html',
59
- // '/webrtc/RTCPeerConnection-onicecandidateerror.https.html',
60
- // '/webrtc/RTCPeerConnection-onnegotiationneeded.html',
61
- // '/webrtc/RTCPeerConnection-onsignalingstatechanged.https.html',
62
- // '/webrtc/RTCPeerConnection-ontrack.https.html',
63
- // '/webrtc/RTCPeerConnection-operations.https.html',
64
- // '/webrtc/RTCPeerConnection-perfect-negotiation.https.html',
65
- // '/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare.https.html',
66
- // '/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare-linear.https.html',
67
- // '/webrtc/RTCPeerConnection-plan-b-is-not-supported.html',
68
- // '/webrtc/RTCPeerConnection-relay-canvas.https.html',
69
- // '/webrtc/RTCPeerConnection-remote-track-mute.https.html',
70
- // '/webrtc/RTCPeerConnection-removeTrack.https.html',
71
- // '/webrtc/RTCPeerConnection-restartIce.https.html',
72
- // '/webrtc/RTCPeerConnection-restartIce-onnegotiationneeded.https.html',
73
- // '/webrtc/RTCPeerConnection-setDescription-transceiver.html',
74
- // '/webrtc/RTCPeerConnection-setLocalDescription-answer.html',
75
- // '/webrtc/RTCPeerConnection-setLocalDescription.html',
76
- // '/webrtc/RTCPeerConnection-setLocalDescription-offer.html',
77
- // '/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https.html',
78
- // '/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html',
79
- // '/webrtc/RTCPeerConnection-setLocalDescription-rollback.html',
80
- // '/webrtc/RTCPeerConnection-setRemoteDescription-answer.html',
81
- // '/webrtc/RTCPeerConnection-setRemoteDescription.html',
82
- // '/webrtc/RTCPeerConnection-setRemoteDescription-nomsid.html',
83
- // '/webrtc/RTCPeerConnection-setRemoteDescription-offer.html',
84
- // '/webrtc/RTCPeerConnection-setRemoteDescription-pranswer.html',
85
- // '/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html',
86
- // '/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html',
87
- // '/webrtc/RTCPeerConnection-setRemoteDescription-simulcast.https.html',
88
- // '/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html',
89
- // '/webrtc/RTCPeerConnection-SLD-SRD-timing.https.html',
90
- // '/webrtc/RTCPeerConnection-transceivers.https.html',
91
- // '/webrtc/RTCPeerConnection-transport-stats.https.html',
92
- // '/webrtc/RTCPeerConnection-videoDetectorTest.html',
93
- // '/webrtc/RTCRtpParameters-codecs.html',
94
- // '/webrtc/RTCRtpParameters-encodings.html',
95
- // '/webrtc/RTCRtpParameters-headerExtensions.html',
96
- // '/webrtc/RTCRtpParameters-maxFramerate.html',
97
- // '/webrtc/RTCRtpParameters-rtcp.html',
98
- // '/webrtc/RTCRtpParameters-transactionId.html',
99
- // '/webrtc/RTCRtpReceiver-audio-jitterBufferTarget-stats.https.html',
100
- // '/webrtc/RTCRtpReceiver-getCapabilities.html',
101
- // '/webrtc/RTCRtpReceiver-getContributingSources.https.html',
102
- // '/webrtc/RTCRtpReceiver-getParameters.html',
103
- // '/webrtc/RTCRtpReceiver-getStats.https.html',
104
- // '/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html',
105
- // '/webrtc/RTCRtpReceiver.https.html',
106
- // '/webrtc/RTCRtpReceiver-jitterBufferTarget.html',
107
- // '/webrtc/RTCRtpReceiver-video-jitterBufferTarget-stats.html',
108
- // '/webrtc/RTCRtpSender-encode-same-track-twice.https.html',
109
- // '/webrtc/RTCRtpSender-getCapabilities.html',
110
- // '/webrtc/RTCRtpSender-getParameters.html',
111
- // '/webrtc/RTCRtpSender-getStats.https.html',
112
- // '/webrtc/RTCRtpSender.https.html',
113
- // '/webrtc/RTCRtpSender-replaceTrack.https.html',
114
- // '/webrtc/RTCRtpSender-setParameters.html',
115
- // '/webrtc/RTCRtpSender-setParameters-keyFrame.html',
116
- // '/webrtc/RTCRtpSender-setStreams.https.html',
117
- // '/webrtc/RTCRtpSender-transport.https.html',
118
- // '/webrtc/RTCRtpTransceiver-direction.html',
119
- // '/webrtc/RTCRtpTransceiver.https.html',
120
- // '/webrtc/RTCRtpTransceiver-setCodecPreferences.html',
121
- // '/webrtc/RTCRtpTransceiver-stop.html',
122
- // '/webrtc/RTCRtpTransceiver-stopping.https.html',
123
- // '/webrtc/RTCSctpTransport-constructor.html',
124
- // '/webrtc/RTCSctpTransport-events.html',
125
- // '/webrtc/RTCSctpTransport-maxChannels.html',
126
- // '/webrtc/RTCSctpTransport-maxMessageSize.html',
127
- // '/webrtc/RTCTrackEvent-constructor.html',
128
- // '/webrtc/RTCTrackEvent-fire.html',
129
- // '/webrtc/simplecall.https.html',
130
- // '/webrtc/simplecall-no-ssrcs.https.html',
131
- // '/webrtc/toJSON.html',
132
-
133
- // Failed or skipped tests
134
- // '/webrtc/RTCCertificate-postMessage.html', // SKIP, iframe
135
- // '/webrtc/RTCDataChannel-close.html', // Not ending
136
- // '/webrtc/RTCDataChannel-GC.html', // Not ending
137
- // '/webrtc/RTCDataChannel-send-close.html', // libdatachannel not giving OperationError error
138
- // '/webrtc/RTCDataChannel-send.html', // throws Error
139
- ];
@@ -1,131 +0,0 @@
1
- // Run WPT manually before calling this script
2
-
3
- import { JSDOM, VirtualConsole } from 'jsdom';
4
- import { TextEncoder, TextDecoder } from 'util';
5
- import puppeteer from 'puppeteer';
6
- import ndcPolyfill from '../../polyfill/index.js';
7
-
8
- export async function runWptTests(wptTestList, _forChrome = false, _wptServerUrl = 'http://web-platform.test:8000') {
9
- let browser;
10
- let results = [];
11
-
12
- if (_forChrome)
13
- browser = await puppeteer.launch({
14
- headless: true,
15
- devtools: true,
16
- });
17
-
18
- // call runTest for each test path
19
- for (let i = 0; i < wptTestList.length; i++) {
20
- console.log(`Running test: ${wptTestList[i]} `);
21
- const path = `${_wptServerUrl}${wptTestList[i]}`;
22
- const result = _forChrome ? await runTestForChrome(browser, path) : await runTestForLibrary(path);
23
- results.push({ test: wptTestList[i], result });
24
-
25
- // sleep for 1 second
26
- // await new Promise((resolve) => setTimeout(resolve, 1000));
27
- }
28
-
29
- // close the client
30
- if (_forChrome) await browser.close();
31
-
32
- return results;
33
- }
34
-
35
- function runTestForLibrary(filePath) {
36
- // return new promise
37
- return new Promise((resolve, reject) => {
38
- const virtualConsole = new VirtualConsole();
39
- virtualConsole.sendTo(console);
40
-
41
- JSDOM.fromURL(filePath, {
42
- runScripts: 'dangerously',
43
- resources: 'usable',
44
- pretendToBeVisual: true,
45
- virtualConsole,
46
- beforeParse(window) {
47
- // Assign the polyfill to the window object
48
- Object.assign(window, ndcPolyfill);
49
-
50
- // Overwrite the DOMException object
51
- window.DOMException = DOMException;
52
- window.TypeError = TypeError;
53
- window.TextEncoder = TextEncoder;
54
- window.TextDecoder = TextDecoder;
55
- window.Uint8Array = Uint8Array;
56
- window.ArrayBuffer = ArrayBuffer;
57
- },
58
- }).then((dom) => {
59
- // Get the window object from the DOM
60
- const { window } = dom;
61
- window.addEventListener('load', () => {
62
- window.add_completion_callback((results) => {
63
- window.close();
64
-
65
- // Meaning of status
66
- // 0: PASS (test passed)
67
- // 1: FAIL (test failed)
68
- // 2: TIMEOUT (test timed out)
69
- // 3: PRECONDITION_FAILED (test skipped)
70
- const returnObject = [];
71
- for (let i = 0; i < results.length; i++) {
72
- returnObject.push({
73
- name: results[i].name,
74
- message: results[i].message,
75
- status: results[i].status,
76
- });
77
- }
78
- return resolve(returnObject);
79
- });
80
- });
81
- });
82
- });
83
- }
84
-
85
- async function runTestForChrome(browser, filePath) {
86
- const page = await browser.newPage();
87
- // Evaluate the script in the page context
88
- await page.evaluateOnNewDocument(() => {
89
- function createDeferredPromise() {
90
- let resolve, reject;
91
-
92
- let promise = new Promise(function (_resolve, _reject) {
93
- resolve = _resolve;
94
- reject = _reject;
95
- });
96
-
97
- promise.resolve = resolve;
98
- promise.reject = reject;
99
- return promise;
100
- }
101
-
102
- window.addEventListener('load', () => {
103
- window.resultPromise = createDeferredPromise();
104
- window.add_completion_callback((results) => {
105
- // window.returnTestResults.push({ name: test.name, message: test.message, status: test.status });
106
- let returnTestResults = [];
107
- for (let i = 0; i < results.length; i++) {
108
- returnTestResults.push({
109
- name: results[i].name,
110
- message: results[i].message,
111
- status: results[i].status,
112
- });
113
- }
114
- window.resultPromise.resolve(returnTestResults);
115
- });
116
- });
117
- });
118
-
119
- // Navigate to the specified URL
120
- await page.goto(filePath, { waitUntil: 'load' });
121
-
122
- // get the results
123
- const results = await page.evaluate(() => {
124
- return window.resultPromise;
125
- });
126
-
127
- // close the page
128
- await page.close();
129
-
130
- return results;
131
- }
File without changes
File without changes
File without changes
File without changes