-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: MockModule
, NgFor
and @happy-dom/jest-environment
#5465
Comments
Hi, you didn't install ngMocks.globalKeep(ApplicationModule, true);
ngMocks.globalKeep(CommonModule, true);
ngMocks.globalKeep(BrowserModule, true); this part is missing. |
Hello, I didn't know we had to do that, thanks for the info. It's kinda strange that it works fine with Thanks for that lib btw, it's awesome! |
Ah, I see. I had the same suspicion, because the test which is failing in your project has passed on my CI. Then the issue here is, that The issue it solves: "Class constructor CommonModule cannot be invoked without 'new'" when I'll play around to see how |
This is the issue: microsoft/TypeScript#17088 |
This is why:
eval('class MockMiddleware {};');
eval('class MockMiddleware {};'); working on a fix. |
fix(core): merge of kept / mock declarations in CommonModule #5465
If you want, you can open an issue in this is what works in javascript: https://stackblitz.com/edit/js-gvfp3d?file=index.js |
Hello, thanks for your reactivity, this is well appreciated! Thanks for the fix, I'm glad you found what was the cause, I will make a ticket on |
v14.10.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems. |
Awesome, thanks for the release. It seems to works fine, no problem so far for now! |
Glad to hear! Stay in touch! |
Description of the bug
Hello, it seems that when using
NgFor
instead ofCommonModule
(because I only use*ngFor
), it does not work with Jest andtestEnvironment: '@happy-dom/jest-environment',
.It works fine if I use
CommonModule
or if I usejsdom
.It does the following error:
Maybe I should create a ticket on
happy-dom
? (I don't have any information to give for now as I don't know what's the cause)An example of the bug
NgFor
is inMyComponentModule
which is imported in the test ofAppComponent
.npm run test
You can test that it works without
testEnvironment: '@happy-dom/jest-environment',
by removing the line injest.config.js
.Expected vs actual behavior
No error, working as if we're using
CommonModule
.The text was updated successfully, but these errors were encountered: