Skip to content
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
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = class Config {
throw new Error('[spike constructor] option "root" is required')
}
// merges API options into app.js options
let allOpts = Object.assign(this.parseAppJs(opts), opts)
let allOpts = merge(this.parseAppJs(opts), opts)
this.transformSpikeOptionsToWebpack(this.validateOpts(allOpts))
this.project = project
}
Expand Down
7 changes: 7 additions & 0 deletions test/app_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ test('API config overrides app.js config', (t) => {
})
})

test('API config merges properly with app.js config', (t) => {
return compileFixture(t, 'app_config', { testing: { bar: 'double override' } }).then(({res}) => {
t.truthy(res.stats.compilation.options.testing.baz === 'override')
t.truthy(res.stats.compilation.options.testing.bar === 'double override')
})
})

test('throws error for invalid app.js syntax', (t) => {
return t.throws(() => compileFixture(t, 'app_config_error'), /Error: wow/)
})
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/app_config/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
testing: {
foo: 'override'
foo: 'override',
bar: 'override',
baz: 'override'
}
}