Jest: Slim Dependencies

Created on 25 Jan 2017  路  12Comments  路  Source: facebook/jest

Also see https://github.com/facebookincubator/create-react-app/issues/1183

We should focus on reducing the amount of dependencies that are shipped with Jest. Is there somebody that could do an analysis?

Enhancement Help Wanted

Most helpful comment

I thought I was dreaming when I saw this issue.

  • [x] [node-notifier](https://github.com/mikaelbr/node-notifier) dropping the CLI will help. It used a very uncommon CLI library. #2718 resolved this.
  • [ ] [istanbul-reports](https://github.com/istanbuljs/istanbul-reports) moving from handlebars to something else would help. handlebars requires uglifyjs for its CLI, and the handlebars team is not interested in moving the CLI to another package. An issue has been raised, but there has been no response.
  • [ ] [escodgen](https://github.com/estools/escodegen) moving the CLI to another package would remove optionator and its dependencies from the dependency graph. An issue has been raised, but there has been no response.
  • [ ] [jsdom](https://github.com/tmpvar/jsdom) replacing request with something like got would remove request from the dependency tree. It also might speed it up a bit, too. They might look to do it if they can get better coverage, first.
  • [x] istanbul-reports packages a .nyc_output folder of ~310 KB. A PR has been filed.
  • [ ] If an issue with vm-browserify can be resolved (or, better yet, a new version written), jsdom won't need to use escodgen or acorn-globals, so acorn stuff can be removed from the dependency tree.

All 12 comments

I thought I was dreaming when I saw this issue.

  • [x] [node-notifier](https://github.com/mikaelbr/node-notifier) dropping the CLI will help. It used a very uncommon CLI library. #2718 resolved this.
  • [ ] [istanbul-reports](https://github.com/istanbuljs/istanbul-reports) moving from handlebars to something else would help. handlebars requires uglifyjs for its CLI, and the handlebars team is not interested in moving the CLI to another package. An issue has been raised, but there has been no response.
  • [ ] [escodgen](https://github.com/estools/escodegen) moving the CLI to another package would remove optionator and its dependencies from the dependency graph. An issue has been raised, but there has been no response.
  • [ ] [jsdom](https://github.com/tmpvar/jsdom) replacing request with something like got would remove request from the dependency tree. It also might speed it up a bit, too. They might look to do it if they can get better coverage, first.
  • [x] istanbul-reports packages a .nyc_output folder of ~310 KB. A PR has been filed.
  • [ ] If an issue with vm-browserify can be resolved (or, better yet, a new version written), jsdom won't need to use escodgen or acorn-globals, so acorn stuff can be removed from the dependency tree.

ah, it sucks that all of these are transitive dependencies and that we don't really have much control over it.

Can I just say that @wtgtybhertgeghgtwtg's analysis is incredibly thorough. Thank you for doing that

giphy

Yep, this is really great work - thanks @wtgtybhertgeghgtwtg

note-notifier dropped the cli: https://github.com/facebook/jest/pull/2718

Nice!

Just an overview of the impact this has had.
[email protected] is about seven dependencies and one megabyte lighter than [email protected]. Here's a comparison of the node_modules of a fresh install of the two (Windows 10, [email protected])
jest 18 1 0 vs jest 19 0 0

Nice work, thanks @wtgtybhertgeghgtwtg for working on this and getting back with more data :)

It was lighter until request v2.80.0 went ahead and destroyed all the gains:

http://pkgsize.com/jest.html (select an area to zoom in and hover to see the event that caused the change)

which is largely:

http://pkgsize.com/jest-cli.html

The big ones there are:

+1

I think we are mostly good on this for now and we sped Jest's startup up by more than 50% with Jest 21. If anybody wants to drop more stuff, please feel free to comment here and send PRs!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paularmstrong picture paularmstrong  路  66Comments

benmonro picture benmonro  路  119Comments

sterpe picture sterpe  路  70Comments

bookman25 picture bookman25  路  79Comments

simon360 picture simon360  路  78Comments