Controlling which tests get executed with ember-cli


#1

I am looking for tips on how to control which tests get run from the ember-cli command line. For example, I sometimes want to run just my unit tests, or perhaps just the tests in a single test file.

So is there a way to filter the test files loaded by path name? e.g. ember test tests/unit/*.js

Or perhaps even filter the tests which are run by some regex on test names?

Thanks


#2

ember test --filter="something-to-filter-by" will run only tests that have something-to-filter-by in the module name or test name.


#4

Is there some way to run the tests based on path to the test? I’m trying to build a tool for running tests based on their path, and I can’t figure out a way to do that reliably without knowing about the tests themselves (since you’d need to parse the file to determine the module or test name).

For example, I would like to be able to just run whatever tests are in tests/unit/services/session-test.js.

However, using --filter with…

  • services/session-test.js
  • unit/services/session-test.js
  • services/session
  • service:session

all don’t work. The only thing that seems to work is passing the module name specified in the file to the filter options, but that doesn’t work too nicely with that I’m trying to do since that string could be totally unrelated to the file name and path. Any suggestions?


#5

Is there a way to pass a querystring to the browser tests when running ember test --serve? I’d love to run these with the container turned off, or skipping the jshint tests, or hiding passed tests on reload.


#6

@danfinlay in your browser you can grep. for example: http://localhost:7357/tests/index.html?hidepassed&grep=url%20must%20be%20escaped