Site editor

Our testem config


by Ryan Toronto

Have you ever had testem launch too many instances of your browser while running ember test --server? If so your dock might look something like this:

To prevent this we recently changed our testem.js config to not launch any browsers in development mode. When we run ember test --server, testem starts up, but doesn't open any browsers or run any tests. It looks like this:

Then in our browser we go to the test runner URL http://localhost:7357 (many terminals let you +click the URL from testem's output). The tests will start running and live reload works as we change code, but testem will never launch a new browser instance so our dock stays nice and tidy.

The other benefit is if you ever find yourself needing to restart Ember CLI, your current test runner URL will stick around in your main browser window. This is nice if you've filtered the runner down to focus on a specific test or module — just restart Ember CLI and refresh.

Here's EmberMap's current testem.json

// testem.js
/* eslint-env node */
module.exports = {
  test_page: 'tests/index.html?hidepassed',
  disable_watching: true,
  launch_in_ci: [
    "Chrome"
  ],
  launch_in_dev: [
  ],
  browser_args: {
    "Chrome": [
      '--headless',
      '--disable-gpu',
      '--remote-debugging-port=9222',
      '--window-size=1440,900'
    ]
  }
};

Questions?

us, or ask in #media on Discord