ember.jsintegration-testingtest-environments

EmberJS: `ember serve --environment=test` renders blank page


My team is moving to use Cypress for integration testing rather than Embers Acceptance tests. Before, we would just run ember test which set the environment to "test". Now, I don't want to run embers testing suite but I still want the "test" version of our app. So I want to be able to run ember serve --environment=test. However, I noticed that when I did this, I just get a blank screen. The weirdest thing is that when I change it to ember serve --environment=haha (haha being a random environment name that never existed before), I start seeing the app hit my routes like I would expect. I start actually getting application errors in code we wrote in the source, whereas with the test environment, I couldn't even hit a console.log in the application route.

I want to be able to serve my app with the test environment because we're using it for testing. Is this possible? I'm specifically wondering if there's a bunch of magic under the hood with that environment that makes this impossible or if it's just something else I need to do that I'm missing.


Solution

  • I'm not sure what side effects this would have, but you can get your app running with ember serve --environment=test if you comment out two lines in your config/environment.js file:

    if (environment === 'test') {
      // ENV.APP.rootElement = '#ember-testing'
      // ENV.APP.autoboot = false
    }