From 267f4ece6fc901583c7b5b27e46dd93fcf356b5c Mon Sep 17 00:00:00 2001 From: Derek Wickern Date: Mon, 19 Jun 2017 09:21:29 -0700 Subject: [PATCH] Respect babel sourceMaps option --- index.js | 6 ++++-- node-tests/addon-test.js | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 293274cd..3aee031c 100644 --- a/index.js +++ b/index.js @@ -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; diff --git a/node-tests/addon-test.js b/node-tests/addon-test.js index 67325ae8..df077add 100644 --- a/node-tests/addon-test.js +++ b/node-tests/addon-test.js @@ -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 = {