-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rip out sinon, mocha, and jsdom dependencies
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
- Loading branch information
1 parent
ad02abf
commit d4adcaa
Showing
17 changed files
with
95 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Using Enzyme with Mocha | ||
|
||
```bash | ||
npm i --save-dev enzyme-mocha | ||
``` | ||
|
||
```jsx | ||
import { mount } from 'enzyme'; | ||
import { describeWithDOM } from 'enzyme-mocha'; | ||
|
||
describe('<Foo />', () => { | ||
|
||
it('calls componentDidMount', () => { | ||
spy(Foo.prototype, 'componentDidMount'); | ||
const wrapper = mount(<Foo />); | ||
expect(Foo.prototype.componentDidMount.calledOnce).to.be.true; | ||
}); | ||
|
||
}); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/__tests__/ReactWrapper-spec.js → test/ReactWrapper-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.