Comments (9)
Thanks @spinningarrow ! Released as 0.13.4.
https://github.com/skovhus/jest-codemods/releases/tag/0.13.4
from jest-codemods.
Thanks for reporting this @spinningarrow .
First thing it to find the file that causes this and narrow down a minimal example of a source code that yields this error. And then either paste it here or make a PR where you add a test that documents this failure (the TDD way).
from jest-codemods.
@spinningarrow did you have time to come with source code that gave you this error? Would like to fix this. : )
from jest-codemods.
Hey, thanks for following up. The code I was trying it on isn't open source and I haven't found the time to come up with a minimal example yet. Will try to do it soon!
from jest-codemods.
@spinningarrow I'll keep this open a bit more... Would really love to get this fixed.
from jest-codemods.
Hi @skovhus, thanks for your patience. I managed to come up with a minimal example:
import test from 'ava';
const someFunction = _ => 1;
test('minimal test that throws a transformation error', t => {
const result = someFunction();
t.is(result);
});
The error is:
ERR test/utilities/MinimalTest.js Transformation error
Error: [] does not match field "arguments": [Expression | SpreadElement] of type CallExpression
at add (/Users/sahil/dev/something/static/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:580:31)
at /Users/sahil/dev/something/static/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:593:21
at Array.forEach (native)
at Function.value [as callExpression] (/Users/sahil/dev/something/static/node_modules/jscodeshift/node_modules/ast-types/lib/types.js:592:34)
at NodePath.ast.find.forEach.p (/Users/sahil/dev/something/static/node_modules/jest-codemods/dist/transformers/ava.js:114:34)
at __paths.forEach (/Users/sahil/dev/something/static/node_modules/jscodeshift/src/Collection.js:76:36)
at Array.forEach (native)
at Collection.forEach (/Users/sahil/dev/something/static/node_modules/jscodeshift/src/Collection.js:75:18)
at updateAssertions (/Users/sahil/dev/something/static/node_modules/jest-codemods/dist/transformers/ava.js:90:12)
at transforms.forEach.t (/Users/sahil/dev/something/static/node_modules/jest-codemods/dist/transformers/ava.js:171:29)
All done.
Looking at the Ava docs, it looks like the error is actually in the test itself - t.is
takes two arguments not one, so this isn't really a bug in jest-codemods. However, the error is pretty hard to debug - is it possible to get some kind of context or line numbering when something like this happens?
from jest-codemods.
Thanks for digging this up! I'll have a look.
from jest-codemods.
Very helpful issue. And thanks for the fix @skovhus.
Just wanted to add for anyone else coming across this that an empty t.snapshot()
will also cause the opaque transformation error listed above.
As noted, that error means there's something wrong with the ava test itself. In my case, t.snapshot()
needs to be passed an argument 🤦♂️ , but since ava doesn't care (it will just create a snapshot containing "undefined") it's quite possible to have these sorts of issues lurking in the codebase without knowing.
from jest-codemods.
Thanks for sharing. Another good reason for migrating to Jest.
from jest-codemods.
Related Issues (20)
- 'it' becoming 'test' HOT 7
- Support vows
- Missing transformation for Jasmine mock return values HOT 7
- Error: Cannot find module 'core-js/modules/es6.object.to-string.js' HOT 2
- jasmine-globals: Suggest relaxing matching for spyOn(..).and.xx(..) HOT 1
- Feature Suggestion: Command Line Options for Prompts HOT 1
- Chai: `not.to.include` erroneously transformed to `toEqual(expect.arrayContaining...)` HOT 2
- doesn't convert chai `to.be.equalTo` to jest `toEqual` HOT 3
- TypeError: babel.loadOptionsSync is not a function HOT 3
- Ava: test.failing should be changed to test.skip HOT 2
- Feature Suggestion: Migration from outdated versions of Jest HOT 4
- Dependency Dashboard
- Version 0.26.2 is unrunnable due to esm-only globby HOT 2
- Sinon transformer doesn't seem to recognize sinon usages HOT 2
- convert jasmine clock methods to jest
- Sinon transformer doesn't support cjs HOT 4
- Why test migration skipped?
- Feature request to migrate from intern
- Is Sinon actually incompatible with Jest?
- Does not support Typescript `satisfies` keyword HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-codemods.