Upgrade Jest and Babel dependencies #227
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Motivation
Now that
jscodeshiftsupports TypeScript (added inv0.6.0) I was exploring upgradingjscodeshiftto take advantage of that added support. I was able to get a proof of concept working and planning to open that in a separate PR. However, there were some conflicts between the currentbabelpackages and setup when upgradingjscodeshiftand a few cleanup items I was hoping to merge in this PR before opening a PR to propose upgradingjscodeshiftand adding TypeScript support (#206).Changes
Upgrade Dependencies
jest: Jest is many major versions behind in this project. Also to take advantage ofspyOnit was necessary to upgrade (see below for use case ofspyOn).package.jsonto changetestPathDirstoroots(Jest CHANGELOG v19.0.0)babel: as recommended in the Jest Getting Started for Using Babel documentation add (or upgrade) the following babel packages:babel-jest(upgraded)@babel/core(peer dependency)@babel/preset-env(this replacesbabel-preset-es2015as documented here)@babel/plugin-proposal-object-rest-spread(this replacesbabel-plugin-transform-object-rest-spread)Update
prepublishscriptPreviously, it was using
npmto runlintandtest. Given the project is usingyarn.lockit seems fair to assume development should be done usingyarn? If so, it seems preferable to not mixyarnandnpmusage (happy to revert this change if there's opposition as it's not necessary for the purposes of this PR)Silencing verbose logging during testing
Some of the transforms have custom
console.logorconsole.warncalls to provide information while using the transforms. While running tests (yarn test) these get verbose and make it difficult to see the whole test suite (happy to revert this change if there's opposition as it's not necessary for the purposes of this PR).[Before] Example of running `yarn test`
[After] Example of running `yarn test`
Update node version in CI
Previously, the node version was set to
4for CI. This caused CI to fail (see this build) with the error:There is an open issue (yarnpkg/yarn#6900) for this when using
nodev4with newer versions ofyarn. I updated it to version10for CI which resolved this error. I based this decision on the Node Releases and that10is currently "Active LTS".Testing these changes
yarnto install the new packagesprepublishscript is now ran withyarn(rather thannpm)yarn test