-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Recipe for handling concurrency and atomic tests #472
Comments
This should also include handling dependency mocking. From Gitter:
|
Ideally each test file controls its own fixtures (e.g. different database name from other test files). If that's not possible you'd have to run a setup process before invoking AVA and a teardown process after. I wonder if we could support global |
It seems you would need to create a database and user with correct permissions (or use the root one) for every test file if run with serial mode otherwise you would need to create it for every test. And your app have to have the ability to change connection settings dynamically, like with arguments or something. There is also question about selenium like e2e testing. Not sure how ava would fit. With databases it is getting interesting, initially i didn't think it would be applicable... but selenium thing seems like a problem. I think though those all should be different recipes - database, mocking, e2e, etc |
for tests that needed do stuff with a mongodb database (with mongoose) I used |
I would love that |
I'll see if I can find some time :) |
one inconvenience with |
@nfcampos could u post an example of how to use ava with mockgoose ? |
very generally there's a couple things to be aware of
|
can't I have a different "database" for each test? |
@sibelius answered you on the other thread |
reviving an old discussion, but i've hacked together something for my company with a I'd rather use EDIT: seems that the hard to find docs for stuff like this that plays around with the internals of the library. or alternatively, does the recent shared workers functionality provide a potential alternative? though sounds like that'd be more like making one shared db that all the parallel workers would have to share, like taking turns grabbing a mutex to access it; sounds not great so probably not that lol #2605 |
@osdiab would you mind starting a discussion for this? |
Concurrency complicates some things like creating fixtures on disk, database, services, etc. Would be nice to document best-practises for handling this.
For example, for disk fixtures the recommended best-practise is using temp files.
What kind of challenges did you have converting/creating tests to be atomic? Let's discuss.
From the gitter chat:
The text was updated successfully, but these errors were encountered: