Nestjs测试e2e经济性127.0.0.1:80

Nestjs测试e2e经济性127.0.0.1:80,nestjs,e2e-testing,Nestjs,E2e Testing,在使用Nestjs运行测试e2e以测试dto时,我遇到了错误econnrefered127.0.0.1:80 这是我的密码: const TEST_URL = 'test'; @Controller(TEST_URL) class TestController { @Post() public test(@Body() param: TimeTableParam) { // nothing } } describe('TimeTableParam', () => {

在使用Nestjs运行测试e2e以测试dto时,我遇到了错误
econnrefered127.0.0.1:80

这是我的密码:

const TEST_URL = 'test';

@Controller(TEST_URL)
class TestController {
  @Post()
  public test(@Body() param: TimeTableParam) {
    // nothing
  }
}

describe('TimeTableParam', () => {
  let app: INestApplication;

  beforeAll(async () => {
    const module: TestingModule = await Test.createTestingModule({
      controllers: [TestController],
    }).compile();

    app = module.createNestApplication();
    await app.init();
  });

  afterAll(async () => {
    await app.close();
  });

  describe('...', () => {
    it(`should ...`, () => {
      //...
    });
  });
});

修复方法非常简单,但很难找到。这就是我所做的:

const TEST_URL = '/test';
                  ^ add a '/'

谢谢我要花很长时间才能弄明白!