Skip to content

Conversation

@hillac
Copy link

@hillac hillac commented Oct 17, 2024

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/

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 17, 2024

Open in Stackblitz

npm i https://pkg.pr.new/dimdenGD/ultimate-express@22

commit: b4de385

@cesco69
Copy link
Contributor

cesco69 commented Oct 18, 2024

This is great!! I have also problem with supertest and https://github.com/uNetworking/uWebSockets

@hillac
Copy link
Author

hillac commented Oct 21, 2024

Yeah, Ill make a bridge for supertest that converts node req res to uws req res.

@hillac
Copy link
Author

hillac commented Oct 21, 2024

The bridge kind of works. It just sends the request to the server with fetch. Ill try with http.request and see whats better.

@cesco69
Copy link
Contributor

cesco69 commented Oct 21, 2024

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! 90d987a

@hillac
Copy link
Author

hillac commented Oct 21, 2024

I can publish it as a separate package if you think it's useful

@cesco69
Copy link
Contributor

cesco69 commented Oct 21, 2024

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

@hillac
Copy link
Author

hillac commented Nov 7, 2024

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.

@nigrosimone nigrosimone mentioned this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants