Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
feat: remove backwards compatibility for passing grep to readTests
Browse files Browse the repository at this point in the history
  • Loading branch information
j0tunn committed Nov 3, 2017
1 parent df35579 commit ed4ece5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
10 changes: 6 additions & 4 deletions doc/programmatic-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ console.log(gemini.config.rootUrl);

## Reading the tests

`gemini.readTests(paths, grep)` — read all of the tests from specified paths into
`gemini.readTests(paths, options)` — read all of the tests from specified paths into
one suite collection.

* `paths` is an array of files or directories paths containing Gemini tests.
If not specified, will look for tests in `$projectRoot/gemini` directory.

* `grep` is a regular expression to filter suites to read. By default, all tests
will be read. If this option is set, only suites with name matching the
pattern will be read.
Options:

* `grep` — regular expression to filter suites to read. By default, all tests
will be added to collection. If this option is set, only suites with name matching the
pattern will be added to collection.

Returns promise which resolves to a `SuiteCollection` object.

Expand Down
12 changes: 1 addition & 11 deletions lib/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,7 @@ module.exports = class Gemini extends PassthroughEmitter {
return this._exec(() => this._run(StateProcessor.createTester(this.config), paths, options));
}

readTests(paths, options) {
if (_.isRegExp(options)) {
console.warn(chalk.yellow(
`Passing grep to readTests is deprecated. You should pass an object with options: {grep: ${options}}.`
));

options = {grep: options};
} else {
options = options || {};
}

readTests(paths, options = {}) {
return this._exec(() => this._readTests(paths, options));
}

Expand Down
7 changes: 0 additions & 7 deletions test/unit/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,6 @@ describe('gemini', () => {
assert.include(allSuites, matchingBranchLeaf);
});
});

it('should warn if RegExp was passed instead of object', () => {
return readTests_(null, new RegExp(/string/))
.then(() => assert.calledWith(console.warn, sinon.match(
'Passing grep to readTests is deprecated. You should pass an object with options: {grep: /string/}.'
)));
});
});

describe('test', () => {
Expand Down

0 comments on commit ed4ece5

Please sign in to comment.