It would be nice to allow Jest config presets to offer this feature without users actually needing Next.js installed in every project. This uses virtual: true on the mock so that it's harmless if used in a package without next.
Empty out mockInitializers before running any preload, for more bulletproof capturing of any newly loaded components.
virtual: true
on the mock so that it's harmless if used in a package withoutnext
.mockInitializers
before running anypreload
, for more bulletproof capturing of any newly loaded components.