From 6d52238747f4b808aa28e96a4e6e207deb503c68 Mon Sep 17 00:00:00 2001 From: Mitya Teryaew Date: Sun, 12 Feb 2017 21:13:47 +0300 Subject: [PATCH] feat(*): add system/testFormats option to config --- doc/config.md | 9 ++++++++- lib/config/options.js | 14 ++++++++++++++ lib/test-reader.js | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/config.md b/doc/config.md index 94f296249..a0e4f174c 100644 --- a/doc/config.md +++ b/doc/config.md @@ -87,6 +87,13 @@ settings. These settings can not be set per-browser. After run created directory will be removed. If not set system temp directory will be used. +* `testFormats` - array of filename extensions for tests to proceed. `.js` is available by default, override this if you want: + +```yaml +testFormats: + - .jsx +``` + * `exclude` - array of glob patterns to exclude paths from the test search. For example: ```yaml @@ -147,7 +154,7 @@ exclude: - `html` - set to false to disable html report and save only JSON. -* `ctx` – a context which will be available in tests via method `gemini.ctx`. +* `ctx` – a context which will be available in tests via method `gemini.ctx`. ## Browsers settings diff --git a/lib/config/options.js b/lib/config/options.js index 889062f7d..08bd2d8ba 100644 --- a/lib/config/options.js +++ b/lib/config/options.js @@ -98,6 +98,20 @@ module.exports = root( map: (value) => [].concat(value) }), + testFormats: option({ + defaultValue: ['.js'], + validate: (value) => { + if (_.isString(value)) { + return; + } + + if (!_.every(value, _.isString)) { + throw new GeminiError('"testFormats" must be an array of strings'); + } + }, + map: (value) => [].concat(value) + }), + ctx: anyObject() }), diff --git a/lib/test-reader.js b/lib/test-reader.js index 8e8a933a5..93f6f0002 100644 --- a/lib/test-reader.js +++ b/lib/test-reader.js @@ -31,6 +31,9 @@ module.exports = (emitter, config, opts) => { .useSets(opts.sets) .useFiles(opts.paths) .useBrowsers(opts.browsers) - .build(config.system.projectRoot, {ignore: config.system.exclude}) + .build({ + root: config.system.projectRoot, + formats: config.system.testFormats + }, {ignore: config.system.exclude}) .then((setCollection) => loadSuites(setCollection, emitter, config)); };