Testing: Add integration test which ensures that npm packages can be used with Node
#17.273 aberto em 30 de ago. de 2019
Métricas do repositório
- Stars
- (9.607 stars)
- Métricas de merge de PR
- (Mesclagem média 12d 18h) (509 fundiu PRs em 30d)
Description
This should prevent bugs like #17165 where a naked reference to window will crash if used in a SSR context where there's no window.
See more details in the comment from @jsnajdr https://github.com/WordPress/gutenberg/pull/17165#issuecomment-525193133:
In this case, the easiest TDD-style test would be to simply import
@wordpress/composein a Node.js environment without DOM. And it would fail.Neither
composenorcomponentspackages use thesideEffects: falseflag (although they would be a good fit IMO), so using anything fromcomposebundles the whole library.And the
windowcheck is a top-level statement in the module. We don't need to use or instantiate theuseReducedMotionhook at all to get a broken build.