-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Can't run Jest tests when component uses Dialog #2325
Comments
Very similar thing happens with Guid class
|
Hi Sergei, I just wanted to confirm that I'm seeing the same issue also. Likewise I'm using v1.5.1. In my case I've added an import for the DisplayMode from the sp-core-library
|
Tried to wite transformIgnorePatterns but didn't help |
@aslanovsergey Did you come up with a solution to this? |
I have the same error with jest testing on |
@crsanghani Unfortunately no and @microsoft/sp-dialog 1.6.0 doesn't change the situation |
@aslanovsergey any progress? i have the same issue |
I'm also encountering the same error as @gosiaborzecka even after removing all references to Dialog. SPFx v1.5.0 |
Hi everyone, @aslanovsergey I did some further research on this and have managed to get my jest tests working but I'm not quite sure yet at what cost. I took a copy of Velin Georgiev's jest testing sample: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-jest-testing. This sample is using SFPX v1.6.0. I did an initial build and ran "npm test" successfully. I then took the "IceCreamShop.tsx" component and added a reference to the Guid class e.g. import { Guid } from '@microsoft/sp-core-library'; I also added a var which generated a new guid in the main render method e.g. var guid: Guid = Guid.newGuid();. After this change I ran "npm test" once again and got it to fail with the "Unexpected token export" error. To get the tests running again I then did the following:
Note the addition of "js".
Following these changes I was able to run "npm test" again and the tests all ran successfully. I've been able to replicate these steps using a new project also built using SPFx v1.7.0 with the same results. I can't say I fully understand the implications of the changes I've made but building, running and testing of my components is now working. Hopefully these changes might further help in figuring out this issue. I need to do some more research to further understand the implications of these changes. |
I had opened an issue in jest project and got an answer. @VesaJuvonen who can look at this issue from SPFx team side? |
For me it works, thanks! |
Hi @petecuttriss |
This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open the issue. |
Category
I use @microsoft/sp-dialog 1.5.1 and SPFx 1.5.1
Expected or Desired Behavior
When I test my component with Jest I get the next error
The text was updated successfully, but these errors were encountered: