jscodeshift icon indicating copy to clipboard operation
jscodeshift copied to clipboard

ApplyTransform test util requires `input` to be manually wrapped in a file object

Open danieldelcore opened this issue 3 years ago • 0 comments

The docs currently say that applyTransform should be used like this:

const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
const transform = require('../myTransform');
const transformOptions = {};
const output = applyTransform(transform, transformOptions, 'input');

But the 'input' argument should really be an object in the shape:

applyTransform(transform, transformOptions, { source: 'input' });

for it to be compatible at runtime.

danieldelcore avatar Aug 19 '21 01:08 danieldelcore