Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #899 stringify reporterOptions like env and config #900

Merged
merged 1 commit into from
Nov 9, 2017
Merged
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
18 changes: 11 additions & 7 deletions cli/__snapshots__/util_spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
exports['util normalizeModuleOptions passes string env unchanged 1'] = {
exports['env_as_string 1'] = {
"env": "foo=bar"
}

exports['util normalizeModuleOptions does not change other properties 1'] = {
"foo": "bar"
}

exports['util normalizeModuleOptions converts environment object 1'] = {
exports['env_as_object 1'] = {
"env": "foo=bar,magicNumber=1234,host=kevin.dev.local"
}

exports['util normalizeModuleOptions converts config object 1'] = {
exports['config_as_object 1'] = {
"config": "baseUrl=http://localhost:2000,watchForFileChanges=false"
}

exports['reporter_options_as_object 1'] = {
"reporterOptions": "mochaFile=results/my-test-output.xml,toConsole=true"
}

exports['others_unchanged 1'] = {
"foo": "bar"
}
1 change: 1 addition & 0 deletions cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function normalizeModuleOptions (options = {}) {
return R.evolve({
env: normalizeObject,
config: normalizeObject,
reporterOptions: normalizeObject,
})(options)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"nock": "^9.0.9",
"shelljs": "0.7.8",
"sinon": "3.2.1",
"snap-shot-it": "4.0.0",
"snap-shot-it": "4.0.1",
"strip-ansi": "4.0.0"
},
"files": [
Expand Down
18 changes: 14 additions & 4 deletions cli/test/lib/util_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ describe('util', function () {
const options = {
foo: 'bar',
}
snapshot(normalizeModuleOptions(options))
snapshot('others_unchanged', normalizeModuleOptions(options))
})

it('passes string env unchanged', () => {
const options = {
env: 'foo=bar',
}
snapshot(normalizeModuleOptions(options))
snapshot('env_as_string', normalizeModuleOptions(options))
})

it('converts environment object', () => {
Expand All @@ -66,7 +66,7 @@ describe('util', function () {
host: 'kevin.dev.local',
},
}
snapshot(normalizeModuleOptions(options))
snapshot('env_as_object', normalizeModuleOptions(options))
})

it('converts config object', () => {
Expand All @@ -76,7 +76,17 @@ describe('util', function () {
watchForFileChanges: false,
},
}
snapshot(normalizeModuleOptions(options))
snapshot('config_as_object', normalizeModuleOptions(options))
})

it('converts reporterOptions object', () => {
const options = {
reporterOptions: {
mochaFile: 'results/my-test-output.xml',
toConsole: true,
},
}
snapshot('reporter_options_as_object', normalizeModuleOptions(options))
})
})

Expand Down