-
Notifications
You must be signed in to change notification settings - Fork 439
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
Tests only? #2498
Comments
https://www.ember-cli-mirage.com/docs/advanced/environment-options#enabled These configurations are the main reason I think this addon should go away or at least be really stripped down. Now that the changes have been made to call the mirage server create in your code instead of behind the scenes, you should have a lot more control over the process. I still use this addon, but want to do a demo project using mirage and NOT using this addon, then adopt that pattern to my app and post accordingly. |
yeah, with just this config, I'm not confident that the mirage assets are excluded from the dev build 🤔 I will have to test it out, and see what it does.
that sounds legit! How much work do you think native mirage is? |
I think this works the same, set it in your config if the environment is dev. https://www.ember-cli-mirage.com/docs/advanced/environment-options#excludefilesfrombuild I dont think its a lot of work to remove this addon, and prob could be code modded. The method setupMirage is still valuable in a different form. It would either be example code that people would just copy, or one of the few surviving helpers that might continue to exist in this repo Mirage is based on pretender, in case you werent aware though, I extracted the pretender stuff from mirage and you can now use pretender or msw (pretender will still be included til we actually remove the pretender from mirage proper) |
actually, reading through the code, it seems in that it's not used in the Reading the docs, it looks like where am I understanding this correctly? |
oh I am. I hate pretender. lol. |
The if you were aware was more that you can use MSW now in mirage instead of pretender (pretender will still be compiled in until its actually removed from miragejs). You might have missed this above but |
I just booted my app trying to disable mirage, and I confirm there are no mirage assets in the |
but! @cah-brian-gantzler followup -- can we have an option to move everything, when included, in to the tests bundle? |
While I understand what you are requesting, I am not sure what would need to be done to accomplish that. Always willing to learn more. I, though, am hesitant to make any changes to this repo given that Im kinda of advocating that this repo should not be needed anymore. :) Will try to make it a priority to get a write of how I think Mirage should be used directly (or find out what if actually needed in this repo to make it work). You should be able to follow the call setupMirage in your tests to find where you create the server. setupMirage should take some parameters that should allow you to specify a different server config for each test if you wanted. Right now because its called indirectly, if very difficult to do that. setupMirage should also appear in your actual code (with a condition), if you want to use it during dev, and without the condition if you want to use it in prod. The parameters allowing you to specify a different mirage server config that are being using in the tests (if needed, if they all pass the same param you would have what you have now, one server config). To do that I think the setupMirage should be wrapped in a helper (one for each server setup) and then you import the correct one for the test that is needed. Kinda like they are suggesting for the setup* test helpers https://github.com/emberjs/rfcs/blob/master/text/0637-customizable-test-setups.md Just ideas, havent gotten the time to actually prove out what would not work and what to do to fix that. |
@cah-brian-gantzler any examples of using mirage directly? |
There are some in this repo: https://github.com/bgantzler/ember-mirage/ |
Is it possible to have mirage only be used as testing tool?
I'd like to not have mirage available during local dev, but only as a mocking tool.
Thanks!!
The text was updated successfully, but these errors were encountered: