node/test/parallel/test-websocket-disabled.js
Khafra 6ed93b4d69
lib: expose global CloseEvent
This PR adds `CloseEvent` as a global, which can be disabled
via the --no-experimental-websocket flag.

```js
const ws = new WebSocket('...')

ws.addEventListener('close', (event) => {
  assert(event instanceof CloseEvent)
})

```

Fixes: https://github.com/nodejs/node/issues/50275
PR-URL: https://github.com/nodejs/node/pull/53355
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2024-06-07 17:54:28 +00:00

9 lines
213 B
JavaScript

// Flags: --no-experimental-websocket
'use strict';
require('../common');
const assert = require('assert');
assert.strictEqual(typeof WebSocket, 'undefined');
assert.strictEqual(typeof CloseEvent, 'undefined');