Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在gitlab runner中启动服务器?_Node.js_Typescript_Jestjs_Gitlab Ci_Supertest - Fatal编程技术网

Node.js 如何在gitlab runner中启动服务器?

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 () => {

我的测试用的是玩笑和超级测试。本地所有工作,但在gitlab runner(gitlab ci)内部都失败,因为:

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);
});
我正在应用程序中导出侦听服务器。此测试包含在描述中

谢谢