Comments (15)
It seems reasonable to move the sinon
stuff into a reagent-sinon
package which you could use if you wanted that behavior.
from enzyme.
I think it makes a ton of sense to not have sinon as part of the main package. I am curious what direct benefit a user of reagent would get from including sinon with reagent that wouldn't be there if you depended on sinon directly.
Additionally the current implementation makes assumptions about test framework lifecycle methods that might not make sense in every environment.
from enzyme.
I'm not sure what assumptions you're talking about - could you please file a separate issue for that?
from enzyme.
Not every test framework has a beforeEach
and afterEach
.
from enzyme.
@ljharb not certain it is worth an issue. but before
and after
while available in most frameworks aren't present in them all. Qunit for example uses setup and teardown.
from enzyme.
The use of sinon in this project has been largely left undocumented because of the assumptions it's making about mocha being present (which is a vestige of this being used internally at airbnb).
I agree this should be done as it is somewhat separate from the meat of the library.
from enzyme.
+1
I am using this with jasmine, and I don't need an extra library for spies, since I have a built-in one.
from enzyme.
Considering the related PR was just closed with no comments, what does this mean for this issue ?
Do you still accept work for this or do you have other plans ?
from enzyme.
@Sinewyk this is still going to happen! I just closed the PR because this branch was doing some mono-repo things that we've decided not to do.
This is definitely planned for 2.0!
from enzyme.
Just fyi., the Sinon dependency could also be a significant blocker to adoption, since Sinon has issues with WebPack, so it starts puking out errors as soon as I add a import { shallow } from 'enzyme'
to my project.
WARNING in ./~/sinon/lib/sinon.js
Critical dependencies:
40:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/sinon/lib/sinon.js 40:25-32
I'm using a setup based on the react-redux-starter-kit, but there's plenty of other people with the same problem, and the accepted workaround won't work here, since I can't modify how Enzyme requires Sinon (without forking).
from enzyme.
@mikl I totally 100% agree. Enzyme 2.0 will be coming out soon with this as one of the breaking changes. You can try pulling in the RC in the time being (no guarantees on what that will do though):
npm i [email protected]
Part of enzyme 2.0 will be that all major test environments will be supported, and this will be ensured by having "example" projects whose test suites actually run as part of the CI of this project.
Sorry again for the frustrations that this is causing at the moment.
from enzyme.
@lelandrichardson no need to apologize! You're doing us all an awesome service by open sourcing this. Thanks for all your hard work on it.
from enzyme.
@lelandrichardson thanks, no need to apologise. It 2.0.0-rc1 solves the Sinon problem, although I still needed one of the workarounds from #47 to make it all work.
from enzyme.
@mikl yes - some of the problems present in #47 and other issues are not easy problems to fix as they are present in part because there are conditional require statements that are different for react 0.13 and react 0.14, which could only be fixed through dropping 0.13 support. Additionally cheerio has some problems specifically which would mean we'd have to drop render support or roll our own cheerio.
With the release of 2.0 I will include guides for the steps to get enzyme working in every popular testing environment that I'm hoping will achieve a good balance of ease-of-installation and compatibility.
from enzyme.
@lelandrichardson yeah, nothing like multi-version, multi-environment support to create work for you π. Thanks for your efforts.
from enzyme.
Related Issues (20)
- enzyme-adapter-react-18 HOT 2
- Component is not re-rendered with updated states HOT 5
- Cheerio 1.0.0-rc.11 no longer support deep imports HOT 3
- enzyme crash since Cheerio 1.0.0-rc.11 release HOT 5
- CSS selectors match component props rather than rendered DOM HOT 6
- Cannot read property 'child' of undefined on React 16 + enzyme-adapter-react-16 HOT 1
- Cannot read property 'child' of undefined enzyme-adapter-react-16 and react 17.0.2 HOT 3
- "TypeError: Cannot read properties of undefined (reading 'current')" in mount API HOT 7
- Method βpropsβ is only meant to be run on a single node. 0 found instead. HOT 1
- How to test the form which is rendered based on props in class component in react.js ? HOT 3
- How to test the state values which are setting the state from local storage inside componentDidMount in enzyme using reactjs ? HOT 5
- Function `mount` does not mock proper data HOT 5
- [email protected] does not include latest changes as per master HOT 5
- Document `getElement(s)` for full DOM rendering HOT 3
- TypeError: window.require is not a function HOT 5
- Does Enzyme support React 18.0.2 ? HOT 1
- Is this library 'dead'? HOT 5
- Explain how the synchronization works HOT 1
- Mount and simulate are failing after changing to Node 16 HOT 10
- enzyme-adapter-react-18 HOT 1
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 enzyme.