-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the e2e tests wait for the app to start and close before running next test #2952
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2952 +/- ##
============================================
- Coverage 65.21% 23.13% -42.08%
============================================
Files 14 48 +34
Lines 733 10026 +9293
============================================
+ Hits 478 2320 +1842
- Misses 255 7706 +7451
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hmm, it's so strange that it only fails on 18.x, seems to be when it uses the built in fetch instead of node-fetch. Changing that and it works... |
running the tests locally with But running the single test with |
Maybe something isnt shutdown correctly before the one test? |
yes, but it not depends on which test is running before, had different tests as predecessor ... |
if I put back the ugly "wait" in exports.stopApplication = async () => {
if (global.app) {
return new Promise((resolve, reject) => {
global.app.stop(resolve);
});
}
await new Promise((resolve) => setTimeout(resolve, 100));
return Promise.resolve();
}; |
The fetch fails and there's no Using the following it fails more in a proper way: exports.fetch = (url) => {
return corefetch(url);
}; But haven't yet found out why the fetch fails with native in node 18 and why it works with node-fetch... I wont be able to look into this for a week or so. |
Changed the tests to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. I would just like you to fill the missing jsdoc entries.
Not sure if I requests @khassel to review, otherwise I would merge it |
with this we are using internal node fetch command (for node >=18) in the default modules but the tests are running with |
|
that was my point, I don't like it when we migrate the tests back but the rest not. If the internal fetch is now seen as not production ready it should be removed completly (and may evaluated later again, it is still experimental in node v19) |
but from my side we can merge this and remove internal fetch in another PR |
I am not so deep into the whole node/fetch thing but maybe what is done in the other PR (1c8ea72)
But that is just my "gefährliches halbwissen" (dagnerously half-knowing :-) |
Mocking the requests would probably make most of the tests useless as they verify the response from the server. Don't think that solution can be applied here. I agree that it's better to do it in another PR. Guess we have to wait a bit longer to get rid of that extra dependency :) |
I agree. It would be nice to get rid of a dependency but we should play it safe. |
you can merge. The other change would be here. I would suggest to comment out the can do this PR the next days |
Or I do it on a saturday evening? #2961 ;-) |
As discussed in #2952 Co-authored-by: veeck <michael@veeck.de>
When trying to debug why the tests broke for #2946 I found that the tests does not wait for the app to start and close. So if the startup isn't blocking that would fail.
So I added a callback for
close()
too and converted them to promises for thestartApplication()
andstopApplication()
and updated all the e2e tests to await both. Will try to refactor all these callbacks to promises in a later PR.