Comments (7)
Thanks... I can repo. Investigating...
from jest-preset-spfx-react16.
Update - I understand why this is happening, but I can't figure out how to fix it for a bigger set of circumstances.
It's easy to fix for just the one library you're using, but this will quickly turn into a +1 issue when someone uses another library, so I'm looking for a more dynamic solution... this is affecting all three of my presets...
Still working...
from jest-preset-spfx-react16.
Understood. Have a merry Christmas Andrew! Thanks again for your all help.
from jest-preset-spfx-react16.
Something occurred to me: What you're trying to do won't give you desirable results. You're trying to use the Environment
& EnvironmentType
objects that won't yield desirable results outside of a SharePoint context.
You should be able to just add the following in your spec file to tell Jest to mock those two objects without any changes to the jest config file:
jest.mock('@microsoft/sp-core-library/', () => {
return {
'Environment': {},
'EnvironmentType': {},
};
});
I'm going to close this issue for now, but still working on a more robust solution in the case where it appears as an issue in other projects.
from jest-preset-spfx-react16.
I am facing the similar issue and writing the above code didn't fix the issue :(
from jest-preset-spfx-react16.
@taranxd please open a new issue with more details to better track the issue.
I became aware these presets are not working with the latest SPFx and need to investigate the root cause. Learned about the issue this week so will look into it shortly...
from jest-preset-spfx-react16.
Hello @andrewconnell, I am working implementing jest in some SPFx projects and I get the same error that explain @petecuttriss, the difference is that I am working with SPFx Framework v1.11 Do you have found another solution @andrewconnell or @petecuttriss? I appreciate so much the help ;)
from jest-preset-spfx-react16.
Related Issues (11)
- V1.3.1 causes different TSC rules to be applied than project settings HOT 2
- jest-preset.json testMatch Question HOT 7
- Unit testing typescript SPFx web part using jest
- NPM postinstall error @voitanos/[email protected] HOT 5
- Problem when using WebPartTitle component HOT 4
- Gracefully handle failures in postinstall step
- Add automated tests
- Add continuous deployment
- Unable to use with ES6 modules HOT 30
- undefined class names HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-preset-spfx-react16.