Skip to content

Commit

Permalink
WIP Fitbit#83
Browse files Browse the repository at this point in the history
  • Loading branch information
joelgallant committed Oct 3, 2018
1 parent 477cb18 commit feb99c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ class Config {
return ConfigCommandInvoker.invoke(commandNames.EXTEND, this, ...values);
}

extendOptional(...values) {
try {
return ConfigCommandInvoker.invoke(commandNames.EXTEND, this, ...values);
} catch (e) {}
}

/**
* @example
* import Config from 'webpack-config';
Expand Down
6 changes: 6 additions & 0 deletions test/ConfigExtendCommand.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,11 @@ describe('ConfigExtendCommand', () => {
bar: 'bar1'
});
});

it('should fail gracefully when file not found', () => {
config.extendOptional('invalid-config-file');

expect(config.toObject()).toEqual({});
});
});
});

0 comments on commit feb99c6

Please sign in to comment.