Skip to content
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

Rip out sinon & mocha into separate modules #60

Closed
wants to merge 1 commit into from

Conversation

lelandrichardson
Copy link
Collaborator

to: @ljharb @goatslacker

This refactor addresses several issues regarding enzyme working in a variety of environments, and
the library just generally not making any assumptions about the environment that tests will be
run in.

For the most part, this amounts to:

  • remove direct dependency on jsdom
  • remove direct dependency on sinon
  • remove assumed dependency on mocha

Additionally, this change moves the code that was removed into separate modules that are
defined in the packages folder. In this case we have added two modules: "enzyme-mocha" and
"enzyme-sinon".

This design will allow us to have one repo where all issues, code, and documentation
regarding enzyme are centralized, but modules are still separated at the NPM level. This
will allow us to make atomic releases across the modules more easily, as well as keep
all of the discussion in one place.

Left to do for this to be mergable is:

  • Add a "guides" section in the docs explaining how to use enzyme in different environments
  • Build a proper npm script to run an npm publish in the proper order for each module
  • Add more meaningful tests for packages

Related Issues:

@lelandrichardson lelandrichardson added the semver: major Breaking changes label Dec 8, 2015

describeWithDOM('<Foo />', () => {
import React from 'react';
import sionon from 'sinon';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "sionon"

@ljharb
Copy link
Member

ljharb commented Dec 8, 2015

This design will allow us to have one repo where all issues, code, and documentation
regarding enzyme are centralized, but modules are still separated at the NPM level.

I'm not sure I agree that we'll see this as valuable. Issues with mocha-enzyme don't belong on the main enzyme repo, because not all people looking at enzyme will care about mocha nor want to see them. Similarly, people looking at enzyme-mocha issues won't want to see enzyme-jasmine issues. "non-centralized documentation" isn't a problem one way or the other since things can just link to each others' docs.

This will allow us to make atomic releases across the modules more easily, as well as keep
all of the discussion in one place.

I'm not sure how cd-ing to different dirs and running npm publish is different whether those dirs are inside the main repo, or in separate repos. What discussions do you anticipate in a separate-repo world that won't belong in the main repo, or in any of the separate repos, and thus won't have an obvious place to be held?

}

export function describeWithDOM(a, b) {
describe('(uses jsdom)', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when this is imported outside a test context, and then cached with the global describe set to undefined? I think perhaps this export may need to either take describe as an argument, or, actually be a function that takes describe and returns describeWithDOM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we aren't caching describe anywhere? Every time describeWithDOM is called, it uses the describe that is in the global namespace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function retains a lexical reference to the one that's in the global namespace at the moment the function is defined, it's not freshly looked up. do you mean this to be global.describe then?

@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch from 338e201 to 7708643 Compare December 8, 2015 18:44
This refactor addresses several issues regarding enzyme working in a variety of environments, and
the library just generally not making any assumptions about the environment that tests will be
run in.

For the most part, this amounts to:

  - remove direct dependency on jsdom
- remove direct dependency on sinon
- remove assumed dependency on mocha

Additionally, this change moves the code that was removed into separate modules that are
defined in the packages folder. In this case we have added two modules: "enzyme-mocha" and
"enzyme-sinon".

  This design will allow us to have one repo where all issues, code, and documentation
regarding enzyme are centralized, but modules are still separated at the NPM level. This
will allow us to make atomic releases across the modules more easily, as well as keep
all of the discussion in one place.

  Left to do for this to be mergable is:

  [ ] Add a "guides" section in the docs explaining how to use enzyme in different environments
  [ ] Build a proper npm script to run an npm publish in the proper order for each module
  [ ] Add more meaningful tests for packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: major Breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants