Skip to content

Commit

Permalink
Deprecate TransformTestSelectorParamsToHashPairs transform
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jul 1, 2021
1 parent af0e67e commit 13e2ac8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions transform-test-selector-params-to-hash-pairs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-env node */

let TEST_SELECTOR_PREFIX = /data-test-.*/;
let shownDeprecationWarning = false;

function isTestSelectorParam(param) {
return param.type === 'PathExpression'
Expand All @@ -22,6 +23,18 @@ module.exports = function(env) {
node.params.forEach(function(param) {
if (isTestSelectorParam(param)) {
testSelectorParams.push(param);
if (!shownDeprecationWarning) {
// eslint-disable-next-line no-console
console.warn(
'\n\n[ember-test-selectors] DEPRECATION: Using data-test ' +
'parameters without values in curly component invocations is ' +
'deprecated. You can use https://github.com/simplabs/ember-test-selectors-params-codemod ' +
'to migrate away from this pattern. See https://github.com/simplabs/ember-test-selectors/issues/151 ' +
'for more details.\n'
);

shownDeprecationWarning = true;
}
} else {
otherParams.push(param);
}
Expand Down

0 comments on commit 13e2ac8

Please sign in to comment.