avajs / ava-codemods

Codemods for AVA
https://ava.li
MIT License
68 stars 16 forks source link

tape-to-ava - SyntaxError: Unexpected token export #34

Closed esganzerla closed 7 years ago

esganzerla commented 7 years ago

I just tried using tape-to-ava and got this error on terminal.

➜  serializeJSON tape-to-ava serializeJSON.test.js -f
fatal: Not a git repository (or any of the parent directories): .git
WARNING: Unable to determine if git directory is clean. Forcibly continuing. Ensure you have a backup of your tests or commit the latest changes before continuing.
Executing command: jscodeshift -t /usr/local/lib/node_modules/ava-codemods/lib/tape.js serializeJSON.test.js
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
/usr/local/lib/node_modules/ava-codemods/lib/tape.js:115
export default function tapeToAva(fileInfo, api) {
^^^^^^
SyntaxError: Unexpected token export
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/ava-codemods/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at setup (/usr/local/lib/node_modules/ava-codemods/node_modules/jscodeshift/dist/Worker.js:67:18)
All done.
Results:
0 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 2.567seconds

I'm running on node 7.2.1.

novemberborn commented 7 years ago

We're distributing the lib/tape.js transformer module as ES2015, which is surprising to me.

I suspect jscodeshift used to transpile that module, which has now stopped working. https://github.com/facebook/jscodeshift/releases/tag/v0.3.21 seems of interest.

dawsbot commented 7 years ago

@novemberborn any progress on this? If tape-to-ava does not work on any node version it seems like it should be deprecated/removed entirely from ava-codemods.

UPDATE: PR'd a fix #35