ember-test-helpers-codemod
ember-test-helpers-codemod copied to clipboard
Identifier 'currentPath' has already been declared
trafficstars
I'm getting this in all files that import ember-native-dom-helpers, so it includes currentURL as well.
ERR tests/acceptance/login-test.js Transformation error (Transformation visit.js errored on file tests/acceptance/login-test.js. Reason SyntaxError: Identifier 'currentPath' has already been declared (2:9). Please report this in https://github.com/simonihmig/ember-test-helpers-codemod/issues
Stack trace:
SyntaxError: Identifier 'currentPath' has already been declared (2:9)
at Object.raise (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:3851:17)
at ScopeHandler.declareName (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:8819:12)
at Object.checkLVal (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:5537:22)
at Object.checkLVal (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:10750:15)
at Object.parseImportSpecifier (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:8711:10)
at Object.parseNamedImportSpecifiers (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:8696:12)
at Object.parseImport (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:8635:39)
at Object.parseImport (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:10345:18)
at Object.parseStatementContent (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:7391:27)
at Object.parseStatementContent (/Users/k3n/.npm/_npx/5423/lib/node_modules/ember-test-helpers-codemod/node_modules/@babel/parser/lib/index.js:10401:18)
Source:
import { currentPath } from '@ember/test-helpers';
import { currentPath, visit } from 'ember-native-dom-helpers';
...
After manually deleting my existing references (it also trips on visit), everything seems to have progressed as expected.
Which transform are you using? The native-dom one, that transforms references from ember-native-dom-helpers to @ember/test-helpers? Or one of the others?
Also could you post your test file, or at least an extract of it causing the same error to reproduce it?
I used the ember-test-helpers-codemod via ember-cli-update.
Source is like so:
import { currentPath, visit } from 'ember-native-dom-helpers';