Node.js 如何在gitlab runner中启动服务器?
我的测试用的是玩笑和超级测试。本地所有工作,但在gitlab runner(gitlab ci)内部都失败,因为:Node.js 如何在gitlab runner中启动服务器?,node.js,typescript,jestjs,gitlab-ci,supertest,Node.js,Typescript,Jestjs,Gitlab Ci,Supertest,我的测试用的是玩笑和超级测试。本地所有工作,但在gitlab runner(gitlab ci)内部都失败,因为: TypeError: Cannot read property 'address' of undefined 此错误是因为找不到服务器,但是否存在o_o 只有在运行程序内部才会出现此错误 测试示例: beforeAll(async () => { app = await Server.init(); }); afterAll(async () => {
TypeError: Cannot read property 'address' of undefined
此错误是因为找不到服务器,但是否存在o_o
只有在运行程序内部才会出现此错误
测试示例:
beforeAll(async () => {
app = await Server.init();
});
afterAll(async () => {
await app.close();
});
test('it should return 200', async () => {
const res = await request(app).post(`${URL}/ok`).send(body);
expect(res.status).toEqual(200);
});
我正在应用程序中导出侦听服务器。此测试包含在描述中
谢谢