Comments (7)
@jwedel thanks for reporting this. And let me know if you are up for creating a PR fixing this.
from jest-codemods.
@skovhus I've created a PR with a failing test but I have no idea how to fix this. I've looked at the jasmine-globals.ts
but I can't figure out where to start...
from jest-codemods.
I figured out that it is possible to replace
focusMonitorMock.monitor.and.returnValue(of());
by
focusMonitorMock.monitor.mockReturnValue(of());
I've changed the test and finally figured out how to write transformation that makes the tests green.
However, I have to say that the implementation is very hard to read and understand, especially the reverse tree is messing with my mind. Moreover, IMO it's pretty bad that the actual test() call is wrapped in a reusable function. That makes debugging and running of individual tests pretty hard.
from jest-codemods.
IMO it's pretty bad that the actual test() call is wrapped in a reusable function. That makes debugging and running of individual tests pretty hard.
I see what you are saying. For running individual tests you can run yarn test:watch
(Jest in watch mode) and filter the tests by test name. Example:
yarn test:watch
- press
w
for menu - press
t
for test name filtering - type
maps expect within matchers
and enter
Or you can just watch failed tests or test that are modified.
from jest-codemods.
@skovhus Yes, that can be done. However, I am using my IDEs functionality (IntellIJ in this case) to run individual tests. But that only works if there are actual tests that can be discovered. Moreover, I don't see any need to handle it the way it is right now. I would suggest to do change the structure like that:
test('My name', () => {
assertTransformation('input', 'output')
})
function assertTransformation(source, expectedOutput) {
const result = wrappedPlugin(source)
expect(result).toBe(expectedOutput)
}
That still allows using jest functionalility plus using an IDE to run tests.
from jest-codemods.
I would suggest to do change the structure like that:
That is a great idea. Let me know if you are up for fixing it. :)
from jest-codemods.
I would suggest to do change the structure like that:
That is a great idea. Let me know if you are up for fixing it. :)
Done with #202 thanks to heavy use of multi-cursor actions :)
from jest-codemods.
Related Issues (20)
- 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
- Typescript: function (this) is incorrectly transformed HOT 1
- `jasmine-globals`: support for `jest.setSystemTime()`
- `jest-globals-import`: false negative when global is explicitly imported
- `jasmine-globals`: async `SpyStrategy` methods are not supported
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.