Unit Tests: strapi.server.httpServer not working

System Information
  • Strapi Version: 4.14.0
  • Operating System: Mac
  • Database: Postgres
  • Node Version: 18
  • NPM Version:
  • Yarn Version: 1.22.19

I set up a test environment on a new strapi app (Typescript) following the example in the docs - Testing | Strapi Documentation. When I run this test:

it("should return hello world", async () => {
  await request(strapi.server.httpServer)
    .expect(200) // Expect response http code 200
    .then((data) => {
      expect(data.text).toBe("Hello World!"); // expect the response text

I get this error:

expected 200 "OK", got 404 "Not Found"

When I replace strapi.server.httpServer with say “”- the url of a running strapi app, the test runs successfully.

Please what do I need to do to fix this?

i have the same problem :frowning: , have you found a solution?

@Karima_Harabidi Unfortunately no.

Having the issues, is there any fix incoming?