Skip to content

Commit 046f089

Browse files
committed
fix: use WsAdapter in e2e tests to match main.ts setup
The app uses @nestjs/platform-ws, not socket.io. Without explicitly setting the WsAdapter before app.init(), NestJS tries to load the default socket.io adapter which is not installed.
1 parent 6f65919 commit 046f089

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

test/app.e2e-spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Test, TestingModule } from "@nestjs/testing";
22
import { INestApplication } from "@nestjs/common";
3+
import { WsAdapter } from "@nestjs/platform-ws";
34
import * as request from "supertest";
45
import { AppModule } from "../src/app.module";
56

@@ -12,6 +13,7 @@ describe("AppController (e2e)", () => {
1213
}).compile();
1314

1415
app = moduleFixture.createNestApplication();
16+
app.useWebSocketAdapter(new WsAdapter(app));
1517
await app.init();
1618
});
1719

test/auth.e2e-spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Test, TestingModule } from "@nestjs/testing";
22
import { INestApplication } from "@nestjs/common";
3+
import { WsAdapter } from "@nestjs/platform-ws";
34
import * as request from "supertest";
45
import { AppModule } from "../src/app.module";
56

@@ -12,6 +13,7 @@ describe("Auth Guards (e2e)", () => {
1213
}).compile();
1314

1415
app = moduleFixture.createNestApplication();
16+
app.useWebSocketAdapter(new WsAdapter(app));
1517
await app.init();
1618
});
1719

test/matches.e2e-spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Test, TestingModule } from "@nestjs/testing";
22
import { INestApplication } from "@nestjs/common";
3+
import { WsAdapter } from "@nestjs/platform-ws";
34
import * as request from "supertest";
45
import { AppModule } from "../src/app.module";
56

@@ -20,6 +21,7 @@ describe("Matches (e2e)", () => {
2021
}).compile();
2122

2223
app = moduleFixture.createNestApplication();
24+
app.useWebSocketAdapter(new WsAdapter(app));
2325
await app.init();
2426
});
2527

0 commit comments

Comments
 (0)