Skip to content

Commit

Permalink
Remove deprecations and deprecated options.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed May 3, 2017
1 parent b98c7ee commit add6a39
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 138 deletions.
26 changes: 1 addition & 25 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ module.exports = {
this._super.init && this._super.init.apply(this, arguments);

let checker = new VersionChecker(this);
let dep = this.emberCLIChecker = checker.for('ember-cli', 'npm');

this._shouldShowBabelDeprecations = !dep.lt('2.11.0-beta.2');
this.emberCLIChecker = checker.for('ember-cli', 'npm');
},

buildBabelOptions(_config) {
Expand All @@ -48,23 +46,10 @@ module.exports = {

_shouldIncludePolyfill: function() {
let addonOptions = this._getAddonOptions();
let babelOptions = addonOptions.babel;
let customOptions = addonOptions['ember-cli-babel'];

if (this._shouldShowBabelDeprecations && !this._polyfillDeprecationPrinted &&
babelOptions && 'includePolyfill' in babelOptions) {

this._polyfillDeprecationPrinted = true;

// we can use writeDeprecateLine() here because the warning will only be shown on newer Ember CLIs
this.ui.writeDeprecateLine(
'Putting the "includePolyfill" option in "babel" is deprecated, please put it in "ember-cli-babel" instead.');
}

if (customOptions && 'includePolyfill' in customOptions) {
return customOptions.includePolyfill === true;
} else if (babelOptions && 'includePolyfill' in babelOptions) {
return babelOptions.includePolyfill === true;
} else {
return false;
}
Expand Down Expand Up @@ -275,18 +260,9 @@ module.exports = {
// will use any provided configuration
_shouldCompileModules(options) {
let addonOptions = options['ember-cli-babel'];
let babelOptions = options.babel;

if (addonOptions && 'compileModules' in addonOptions) {
return addonOptions.compileModules;
} else if (babelOptions && 'compileModules' in babelOptions) {
if (this._shouldShowBabelDeprecations && !this._compileModulesDeprecationPrinted) {
this._compileModulesDeprecationPrinted = true;
// we can use writeDeprecateLine() here because the warning will only be shown on newer Ember CLIs
this.ui.writeDeprecateLine('Putting the "compileModules" option in "babel" is deprecated, please put it in "ember-cli-babel" instead.');
}

return babelOptions.compileModules;
} else {
return this.emberCLIChecker.gt('2.12.0-alpha.1');
}
Expand Down
113 changes: 0 additions & 113 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,50 +237,6 @@ describe('ember-cli-babel', function() {
});
});

describe('with babel.includePolyfill = true', function() {
beforeEach(function() {
this.addon.parent.options = { babel: { includePolyfill: true } };
});

it('should return true', function() {
expect(this.addon._shouldIncludePolyfill()).to.be.true;
});

it('should print deprecation message exactly once', function() {
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();

let deprecationMessages = this.ui.output.split('\n').filter(function(line) {
return line.indexOf('Putting the "includePolyfill" option in "babel" is deprecated') !== -1;
});

expect(deprecationMessages).to.have.lengthOf(1);
});
});

describe('with babel.includePolyfill = false', function() {
beforeEach(function() {
this.addon.parent.options = { babel: { includePolyfill: false } };
});

it('should return false', function() {
expect(this.addon._shouldIncludePolyfill()).to.be.false;
});

it('should print deprecation message exactly once', function() {
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();

let deprecationMessages = this.ui.output.split('\n').filter(function(line) {
return line.indexOf('Putting the "includePolyfill" option in "babel" is deprecated') !== -1;
});

expect(deprecationMessages).to.have.lengthOf(1);
});
});

describe('with ember-cli-babel.includePolyfill = true', function() {
beforeEach(function() {
this.addon.parent.options = { 'ember-cli-babel': { includePolyfill: true } };
Expand Down Expand Up @@ -320,31 +276,6 @@ describe('ember-cli-babel', function() {
expect(deprecationMessages).to.have.lengthOf(0);
});
});

describe('with ember-cli-babel.includePolyfill = true and babel.includePolyfill = false', function() {
beforeEach(function() {
this.addon.parent.options = {
'babel': { includePolyfill: false },
'ember-cli-babel': { includePolyfill: true },
};
});

it('should prefer the "ember-cli-babel" setting', function() {
expect(this.addon._shouldIncludePolyfill()).to.be.true;
});

it('should print deprecation message exactly once', function() {
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();
this.addon._shouldIncludePolyfill();

let deprecationMessages = this.ui.output.split('\n').filter(function(line) {
return line.indexOf('Putting the "includePolyfill" option in "babel" is deprecated') !== -1;
});

expect(deprecationMessages).to.have.lengthOf(1);
});
});
});

describe('_shouldCompileModules()', function() {
Expand Down Expand Up @@ -378,50 +309,6 @@ describe('ember-cli-babel', function() {
});
});

describe('with babel.compileModules = true', function() {
beforeEach(function() {
this.addon.parent.options.babel = { compileModules: true };
});

it('should return true', function() {
expect(this.addon.shouldCompileModules()).to.eql(true);
});

it('should print deprecation message exactly once', function() {
this.addon.shouldCompileModules();
this.addon.shouldCompileModules();
this.addon.shouldCompileModules();

let deprecationMessages = this.ui.output.split('\n').filter(function(line) {
return line.indexOf('Putting the "compileModules" option in "babel" is deprecated') !== -1;
});

expect(deprecationMessages).to.have.lengthOf(1);
});
});

describe('with babel.compileModules = false', function() {
beforeEach(function() {
this.addon.parent.options.babel = { compileModules: false };
});

it('should return false', function() {
expect(this.addon.shouldCompileModules()).to.eql(false);
});

it('should print deprecation message exactly once', function() {
this.addon.shouldCompileModules();
this.addon.shouldCompileModules();
this.addon.shouldCompileModules();

let deprecationMessages = this.ui.output.split('\n').filter(function(line) {
return line.indexOf('Putting the "compileModules" option in "babel" is deprecated') !== -1;
});

expect(deprecationMessages).to.have.lengthOf(1);
});
});

describe('with ember-cli-babel.compileModules = true', function() {
it('should return true', function() {
expect(this.addon._shouldCompileModules({
Expand Down

0 comments on commit add6a39

Please sign in to comment.