Upgrades Jest to v24#594
Conversation
Pull Request Test Coverage Report for Build 2056
💛 - Coveralls |
| "@babel/plugin-syntax-dynamic-import": "^7.0.0", | ||
| "@babel/plugin-syntax-import-meta": "^7.0.0", | ||
| "@babel/plugin-transform-flow-strip-types": "^7.0.0", | ||
| "@babel/plugin-transform-runtime": "^7.4.3", |
There was a problem hiding this comment.
Hmm! I am suspicious about this one! I've had issues with this in the past. Checking out the compiled files now.. 🤞
There was a problem hiding this comment.
@tinkertrain Ugh... yea. It's what I feared.
Check out the babel compiled code:
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
Prior to @babel/runtime, these functions were not dependencies.
With this set up.. that means that consuming integrations HAVE to also use @babel/runtime to compile things.
I remember running into these issues during the Brigade v1.x work.
Is there a way we can get Jest 24 set up, without @babel/runtime in .babelrc?
😊
There was a problem hiding this comment.
I was afraid of something like that!
I have pushed a solution... feels a little bit like cheating...
There was a problem hiding this comment.
It's not cheating if it works! Haha
|
Dang it Netlify! What's going on |
|
@tinkertrain Thanks for making that babel update! Will check again in a sec :) |
| 'emotion', | ||
| ], | ||
| } | ||
| module.exports = api => { |
There was a problem hiding this comment.
Much better 😎 . Take advantage of dat JS
|
Deploy preview for hsds-react ready! Built with commit 5829b79 |
ItsJonQ
left a comment
There was a problem hiding this comment.
🚀 Merged in latest master (the one with Storybook 5!). Resolved merge conflicts.
Tested Storybook dev + build. Tested Jest. Tested babel/TS build.
Things look like they're working as expected 😎
|
Oh darn. Netlify is struggling a bit again. Trying the build again (deleting cache + rebuild) |
|
Awesome! Thanks for the review all! And of course, big thanks to @tinkertrain 🚂 for making this upgrade 😍 |
Upgrades Jest to v24
Jest 24 is the latest version of the testing framework, we'd like to keep this dependency up-to-date.
More info here and changelog here
This version includes some support for typescript, but it is only traspilation through babel, so we will continue to use ts-jest, which gets upgraded in this PR too. Here's some context from that repo regarding Jest 24
Some minor changes to the jest config were necessary and for the most part things just worked.
I did find some issues with
async/awaittests, where I found a couple of problems, among them "regenerator runtime" not found. After searching for solutions I found a few issues that touched on this problem:And some others.
The solution I came up with that fixed the issue was to add the babel plugin:
@babel/plugin-transform-runtimebut only to the 'test' environment to avoid including the runtime on our builds.Other solutions that I read about was to update the babel configuration file, specifically the
preset-env.target.nodeoption to 'current', at the moment we have '8' and I assume we want to leave it like that, so I didn't try that (my node v is 8 anyways)More info on babel and the runtime:
Watcher:
npm run test: