Protractor: Allow running specs from all subdirectories

Created on 27 Apr 2016  路  6Comments  路  Source: angular/protractor

Currently there is not easy way to run all specs from all sub-directories, e.g.

specs/spec.js
specs/feature1/spec.js

Glob pattern implementation in Protractor doesn't have the recursive option so there is no straight-forward way to select all specs under the /specs directory and all sub-directories. There are 2 options:

  • list all specs (which is not very handy if you have many specs)
  • generate list of specs dynamically

There should be an easy way to tell Protractor to run all tests under the /specs directory.

Most helpful comment

Hi @finspin! Thanks for submitting an issue.

Have you tried specs: ['spec/**/*.js']. This is already implemented.

Closing this issue.

All 6 comments

Hi @finspin! Thanks for submitting an issue.

Have you tried specs: ['spec/**/*.js']. This is already implemented.

Closing this issue.

Hi @cnishina, this will not work with directory structure as follows:

  • spec/dir/test.js
  • spec/dir/dir/test.js

The ** search is not recursive.

@cnishina @juliemr could you elaborate if you plan to support the above directory structure?

** search is indeed recursive, we use glob for this. See their documentation at https://www.npmjs.com/package/glob

var spec_files = "src/app/**/*.specs.js";
exports.config = {
   specs: [spec_files],
};
var spec_files = "src/app/**/*.specs.js";
exports.config = {
   specs: [spec_files],
}

above statement doesn't work for me

Was this page helpful?
0 / 5 - 0 ratings