supertest icon indicating copy to clipboard operation
supertest copied to clipboard

[fix] Module not found: Error: Can't resolve 'http' in '[...]/node_modules/supertest/lib'

Open mcoulont opened this issue 1 year ago • 1 comments

This error occurs when running ng test (Angular/Karma/Jasmine)

Node.js version: v18.13.0se

OS version: Ubuntu 22.04.2 LTS

Description: Module not found: Error: Can't resolve 'http' in '[...]/node_modules/supertest/lib'

Actual behavior

ng test crashes and doesn't run

Expected behavior

ng test runs

Code to reproduce

it("webmaster's email address", async done => {
    const response = await request.get('/test')
    expect(response.status).toBe(200)
    expect(response.body.message).toBe('pass!')
    done()
 })

Checklist

  • [X] I have searched through GitHub issues for similar issues.
  • [ ] I have completely read through the README and documentation.
  • [ ] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

mcoulont avatar Mar 20 '23 20:03 mcoulont

The http module doesn't seem available any more: see README.md in http homepage. So, how is supertest suppose to work?

mcoulont avatar Mar 22 '23 21:03 mcoulont