Skip to content

Commit

Permalink
allow package.json to configure command line flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Schmidt committed Jan 13, 2019
1 parent 4e39b0a commit 3fcd99c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions detox/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const yargs = require('yargs');
yargs
.scriptName('detox')
.env('DETOX')
.pkgConf('detox')
.commandDir('local-cli', {
exclude: function(path) {
// This is a test file
Expand Down
28 changes: 26 additions & 2 deletions docs/APIRef.DetoxCLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,34 @@ detox [options] [command]

## Configuration Options

Every flag can be passed in different ways, this section will show how `detox test --record-videos failing` can be expressed differently.

### Environment Varables

Every flag passed to a command can also be expressed by using environment variables.
For example, `detox test --configuration my.config` is the same as `DETOX_CONFIGURATION="my.config" detox test`.
`DETOX_RECORD_VIDEOS="failing" detox test`

### `package.json`

The flags need to be passed under the `detox` object in camel case.

```json
{
"detox": {
"recordVideos": "failing"
}
}
```

The options can be extended like this where `my-companies-detox-config` is a package exporting a configuration:

```json
{
"detox": {
"extends": "my-companies-detox-config"
}
}
```



## Commands
Expand Down

0 comments on commit 3fcd99c

Please # to comment.