Example project with React + Enzyme + Jest
- Clone the repo
- From the project's root directory, run
npm install
npm test
The original example, written by Leland Richardson, can be found at https://github.com/lelandrichardson/enzyme-example-jest.
This project forked from lelandrichardson/enzyme-example-jest
Example project with React + Enzyme + Jest
License: MIT License
Example project with React + Enzyme + Jest
npm install
npm test
The original example, written by Leland Richardson, can be found at https://github.com/lelandrichardson/enzyme-example-jest.
Hello!
I was reading through the documentation and while taking a look at the tests I found this little bugger:
expect(mount(<Foo />).find('.foo').length).toBe(1);
where length should be length()
? Im more than happy to fix it. Its tiny. Like me.
It looks like this repository is no longer maintained, but just in case someone is still reading this, it would be nice if the Enzyme/Jest test example actually followed the Enzyme/Jest instructions, which:
jest.config.js
file (the example doesn't)setupTestFrameworkScriptFile
entry to that config, and have it point to a setupTests.js
file (the example also lacks this file)require
in both enzyme.configure
and enzyme-adapter-react-16
(or a different adapter for older Reacts)configure
and pass it a new enzyme-adapter-react-16
adapter.Honestly getting all that setup right seems more difficult (and thus more in need of a proper example) than the stuff the example does demonstrate.
You only have one test "expect(true).toBe(true);"
As soon as I uncomment the "expect(shallow..." lines it breaks with various errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.