Skip to content

Commit 3dc1e5a

Browse files
Lee EggebrotenJohn Doherty
authored andcommitted
Per issue #26, update config keys to match command line their "long name"
1 parent e0db2b7 commit 3dc1e5a

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

README.MD

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,30 @@ By default tests are run using Google Chrome, to run tests using another browser
6363

6464
### Default configuration file
6565
Many configuration options can be defaulted so they don't need to be overridden on the command line.
66+
The JSON keys are the "long name" from the command line options.
6667

67-
Create a "selenium-cucumber-js.json" file at the root of your project and add your configuration overrides.
68-
For example the following duplicates the current configuration defaults.
68+
A "selenium-cucumber-js.json" file at the root of your project allows you to specify a subset of configuration overrides.
69+
70+
For example the following duplicates default configuration.
6971

7072
```json
7173
{
72-
step_def_dir: './step-definitions',
73-
page_obj_dir: './page-objects',
74-
shared_obj_dir: './shared-objects',
75-
reports_dir: './reports',
76-
default_browser: 'chrome',
74+
steps: './step-definitions',
75+
pageObjects: './page-objects',
76+
sharedObjects: './shared-objects',
77+
reports: './reports',
78+
browser: 'chrome',
7779
timeout: 10000
7880
}
7981
```
8082
This would set configuration to match the expected directory structure of IntelliJ's Cucumber plugin, and make default timeout one minute.
83+
Note that the default browser has not been overridden and will remain 'chrome'.
8184
```json
8285
{
83-
step_def_dir: './features/step_definitions',
84-
page_obj_dir: './features/page_objects',
85-
shared_obj_dir: './features/shared_objects',
86-
reports_dir: './features/reports',
86+
steps: './features/step_definitions',
87+
pageObjects: './features/page_objects',
88+
sharedObjects: './features/shared_objects',
89+
reports: './features/reports',
8790
timeout: 60000
8891
}
8992
```

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function coerceInt(value, defaultValue) {
2323
}
2424

2525
var config = {
26-
step_def_dir: './step-definitions',
27-
page_obj_dir: './page-objects',
28-
shared_obj_dir: './shared-objects',
29-
reports_dir: './reports',
30-
default_browser: 'chrome',
26+
steps: './step-definitions',
27+
pageObjects: './page-objects',
28+
sharedObjects: './shared-objects',
29+
reports: './reports',
30+
browser: 'chrome',
3131
timeout: 10000
3232
};
3333

@@ -40,13 +40,13 @@ if (fs.isFileSync(configFileName)) {
4040
program
4141
.version(pjson.version)
4242
.description(pjson.description)
43-
.option('-s, --steps <path>', 'path to step definitions. defaults to ' + config.step_def_dir, config.step_def_dir)
44-
.option('-p, --pageObjects <path>', 'path to page objects. defaults to ' + config.page_obj_dir, config.page_obj_dir)
45-
.option('-o, --sharedObjects [paths]', 'path to shared objects (repeatable). defaults to ' + config.shared_obj_dir, collectPaths, [config.shared_obj_dir])
46-
.option('-b, --browser <path>', 'name of browser to use. defaults to ' + config.default_browser, config.default_browser)
47-
.option('-r, --reports <path>', 'output path to save reports. defaults to ' + config.reports_dir, config.reports_dir)
43+
.option('-s, --steps <path>', 'path to step definitions. defaults to ' + config.steps, config.steps)
44+
.option('-p, --pageObjects <path>', 'path to page objects. defaults to ' + config.pageObjects, config.pageObjects)
45+
.option('-o, --sharedObjects [paths]', 'path to shared objects (repeatable). defaults to ' + config.sharedObjects, collectPaths, [config.sharedObjects])
46+
.option('-b, --browser <path>', 'name of browser to use. defaults to ' + config.browser, config.browser)
47+
.option('-r, --reports <path>', 'output path to save reports. defaults to ' + config.reports, config.reports)
4848
.option('-d, --disableLaunchReport [optional]', 'Disables the auto opening the browser with test report')
49-
.option('-j, --junit <path>', 'output path to save junit-report.xml defaults to ' + config.reports_dir)
49+
.option('-j, --junit <path>', 'output path to save junit-report.xml defaults to ' + config.reports)
5050
.option('-t, --tags <tagName>', 'name of tag to run')
5151
.option('-f, --featureFile <path>', 'a specific feature file to run')
5252
.option('-x, --timeOut <n>', 'steps definition timeout in milliseconds. defaults to ' + config.timeout, coerceInt, config.timeout)

0 commit comments

Comments
 (0)