Replies: 1 comment 1 reply
-
|
@viktoriialurie since this has been included in the universe repo, IMO this discussion could be closed. What do you think? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
in these days I'm facing the following problem: writing good tests for a host which is importing a federated remote components library.
As you may already know, when you execute a test with jest (or vitest), this results in an error like:
Cannot find module remote/componentTo avoid this, I initially found a pretty bad solution: virtual mocking the federated module. This could be done using a syntax like:
The current solution that I'm using is the following: I've created the native-federation-tests plugins, following the same idea of the
typescriptvariant.In short, the
NativeFederationTestsRemote:esbuildunder the hood to concat in a single file the exposed module;While the
NativeFederationTestsHostjust downloads the zip files and extract its content in the__mocks__folder.Since
jestis able to automatically mock everything it recognises as external module, now the tests are ready to work.I know that there is also the reunited solution provided by @ScriptedAlchemy, but sometimes do a full build for tests is slow.
What you think about this idea? Could it make sense or should I just drop it?
Beta Was this translation helpful? Give feedback.
All reactions