-
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
deprecate trackRequests and testConfig #2373
base: v2
Are you sure you want to change the base?
Conversation
The error that all the tests fail on is what I get locally. Its the |
@cah-brian-gantzler noticed you were aiming to deprecate For those of us who did use it the way it was documented in the past, do you have any suggestions on ways to go about ending up with a similar approach in the new world of miragejs? |
You got me curious, so I dug a little further. Doesn't look like it's well documented, but Server still allows So might be worth considering it as intimate api but not yet getting rid of it? |
TestConfig was imported here https://github.com/miragejs/ember-cli-mirage/blob/v2.4.0/app/initializers/ember-cli-mirage.js#L5 (note that this is in the app folder, would like to remove all this) and then registered with the container here https://github.com/miragejs/ember-cli-mirage/blob/v2.4.0/app/initializers/ember-cli-mirage.js#L24. It was then looked up from the container here when mirage was started here https://github.com/miragejs/ember-cli-mirage/blob/v2.4.0/addon/start-mirage.js#L32 and then just merged into the routes here https://github.com/miragejs/ember-cli-mirage/blob/v2.4.0/addon/start-mirage.js#L93 The documentation you found says that this is only supposed to be included when running in test mode, but I dont see an if that implements that. Given that testConfig was already defined in the config file, and you now have control of the code in the default function, you should be able to do something like this.
This puts everything in one place under your control and removes a lot of the magic. |
This seems to be the area of interest within Mirage: https://github.com/miragejs/miragejs/blob/f68581a1b56c4d3e5efcee94641fa761fd3add60/lib/server.js#L287-L319 |
Deprecated the trackRequests environment variable. This is passed on to pretender. This can now be a variable in the final config. While its in the code, I could not find it documented in MirageJS
testConfig was a property that could be passed into
startMirage
that added some additional routes maybe? It was never documented and not sure exactly what it does. Deprecating it in case someone is using it (hopefully they will write an issue and let us know how).