From 26cf6a1e43357f98d20f68855f237fd44ba5d35d Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 2 Jul 2021 13:03:41 +0200 Subject: [PATCH] Remove support for ember-cli-babel v5 --- index.js | 9 +----- node-tests/fixtures/default/expected.js | 21 -------------- node-tests/multidep.json | 2 +- .../strip-data-test-properties-plugin-test.js | 14 --------- strip-data-test-properties-plugin.js | 29 ------------------- 5 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 node-tests/fixtures/default/expected.js delete mode 100644 strip-data-test-properties-plugin.js diff --git a/index.js b/index.js index dbc3739a..af710107 100644 --- a/index.js +++ b/index.js @@ -59,14 +59,7 @@ module.exports = { appOrParent.options = appOrParent.options || {}; - if (checker.satisfies('^5.0.0')) { - appOrParent.options.babel = appOrParent.options.babel || {}; - appOrParent.options.babel.plugins = appOrParent.options.babel.plugins || []; - appOrParent.options.babel.plugins.push(require('./strip-data-test-properties-plugin')); - - this.ui.writeWarnLine('[ember-test-selectors] DEPRECATION: Using ember-cli-babel v5 with ember-test-selectors ' + - 'is deprecated. Please make sure to update your ember-cli-babel version.'); - } else if (checker.satisfies('^6.0.0-beta.1') || checker.satisfies('^7.0.0')) { + if (checker.satisfies('^6.0.0-beta.1') || checker.satisfies('^7.0.0')) { appOrParent.options.babel6 = appOrParent.options.babel6 || {}; appOrParent.options.babel6.plugins = appOrParent.options.babel6.plugins || []; appOrParent.options.babel6.plugins.push(require.resolve('./strip-data-test-properties-plugin6')); diff --git a/node-tests/fixtures/default/expected.js b/node-tests/fixtures/default/expected.js deleted file mode 100644 index 22c1e490..00000000 --- a/node-tests/fixtures/default/expected.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _ember = require('ember'); - -var _ember2 = _interopRequireDefault(_ember); - -exports['default'] = _ember2['default'].Component.extend({ - foo: 'foo', - 'data-test': 'test', - 'metadata-test-foo': 'metadata' -}); -var c2 = _ember2['default'].Component.extend({ - foo: 'foo' -}); -exports.c2 = c2; diff --git a/node-tests/multidep.json b/node-tests/multidep.json index 819af88d..8c371447 100644 --- a/node-tests/multidep.json +++ b/node-tests/multidep.json @@ -1,6 +1,6 @@ { "path": "node-tests/multidep_modules", "versions": { - "babel-core": ["5.8.33", "6.24.0"] + "babel-core": ["6.24.0"] } } diff --git a/node-tests/strip-data-test-properties-plugin-test.js b/node-tests/strip-data-test-properties-plugin-test.js index 26cb2403..21a3a293 100644 --- a/node-tests/strip-data-test-properties-plugin-test.js +++ b/node-tests/strip-data-test-properties-plugin-test.js @@ -2,26 +2,12 @@ let fs = require('fs'); let assert = require('assert'); let multidepRequire = require('multidep')('node-tests/multidep.json'); -let babel5 = multidepRequire('babel-core', '5.8.33'); let babel6 = multidepRequire('babel-core', '6.24.0'); let babel7 = require('@babel/core'); -let StripDataTestPropertiesPlugin5 = require('../strip-data-test-properties-plugin'); let StripDataTestPropertiesPlugin6 = require('../strip-data-test-properties-plugin6'); function testFixture(name) { - it(`Babel5: fixture: ${name}`, function() { - let fixturePath = `${__dirname}/fixtures/${name}/fixture.js`; - let expectedPath = `${__dirname}/fixtures/${name}/expected.js`; - - let expected = fs.readFileSync(expectedPath, 'utf8').replace(/\r\n/g, '\n'); - let result = babel5.transformFileSync(fixturePath, { - plugins: [StripDataTestPropertiesPlugin5], - }); - - assert.strictEqual(result.code.trim(), expected.trim()); - }); - it(`Babel6: fixture: ${name}`, function() { let fixturePath = `${__dirname}/fixtures/${name}/fixture.js`; let expectedPath = `${__dirname}/fixtures/${name}/expected6.js`; diff --git a/strip-data-test-properties-plugin.js b/strip-data-test-properties-plugin.js deleted file mode 100644 index 1841b57c..00000000 --- a/strip-data-test-properties-plugin.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -/* eslint-env node */ - -let TEST_SELECTOR_PREFIX = /^data-test-.*/; -let SUPPORTS_DATA_TEST_PROP = 'supportsDataTestProperties'; - -function StripDataTestPropertiesPlugin(babel) { - return new babel.Plugin('ember-test-selectors', { - visitor: { - Property(node) { - let nodeName = node.key.name || node.key.value; - if (TEST_SELECTOR_PREFIX.test(nodeName) || nodeName === SUPPORTS_DATA_TEST_PROP) { - this.dangerouslyRemove(); - } - }, - }, - }); -} - -StripDataTestPropertiesPlugin.baseDir = function() { - return __dirname; -}; - -StripDataTestPropertiesPlugin.cacheKey = function() { - return 'ember-test-selectors.strip-data-test-properties'; -}; - -module.exports = StripDataTestPropertiesPlugin;