mercredi 4 septembre 2019

Disable Ember Mirage when running tests in the browser

I would like to be able to run tests against my Mirage server, and my actual server in turn.

I've read these docs on disabling Mirage, and it works as expected for the development environment. Adding the code below disables Mirage at http://localhost:4200.

 ENV['ember-cli-mirage'] = {
    enabled: false
  };

However, this does not disable mirage when running tests in the browser at http://localhost:4200/tests.

I have added the code above outside of any of the environment specific conditionals, so it should apply to all environments. For good measure, I have also tried adding the code above inside each of the three environment specific conditionals as well:

 ENV['ember-cli-mirage'] = {
    enabled: false
  };

if (environment === 'production') {
  ENV['ember-cli-mirage'] = {
    enabled: false
  };
}
if (environment === 'development') {
  ENV['ember-cli-mirage'] = {
    enabled: false
  };
}
if (environment === 'test') {
  ENV['ember-cli-mirage'] = {
    enabled: false
  };
}

http://localhost:4200/tests still uses Mirage.

Is there a way to disable Mirage when testing in the browser? I would like to be able to enable it easily, so uninstalling Mirage is not an option.




Aucun commentaire:

Enregistrer un commentaire