GithubHelp home page GithubHelp logo

Comments (15)

ljharb avatar ljharb commented on April 28, 2024

It seems reasonable to move the sinon stuff into a reagent-sinon package which you could use if you wanted that behavior.

from enzyme.

mudetroit avatar mudetroit commented on April 28, 2024

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.

ljharb avatar ljharb commented on April 28, 2024

I'm not sure what assumptions you're talking about - could you please file a separate issue for that?

from enzyme.

IanVS avatar IanVS commented on April 28, 2024

Not every test framework has a beforeEach and afterEach.

from enzyme.

mudetroit avatar mudetroit commented on April 28, 2024

@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.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

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.

just-boris avatar just-boris commented on April 28, 2024

+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.

Sinewyk avatar Sinewyk commented on April 28, 2024

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.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

@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.

mikl avatar mikl commented on April 28, 2024

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.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

@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):

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.

IanVS avatar IanVS commented on April 28, 2024

@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.

mikl avatar mikl commented on April 28, 2024

@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.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

@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.

mikl avatar mikl commented on April 28, 2024

@lelandrichardson yeah, nothing like multi-version, multi-environment support to create work for you 😞. Thanks for your efforts.

from enzyme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.