Use with Jest
See original GitHub issueI followed the instructions for integrating with Jest. It works.
However I got a warning:
ts-jest[main] (WARN) Replace any occurrences of “ts-jest/dist/preprocessor.js” or “<rootDir>/node_modules/ts-jest/preprocessor.js” in the ‘transform’ section of your Jest config with just “ts-jest”.
So I did that, but it doesn’t work:
transform: {
"^.+\\.ts$": "ts-jest"
}
I also tried something I found at ts-jest, but it doesn’t work:
globals: {
"ts-jest": {
"compiler": "ttypescript"
}
}
The warning implies it’s possible - with some tweaking we could avoid the preprocessor and increase speed.
Has anyone got this to work?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (11 by maintainers)
Top Results From Across the Web
Getting Started - Jest
ts-jest is a TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript. npm;...
Read more >Jest Tutorial for Beginners: Getting Started With JavaScript ...
Jest is a JavaScript test runner, that is, a JavaScript library for creating, running, and structuring tests. Jest ships as an NPM package,...
Read more >Jest Tutorial - JavaScript Unit Testing Using Jest Framework
beforeEach and afterEach: These hooks are executed before and after each test in the test suite. · Add node package for jest-html-reporter using...
Read more >Testing TypeScript apps using Jest - LogRocket Blog
Jest is a simple, lightweight testing framework that provides a variety of testing capabilities to JavaScript and TypeScript projects. It ...
Read more >Jest Testing Tutorial: 5 Easy Steps - Testim Blog
Get Started With Jest: A Practical, Hands-On Tutorial in 5 Steps · 1. Install Jest Globally · 2. Create a Sample Project ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @dsherret I just upgraded to today’s
"ts-jest": "24.0.0"
.I was still getting those warnings, but since it’s a new version I wanted to see if the problem is still there. So in
jest.config
I replacedwith
And now the warnings go away, and the tests seem to work! So the issue is finally resolved. And no need for that preprocessor any more, so presumably the tests will be faster (though I haven’t felt a speed difference, but maybe that’s just me).
I can’t believe all the hoops I had to jump through to get this working properly, and yet, I’m HAPPY to have done so.
All for a single operator! Says a lot. So sorely missing from the language itself!
Kudos again for this library, what a difference it makes to my code!