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, and jsdom dependencies #159

Merged
merged 1 commit into from
Feb 11, 2016

Conversation

lelandrichardson
Copy link
Collaborator

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

In addition to this, I would like to create several "example" projects that are some basic boilerplate
to getting enzyme up and running with some combination of bundler/test runner/etc. These projects
can end up being devDependencies to enzyme and we can run their tests as part of our tests, which will
ensure that changes we make to enzyme will be compatible with environments we claim to support moving
forward.

Lastly, as a matter of organization, tests have been moved from src/__tests__/* to tests/*.

Left to do for this to be mergable is:

[ ] Add a "guides" section in the docs explaining how to use enzyme in different environments
[ ] Add example projects as dev dependencies, include their tests in enzyme's test script

NOTE: This will be a semver-MAJOR change because of the removal of describeWithDOM and sinon etc. The main mount, shallow, and render APIs have no breaking changes.

Fixes #132
Fixes #104
Fixes #80
Fixes #75
Fixes #73
Fixes #66
Fixes #55
Fixes #44

@lelandrichardson lelandrichardson added the semver: major Breaking changes label Feb 2, 2016
@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch 3 times, most recently from 3d40176 to 9c1493a Compare February 2, 2016 18:34
it('calls componentDidMount', () => {
spy(Foo.prototype, 'componentDidMount');
const wrapper = mount(<Foo />);
expect(Foo.prototype.componentDidMount.calledOnce).to.be.true;
Copy link
Member

Choose a reason for hiding this comment

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

these examples shouldn't use the getter assertions - .to.equal(true)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

true. I'm going to be rewriting these examples anyway :)

@ljharb
Copy link
Member

ljharb commented Feb 2, 2016

LGTM overall, pending the one comment - but before we merge this, we should cut a (hopefully) final release on the 1.x line with everything that's in master

@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch 3 times, most recently from d8a2e82 to d4adcaa Compare February 2, 2016 22:29
import { REACT013 } from '../version';
} from '../src/Debug';
import { mount } from '../src/';
import { describeWithDOM,itIf } from './_helpers';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space should be added after comma

@lelandrichardson
Copy link
Collaborator Author

@ljharb Made some documentation updates. PTAL.

@lelandrichardson
Copy link
Collaborator Author

Main thing left is i'm going to add the referenced example repos in a special test script so we can be reactive regarding regressions in these environments

@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch from 1105c81 to dc327ad Compare February 8, 2016 20:19
@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch 4 times, most recently from a9baeff to 6fbd757 Compare February 9, 2016 02:03
@lelandrichardson
Copy link
Collaborator Author

Update: Got the "Example" projects pulled in as dev-deps and running those tests is now part of CI. I just have to add in the other projects (only mocha and karma are included ATM)

- "0.10"
before_install:
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi'
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi'
before_script: "sh install-relevant-react.sh"
script:
- 'if [ "${TRAVIS_NODE_VERSION}" = "4.2" ]; then npm run lint && npm run travis ; elif [ "${TRAVIS_NODE_VERSION}" = "0.12" ]; then npm run travis ; else npm test ; fi'
- 'if [ -z "$REACT" ] && [ "${TRAVIS_NODE_VERSION}" = "4" ]; then npm run test:env -- "${EXAMPLE}" ; elif [ -z "$REACT" ]; then echo "Test Skipped" ; elif [ "${TRAVIS_NODE_VERSION}" = "4" ]; then npm run lint && npm run travis ; elif [ "${TRAVIS_NODE_VERSION}" = "0.12" ]; then npm run travis ; else npm test ; fi'
Copy link
Member

Choose a reason for hiding this comment

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

we should also make sure npm test locally runs all the npm run test:env scripts so that devs don't miss them

@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch 2 times, most recently from 0b5374a to 05513d7 Compare February 10, 2016 21:28
@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch from 05513d7 to 26741a7 Compare February 10, 2016 22:24
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

In addition to this, I would like to create several "example" projects that are some basic boilerplate
to getting enzyme up and running with some combination of bundler/test runner/etc.  These projects
can end up being devDependencies to enzyme and we can run their tests as part of our tests, which will
ensure that changes we make to enzyme will be compatible with environments we claim to support moving
forward.

Lastly, as a matter of organization, tests have been moved from `src/__tests__/*` to `tests/*`.

Left to do for this to be mergable is:

  [ ] Add a "guides" section in the docs explaining how to use enzyme in different environments
  [ ] Add example projects as dev dependencies, include their tests in enzyme's test script
@lelandrichardson lelandrichardson force-pushed the lmr--make-test-environment-agnostic branch from 26741a7 to 219e50a Compare February 10, 2016 23:54
lelandrichardson added a commit that referenced this pull request Feb 11, 2016
Rip out sinon, mocha, and jsdom dependencies
@lelandrichardson lelandrichardson merged commit 91ac8b2 into master Feb 11, 2016
@lelandrichardson lelandrichardson deleted the lmr--make-test-environment-agnostic branch February 11, 2016 00:33
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.

4 participants