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

feat(*): add system/testFormats option to config #733

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets rename testFormats to fileExtensions

- .jsx
```

* `exclude` - array of glob patterns to exclude paths from the test search. For example:

```yaml
Expand Down Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions lib/config/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}),

Expand Down
5 changes: 4 additions & 1 deletion lib/test-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets pass all this options via single object:

.build({
    root: config.system.projectRoot,
    formats: config.system.fileExtensions,
    globOpts: {
        ignore: config.system.exclude
    }
})

.then((setCollection) => loadSuites(setCollection, emitter, config));
};