运行docker-compose up
之后,Prisma服务器正在端口4466上运行。我想编写一个测试用例,它将检查它是否正在运行。
我该如何实现?
到目前为止,我已经尝试过]
const url = "http://localhost:4466"; const request = require("supertest")(url); it("check if prisma server is open or not", done => { request .get("/") .expect(400) .end((err, res) => done()); });
但它始终通过测试。无论状态码为200还是400。
在运行docker-compose up Prisma服务器后,在端口4466上运行。我想编写一个测试用例,它将检查它是否正在运行。我该如何实现?到目前为止,我已经尝试过了...
我不确定您是否真的要进行测试或要确保Prisma
在任何其他服务启动之前都在运行。在这种情况下,我建议在wait-port文件中使用docker-compose
。