testem 3.11.0 → 3.12.0

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.
@@ -217,10 +217,19 @@ class Server extends EventEmitter {
217
217
  this.proxy = new httpProxy.createProxyServer({changeOrigin: true});
218
218
 
219
219
  this.proxy.on('error', (err, req, res) => {
220
- res.status(500).json(err);
220
+ res && res.status && res.status(500).json(err);
221
221
  });
222
222
 
223
- Object.keys(proxies).forEach(url => {
223
+ Object.keys(proxies).forEach((url) => {
224
+ if (proxies[url].ws === true) {
225
+ // set up proxy for WebSocket
226
+ this.server.on('upgrade', (req, socket, head) => {
227
+ if (req.url.startsWith(url)) {
228
+ this.proxy.ws(req, socket, head, proxies[url]);
229
+ }
230
+ });
231
+ return;
232
+ }
224
233
  app.all(`${url}*`, (req, res, next) => {
225
234
  var opts = proxies[url];
226
235
  if (this.shouldProxy(req, opts)) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "unittest",
8
8
  "browser"
9
9
  ],
10
- "version": "3.11.0",
10
+ "version": "3.12.0",
11
11
  "author": "Toby Ho <airportyh@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "npmlog": "^6.0.0",
46
46
  "printf": "^0.6.1",
47
47
  "rimraf": "^3.0.2",
48
- "socket.io": "^4.1.2",
48
+ "socket.io": "^4.5.4",
49
49
  "spawn-args": "^0.2.0",
50
50
  "styled_string": "0.0.1",
51
51
  "tap-parser": "^7.0.0",