4 ms·
I could imagine using the jest plugin, could be useful as a presumably faster alternative to babel-jest.
by fold_left 8y ago
I could imagine using the jest plugin, could be useful as a presumably faster alternative to babel-jest.
- alangpierce 8y agoThat's the hope! To be honest, I haven't worked with Jest a lot, and the plugin is sort of a first pass to get things working on the Apollo codebase (which uses Jest), so e.g. it may not be as smart as babel-jest for things like caching. Contributions welcome, though! My specific use case so far has been running Mocha tests on a large codebase, so it's replacing babel-register (which uses a cache) with sucrase/register (which doesn't). For that use case, it seems to significantly speed up test startup time with a cold cache and somewhat speed up startup time with a warm cache. Just loading and saving the babel-register cache takes a fair amount of time, at least in Babel 6. It's good to keep caching in mind when thinking about this stuff. In many cases, Sucrase won't be faster than loading results from cache. Sucrase helps with initial startup time and avoids the cache fragility issues that I've seen with lots of caching systems. And, of course, you could cache Sucrase results and get something at least as fast as cached Babel.