Closed charesbast closed 2 years ago
This doesn't work because Jest doesn't understand module exports. I'll fix the issue, but I want to make clear that jest is lacking behind in the ecosystem.
Eventually I'd like to move away from these custom path transformations.
Thx for the super quick response :) PS: I assume you've seen it but actually it's not just awareness, all imports are impacted
Hi @charesbast,
I hope you agree with me that we shouldn't keep stuck in a decade-old process to bundle modules. We have had wide ESM support for a long time and we have very useful features like "conditional imports" that make my life immensely easier + it allows for smaller imports that don't require environment checks (there are different bundles for browser and node).
Jest is a big pain point for me (as are other module bundlers that don't advance). I decided to continue using "conditional imports" because I don't want to return back to absolutely qualified imports.
Don't despair, Yjs + extensions are still usable in Jest. Here is a Jest config from the Jupyter project: https://github.com/jupyterlab/jupyterlab/blob/master/testutils/src/jest-config.ts
The import of awareness.cjs is no longer from dist folder in
y-prosemirror@1.0.18
:In comparison, here is the (good) import in version
y-prosemirror@1.0.9
:-> It's obviously an error that is not problematic during runtime but it makes jest crash during the tests as the file has ES6 imports