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
-
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/component
To 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
typescript
variant.In short, the
NativeFederationTestsRemote
:esbuild
under the hood to concat in a single file the exposed module;While the
NativeFederationTestsHost
just downloads the zip files and extract its content in the__mocks__
folder.Since
jest
is 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