ember-codemods/ember-test-helpers-codemod

Failure when encountering `return andThen(() => { ... })`

jgwhite opened this issue · 0 comments

What I did

$ npx ember-test-helpers-codemod --type=acceptance example-test.js

Where example-test.js contains:

describe('Example', function() {
  it('passes', function() {
    visit('/foo');
    return andThen(() => {
    });
  });
});

What I expected to happen

0 errors
0 unmodified
0 skipped
1 ok

What actually happened

npx: installed 291 in 6.809s
Processing 1 files... 
Spawning 1 workers...
Sending 1 files to free worker...
ERR /Users/jameswhite/Desktop/example-test.js Transformation error
Error: Transformation visit.js errored on file /Users/jameswhite/Desktop/example-test.js. Reason TypeError: Cannot read property 'arguments' of undefined. Please report this in https://github.com/simonihmig/ember-test-helpers-codemod/issues

Stack trace:
TypeError: Cannot read property 'arguments' of undefined
    at NodePath.root.find.map.replaceWith (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/utils.js:478:34)
    at NodePath.<anonymous> (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/src/collections/Node.js:144:47)
    at __paths.forEach (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/src/Collection.js:76:36)
    at Array.forEach (<anonymous>)
    at Collection.forEach (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/src/Collection.js:75:18)
    at Collection.replaceWith (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/src/collections/Node.js:142:17)
    at Collection.typedMethod (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/node_modules/jscodeshift/src/Collection.js:376:43)
    at dropAndThen (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/utils.js:477:6)
    at transform (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/transforms/acceptance/visit.js:38:5)
    at fs.readdirSync.forEach.fileName (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/presets/-preset.js:21:17)

Source:
describe('Example', function() {
  it('passes', function() {
    visit('/foo');
    return andThen(() => {
    });
  });
});

    at fs.readdirSync.forEach.fileName (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/presets/-preset.js:23:19)
    at Array.forEach (<anonymous>)
    at /Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/lib/presets/-preset.js:15:8
    at module.exports (/Users/jameswhite/.npm/_npx/11700/lib/node_modules/ember-test-helpers-codemod/index.js:15:14)
All done. 
Results: 
1 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 0.649seconds