Skip to content

Commit

Permalink
Respect babel sourceMaps option
Browse files Browse the repository at this point in the history
  • Loading branch information
dwickern committed Jun 19, 2017
1 parent 90cde9e commit 267f4ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ module.exports = {
let addonProvidedConfig = this._getAddonProvidedConfig(config);
let shouldCompileModules = this._shouldCompileModules(config);

let providedAnnotation = config['ember-cli-babel'] && config['ember-cli-babel'].annotation;
let addonOptions = config['ember-cli-babel'] || {};
let babelOptions = config.babel || {};

let options = {
annotation: providedAnnotation || `Babel: ${this._parentName()}`
annotation: addonOptions.annotation || `Babel: ${this._parentName()}`,
sourceMaps: addonOptions.sourceMaps || babelOptions.sourceMaps
};

let userPlugins = addonProvidedConfig.plugins;
Expand Down
22 changes: 22 additions & 0 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,28 @@ describe('ember-cli-babel', function() {
expect(result.annotation).to.equal('Hello World!');
});

it('uses provided sourceMaps if specified using options.babel', function() {
let options = {
babel: {
sourceMaps: 'inline'
}
};

let result = this.addon.buildBabelOptions(options);
expect(result.sourceMaps).to.equal('inline');
});

it('uses provided sourceMaps if specified using options.ember-cli-babel', function() {
let options = {
'ember-cli-babel': {
sourceMaps: 'inline'
}
};

let result = this.addon.buildBabelOptions(options);
expect(result.sourceMaps).to.equal('inline');
});

it('does not include all provided options', function() {
let babelOptions = { blah: true };
let options = {
Expand Down

0 comments on commit 267f4ec

Please sign in to comment.