feat(core): change listen to reject on server bind failures

pr update
This commit is contained in:
branbranmuffin
2019-11-08 00:33:43 -07:00
parent 9e20b0a858
commit 4cc2d1874a
14 changed files with 231 additions and 34237 deletions

View File

@@ -12,7 +12,7 @@ describe('ErrorGateway', () => {
providers: [ErrorGateway],
}).compile();
app = await testingModule.createNestApplication();
await app.listenAsync(3000);
await app.listen(3000);
});
it(`should handle error`, async () => {

View File

@@ -17,7 +17,7 @@ describe('WebSocketGateway (ack)', () => {
it(`should handle message with ack (http)`, async () => {
app = await createNestApp(AckGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = io.connect('http://localhost:8080');
await new Promise<void>(resolve =>
@@ -30,7 +30,7 @@ describe('WebSocketGateway (ack)', () => {
it(`should handle message with ack & without data (http)`, async () => {
app = await createNestApp(AckGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = io.connect('http://localhost:8080');
await new Promise<void>(resolve =>

View File

@@ -19,7 +19,7 @@ describe('WebSocketGateway', () => {
it(`should handle message (2nd port)`, async () => {
app = await createNestApp(ApplicationGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = io.connect('http://localhost:8080');
ws.emit('push', {
@@ -35,7 +35,7 @@ describe('WebSocketGateway', () => {
it(`should handle message (http)`, async () => {
app = await createNestApp(ServerGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = io.connect('http://localhost:3000');
ws.emit('push', {
@@ -51,7 +51,7 @@ describe('WebSocketGateway', () => {
it(`should handle message (2 gateways)`, async () => {
app = await createNestApp(ApplicationGateway, NamespaceGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = io.connect('http://localhost:8080');
io.connect('http://localhost:8080/test').emit('push', {});

View File

@@ -21,7 +21,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
it(`should handle message (2nd port)`, async () => {
app = await createNestApp(ApplicationGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = new WebSocket('ws://localhost:8080');
await new Promise(resolve => ws.on('open', resolve));
@@ -44,7 +44,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
it(`should handle message (http)`, async () => {
app = await createNestApp(ServerGateway);
await app.listenAsync(3000);
await app.listen(3000);
ws = new WebSocket('ws://localhost:3000');
await new Promise(resolve => ws.on('open', resolve));
@@ -69,7 +69,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
this.retries(10);
app = await createNestApp(ApplicationGateway, CoreGateway);
await app.listenAsync(3000);
await app.listen(3000);
// open websockets delay
await new Promise(resolve => setTimeout(resolve, 1000));