Closed regina-wolf closed 1 year ago
Hi @regina-wolf
thanks for reporting, we'll try to investigate this problem. However, please note that since we're a small team, we generally don't have the capacity to debug third-party projects.
As Allianz employee, you can open tickets on our internal board and participate in team's discussions https://github.developer.allianz.io/ilt/ngx-ndbx/issues
I opened a counterpart of your ticket internally https://github.developer.allianz.io/ilt/ngx-ndbx/issues/3978
Hi @regina-wolf to add on @yd-allianz, I looked quickly at your code example. And there is a lot going on. Could you please provide a minimal reproduction that pins the problem down to something more specific? I see you are doing a lot of custom handling of the input element value and setting the form control value, which I could see a potential to create issues. So a proper reproduction would be to strip out all this logic to the point where the error happens. This could also help you identify potential problems in your code.
Hi @Phil147, can you please explain more what you mean with setting the form control value and that it could create issues. Do you mean the FormControl part in the birthdate.component.ts in the constructor? I thought that this is a standard way.
Nevertheless I commented out lots of unnecessary code in the birthdate.component.html and birthdate.component.ts and if the jest cache will be deleted before with jest --clearCache the error appears consequently. The current state is committed in the testapp.
To execute a jest --clearCache before every test execution I adjusted the test configuration in IntelliJ and have added a script to be executed before the tests are run.
You can also comment out further code for example the form control part in birthdate.component.ts and birthdate.component.html. When I tried it the error still appears.
Hi @regina-wolf the problem is that it is hard for us to debug a whole set of code, with some setup that we don't know about, there are many other projects that use jest without any issues so it's difficult to understand here what could be the problem and if the problem is really in the library or the error you see is just a symptom of something else outside of our control. Nevertheless I tried it but couldn't reproduce the problem.
I quickly tried your sample at https://github.developer.allianz.io/regina-wolf/Issue-NxIsoDateModule
What exactly do I have to do to see the error? yarn test
is not working so I assumed I just have to run jest
. What I see right now is that the tests don't finish for me but no error is thrown (after 7minutes), do I have to wait a certain amount to see the error? How do you run the tests? Do you provide some options to jest or do you also just run jest
?
Hi @Phil147, before I executed the tests directly in IntelliJ. But I made an update in the testapp and now you can use a script to execute the tests. But before you need to update the dependencies with "yarn install" and then you can execute "yarn test".
Then you should see the following error:
Hi @regina-wolf
so I took some time for this issue and also tried to talk to other people and get some insights. To me I cannot verify what the exact problem is, but I got some feedback that e.g. the itmp-frontend-workspace in the internal github faced a similar issue and went the route of using the NxNativeDateModule
inside tests. They investigated the issue heavily but couldn't find the cause, in the end it could be a bug in node and/or jest. If you search for it there are quite some issues with jest and segmentation faults.
I tried many things now, I also created a new angular project, copied the code and added jest with ng add @briebug/jest-schematic
which didn't throw any segmentation faults but it complained about the dayjs.extend
that dayjs would be undefined. Which in total leads me to believe that there is some issue with jest and node about how imports are handled (dynamically).
I could get this app to start though, so this problem really only shows in jest, which makes it hard for us to fix, as we cannot prove what the actual issue is.
So you could try to use the NativeDateAdapter in your tests as a workaround. We are happy to change something on our end if you can point it out what would be wrong, but overall I am more confident currently that this is not a problem on our end.
⚡ Reproduction
Repo link to testapp that should reproduce the error: https://github.developer.allianz.io/regina-wolf/Issue-NxIsoDateModule Repo link to original application where the error was detected: https://github.developer.allianz.io/AzD-eRisp/XPSI-Spielwiese
Unfortunately the error appears flaky in the testapp and I couldn't find a reason for it. Sometimes it helps to clear the jest cache to get the error. For this reason I added the link to the original application (branch: fix-XPS-952-Issue-NxIsoDateModule). Here the error occurs consistently. In the original application we currently use a workaround to bypass the error.
Steps to reproduce:
📗 Expected Behavior
Importing the NxIsoDateModule should not cause a segmentation fault in jest test and workaround should not be needed.
📕 Actual Behavior
Importing the NxIsoDateModule causes a segmentation fault in jest tests
📦 Environment