Open hillac opened 1 month ago
This is great!! I have also problem with supertest
and https://github.com/uNetworking/uWebSockets
Yeah, Ill make a bridge for supertest that converts node req res to uws req res.
The bridge kind of works. It just sends the request to the server with fetch. Ill try with http.request and see whats better.
The bridge kind of works. It just sends the request to the server with fetch. Ill try with http.request and see whats better.
uhm... this is gold! https://github.com/dimdenGD/ultimate-express/pull/22/commits/90d987a3cb13a88a760fcaa60e652a1f9c74c93b
I can publish it as a separate package if you think it's useful
I can publish it as a separate package if you think it's useful
why not!? I think it is useful for test uWebSockets... maybe tou can contribute directly on supertest repo?
PS. @dimdenGD and @hillac I think some tests will fail because "ultimate-express" caches some computed properties of the request. In this case, perhaps it is useful to provide a setting to disable caching of such properties for stick with express behaviour during the test, e.g.: https://github.com/dimdenGD/ultimate-express/blob/main/src/request.js#L202
I realized a much easier way to do it is to simply create a wrapper class that provides the minimum interface of a node http server that supertest expects. Now to figure out which express tests are useful... there's a lot.
This adds every test from the express repo. Heaps are failing so still need to go through and figure out which errors actually matter. I think we need some kind of replacement supertest.
run with
npx mocha --require tests/express-tests/test/support/env --reporter spec --check-leaks tests/express-tests/test/ tests/express-tests/test/acceptance/