ember-codemods / ember-qunit-codemod

MIT License
36 stars 20 forks source link

ember-cli-update 0.43.3 ember-qunit-codemod failing on tests/index.html #200

Open lfrost opened 4 years ago

lfrost commented 4 years ago

I am trying to use ember-cli-update 0.43.3 to update an Ember 3.12.0 application to 3.13.0. I am first trying to run all codemods against 3.12.0. When running ember-qunit-codemod, I get the following error on tests/index.html.

$ ember -v
ember-cli: 3.12.0
node: 10.16.3
os: linux x64
$ ember-cli-update --version
0.43.3
$ ember-cli-update --run-codemods
? These codemods apply to your project. Select which ones to run. ember-modules-codemod, ember-qunit-codemod, ember-test-helpers-c
odemod, es5-getter-ember-codemod, qunit-dom-codemod
...
Running codemod ember-qunit-codemod
Running command 1 of 1
npx: installed 360 in 21.594s
Processing 50 files...
Spawning 7 workers...
Sending 8 files to free worker...
Sending 8 files to free worker...
Sending 8 files to free worker...
Sending 8 files to free worker...
Sending 8 files to free worker...
Sending 8 files to free worker...
Sending 2 files to free worker...
 ERR tests/index.html Transformation error (Unexpected token (1:1))
SyntaxError: Unexpected token (1:1)
    at Object.raise (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:6400:17)
    at Object.unexpected (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:7728:16)
    at Object.tsParseNonArrayType (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4502:16)
    at Object.tsParseArrayTypeOrHigher (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4506:21)
    at Object.tsParseTypeOperatorOrHigher (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4561:120)
    at Object.tsParseUnionOrIntersectionType (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4566:16)
    at Object.tsParseIntersectionTypeOrHigher (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4584:17)
    at Object.tsParseUnionOrIntersectionType (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4566:16)
    at Object.tsParseUnionTypeOrHigher (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4588:17)
    at Object.tsParseNonConditionalType (~/.npm/_npx/6657/lib/node_modules/ember-qunit-codemod/node_modules/@babel/parser/lib/index.js:4741:17)
All done.
Results:
1 errors
49 unmodified
0 skipped
0 ok
Time elapsed: 9.958seconds
Finished running command 1 of 1
Finished running codemod ember-qunit-codemod
...

test/index.html was generated by ember-cli 3.12.0 and has not been modified.

$ head -n2 tests/index.html
<!DOCTYPE html>
<html>

A complete log with DEBUG set is attached. ember-cli-update-debug.log

rwjblue commented 4 years ago

The rough steps to fix this are to update codemod-cli to the latest version. https://github.com/rwjblue/codemod-cli/pull/62 introduced the ability to run the codemod on only the specific extensions that are known (defaulting to js,ts). That should avoid the issue for us here...