ladjs / supertest

🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mcoulont opened this issue · 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

  • 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.

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