jscodeshift
jscodeshift copied to clipboard
defineTest can not resolve async transform
If the transform is async, defineTest run error, because the defineTest only support sync, output is promise
Would you be able to up to github a temporary repository that reproduces the error?
git clone jscodeshift
// sample/reverse-identifiers.js
function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.Identifier)
.replaceWith(
p => j.identifier(p.node.name.split('').reverse().join(''))
)
.toSource();
}
// replace with async
function transformer(file, api) {
const j = api.jscodeshift;
const source = j(file.source)
.find(j.Identifier)
.replaceWith(
p => j.identifier(p.node.name.split('').reverse().join(''))
)
.toSource();
return Promise.resolve(source);
}
run yarn test

Hitting up against this myself. It looks like the PR was closed out without a resolution?