-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Usage with jest unstable #17
Comments
Hi @derweili! The Though I did find that inside this service the plugin will rerun Are you in the position to test this with your setup as described above? If so I could create a PR for you to test. |
@boazpoolman yes I can test it again. What do I have to do? Install a newer version of this plugin? |
@derweili I've created a PR in which this issue is hopefully fixed. You can use it in your project like so:
|
@boazpoolman I just testet the PR, unfortunately I still get the error. I also sometimes (very rarely) get an error when initiating the Strapi instance. But because this only happend two times, I wasn't able to verify if this is related to this plugin. Don't you have to return this await importSingleConfig function? |
Thanks for testing again @derweili! Seems hard to reproduce, too bad that the PR doesn't fix the issue. PS: Returning the |
Strapi v4 has been released, and this plugin was migrated along with it. In the migrated plugin this should likely be fixed as a lot of improvements have been made for the
Released in v1.0.0-alpha.1 of |
I tried to used this plugin together with Jest.
I thought I could setup the user permissions using strapi admin, export the settings using this plugin and load those settings during the test runs with jest. So I do not have to manually setup the permissions during each test run.
This first worked for me, but I then noticed errors:
Sometimes, the settings do not get imported.
Example:
When running
npm test
5 times, it will likely work 4 times but 1 time it will fail, without anything changed in between.In my example I have some routes wich should only be accessible for authorized users. Most of the time the requests work but sometimes I get forbidden errors.
error.mov
I suspect that the import runs asynchronously in the background and sometimes the import is not completed before the tests run. But I am not sure about that.
Is there a reference implementation for use with Jest?
I setup Jest as Described in the strapi docs:
https://strapi.io/documentation/developer-docs/latest/guides/unit-testing.html#testing-basic-endpoint-controller
this is my config-sync config:
This is the test that's running in my example video:
The text was updated successfully, but these errors were encountered: