meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Bundle size check package #394

Open jamesmillerburgess opened 4 years ago

jamesmillerburgess commented 4 years ago

This is a feature proposal for a new non-core Meteor package to check bundle sizes, and there is already a head-start on it from a file we have in our primary Meteor project: https://gist.github.com/jamesmillerburgess/a16a0c3b789ceba50cbf30a905f49e30

We run it with an npm script in CircleCI to check that the modern and legacy browser bundles don't go over a certain gzipped size. We've been using it now for about a year.

I've always thought that with a few tweaks, this would make for a convenient Meteor package. And since we are now migrating our project away from Meteor, I wanted to share this code before it gets deleted forever!

jamesmillerburgess commented 4 years ago

And here is a gist for the jest test file we have: https://gist.github.com/jamesmillerburgess/4dd6372346677785d60de2a0bdf51983

We enforce 100% code coverage on unit tests, which is why there are quite a few tests inside.

This is paired with a very simple mock of WebAppInternals, since jest can't read Meteor packages:

export const WebAppInternals = {};