当尝试从 NestJS 示例运行 e2e 测试时,我的测试未编译为“无法调用其类型缺少调用签名的表达式”行
request(app.getHttpServer())
Run Code Online (Sandbox Code Playgroud)
代码来自 NestJS 测试示例。
这可能与我的 tsconfig 有关?
import * as request from "supertest";
import { Test } from "@nestjs/testing";
import { INestApplication } from "@nestjs/common";
describe("App", () => {
let app: INestApplication;
beforeAll(async () => {
const module = await Test.createTestingModule({
imports: []
}).compile();
app = module.createNestApplication();
await app.init();
});
it(`/GET`, () => {
return request(app.getHttpServer())
.get("/")
.expect(200);
});
afterAll(async () => {
await app.close();
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1358 次 |
| 最近记录: |