1
1
"use strict" ;
2
2
3
+ import { Server } from ".." ;
4
+
3
5
const http = require ( "http" ) . Server ;
4
6
const io = require ( ".." ) ;
5
7
const fs = require ( "fs" ) ;
@@ -12,7 +14,7 @@ const expect = require("expect.js");
12
14
require ( "./support/util" ) ;
13
15
14
16
// Creates a socket.io client for the given server
15
- function client ( srv , nsp , opts ) {
17
+ function client ( srv , nsp ?: string | object , opts ?: object ) {
16
18
if ( "object" == typeof nsp ) {
17
19
opts = nsp ;
18
20
nsp = null ;
@@ -88,7 +90,7 @@ describe("socket.io", () => {
88
90
} ) ;
89
91
} ) ;
90
92
91
- describe ( "port" , done => {
93
+ describe ( "port" , ( ) => {
92
94
it ( "should be bound" , done => {
93
95
const sockets = io ( 54010 ) ;
94
96
request ( "http://localhost:54010" )
@@ -335,7 +337,7 @@ describe("socket.io", () => {
335
337
}
336
338
337
339
it ( "should stop socket and timers" , done => {
338
- exec ( fixture ( "server-close.js " ) , done ) ;
340
+ exec ( fixture ( "server-close.ts " ) , done ) ;
339
341
} ) ;
340
342
} ) ;
341
343
} ) ;
@@ -345,7 +347,7 @@ describe("socket.io", () => {
345
347
const { Namespace } = require ( "../dist/namespace" ) ;
346
348
347
349
it ( "should be accessible through .sockets" , ( ) => {
348
- const sio = io ( ) ;
350
+ const sio : Server = io ( ) ;
349
351
expect ( sio . sockets ) . to . be . a ( Namespace ) ;
350
352
} ) ;
351
353
@@ -1721,8 +1723,11 @@ describe("socket.io", () => {
1721
1723
} ) ;
1722
1724
1723
1725
it ( "should not crash when messing with Object prototype (and other globals)" , done => {
1726
+ // @ts -ignore
1724
1727
Object . prototype . foo = "bar" ;
1728
+ // @ts -ignore
1725
1729
global . File = "" ;
1730
+ // @ts -ignore
1726
1731
global . Blob = [ ] ;
1727
1732
const srv = http ( ) ;
1728
1733
const sio = io ( srv ) ;
@@ -2101,7 +2106,7 @@ describe("socket.io", () => {
2101
2106
} ) ;
2102
2107
} ) ;
2103
2108
2104
- describe ( "middleware" , done => {
2109
+ describe ( "middleware" , ( ) => {
2105
2110
const { Socket } = require ( "../dist/socket" ) ;
2106
2111
2107
2112
it ( "should call functions" , done => {
@@ -2270,7 +2275,7 @@ describe("socket.io", () => {
2270
2275
} ) ;
2271
2276
} ) ;
2272
2277
2273
- describe ( "socket middleware" , done => {
2278
+ describe ( "socket middleware" , ( ) => {
2274
2279
const { Socket } = require ( "../dist/socket" ) ;
2275
2280
2276
2281
it ( "should call functions" , done => {
0 commit comments