Skip to content

Commit

Permalink
Options and module options are combined
Browse files Browse the repository at this point in the history
  • Loading branch information
SAGITTA\belka committed Jul 13, 2020
1 parent e714efa commit 6a3dcb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ class Injection {
const container = new Container(options);

if (modules && util.isArray(modules)) {
let moduleSetupOptions = options.modulesOptions || { };
let moduleSetupOptions = Object.assign({}, options, options.modulesOptions || { });
delete options.modulesOptions;

for (let _module of modules) {
const moduleSetupFunction = _module.setup;
if (_module.options) {
Expand Down
2 changes: 1 addition & 1 deletion test/setup-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('Setup modules test', function() {
expect(container).to.have.own.property('_dependencies');
expect(options).to.be.an('object');
expect(options).to.include({ option2: 2 });
expect(options).to.not.include({ option1: 1 });
expect(options).to.include({ option1: 1 });
};
injection.setup(() => { }, { option1: 1, modulesOptions: { option2: 2 }, modules: [ ClassConstructor ] });
});
Expand Down

0 comments on commit 6a3dcb2

Please sign in to comment.