Run Specific Test


Hi there.
How would one run a specific test?
If I have for example test/functional/auth.spec.js how can I run just that specific test?

$> node ace test -h

  test [group] [options]

  group                 Define the test groups to be executed. Multiple groups are seperated by comma

  -b, --bail            Stop running tests on first failure
  -t, --timeout <value> Define a global timeout for all the tests
  -f, --files <value>   Pick only specific files. File names are seperated by comma
  -g, --grep <value>    Grep on tests title to run only selected tests
  --glob <value>        Define a custom glob to pick test files

  Run application tests

So that would be the --files option.


Excellent! It works, thanks


Test runners such as mocha allow you to add a .only to a test or suite of tests, is this possible using the test runner that ships with adonis?

Running a single spec with mocha:

describe(function () {
  // these tests will be skipped

describe.only(function () {
  // these tests will run

Running a single test with mocha:

it.only(function () {
  // this test will run

it(function () {
  // this test will be skipped


Not possible and I’ve opened an issue for that, I think already.

But you can use the command line --grep option to limit to a specific test by name. Not the optimal solution, of course, but it could work in some cases.

I’d also love to have .only option, especially when developing tests or running them thru a debugger.


@moltar Do you possibly have a link you can share for the referenced issue?