-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
docs(fake-timers): added a page for using MikroORM with Jest, with fake timers info #5157
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5157 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 221 221
Lines 16571 16585 +14
Branches 4016 4020 +4
=======================================
+ Hits 16530 16544 +14
Misses 41 41 ☔ View full report in Codecov by Sentry. |
f9c1929
to
14b1ccb
Compare
It looks great overall. A few notes for now:
|
…ke timers info Closes mikro-orm#4994.
14b1ccb
to
981ba24
Compare
Not necessarily... In the case of vitest, according to their docs, they don't mock
Fixed
Realistically, it would end up as abandonware if I was to publish it, because I am not using any testing framework for my employer's projects... yet. Not to mention that for most people, not mocking nextTick is a perfectly fine workaround. This has a better chance to be kept up to date if someone more
I'm not sure what to include in such a section that wouldn't already be in the getting started guide of the test framework or the initial setup of MikroORM already. |
Even if it's not the case, I still want one testing page in docs, not multiple recipes for different frameworks, as each has its own quirks and I want to have this documented at one place (later on, when we have more content, we can have more pages in a dedicated section).
Vitest requires additional setup for folder-based discovery to work, that's one thing, and later on even more (e.g. mocking). Getting started guide is not supposed to be the single source of truth, it already duplicates most of the information that is in there. And there are more things we should add there going forward, like the required metadata discovery for working with entity classes (so propagation can work). People often ask for some suggestions around testing, we need to have a place to put them into.
Well, by merging it into master, you are making it my responsibility. I get what you mean, but realistically, if you as its author won't be the one who maintains it, it will likely get outdated in the long run anyway. But let's not discuss that further, I am fine merging it in, it's just weird to have that in the docs as it's pretty complex code on its own.
That's not really an argument, the package would be linked and used in the examples in the docs here, making it discoverable the same way. I'd argue it's the opposite, if you turn it into a package, its no longer "some piece of code in MikroORM docs" but something universal people can use with other ORMs too - as the problem is not directly connected to the ORM but to its dependencies. |
I'll move things around once we have the dedicated testing section, let's move this forward as is. Thanks again! |
Closes #4994.
I know what I said before about
glob
on init, but... I tried to locate the exact source, and couldn't find it now... I'm guessing maybe they changed in some recent versions, and maybe I was looking at an outdated one at the time. Anyhow, I haven't included it in the docs due to that.The code shown for a workaround is a more polished version of what I showed in #4994, and after some research, I found a workaround for Mongo that I also included.
EDIT: Workaround provided is probably a bit too hacky... I'm researching something more elegant and less memory leak-y.
EDIT2: OK, I think I have a better workarounds for each driver now, targeting specifically the things that absolutely need a real
process.nextTick()
and nothing else.