diff --git a/README.md b/README.md
index 660b3dab..9be76865 100644
--- a/README.md
+++ b/README.md
@@ -456,12 +456,12 @@ expect(submitButton).toBeNull() // it doesn't exist
## Examples
You'll find examples of testing with different libraries in
-[the test directory](https://github.com/kentcdodds/react-testing-library/blob/master/src/__tests__).
+[the `examples` directory](https://github.com/kentcdodds/react-testing-library/blob/master/examples).
Some included are:
-* [`react-redux`](https://github.com/kentcdodds/react-testing-library/blob/master/src/__tests__/react-redux.js)
-* [`react-router`](https://github.com/kentcdodds/react-testing-library/blob/master/src/__tests__/react-router.js)
-* [`react-context`](https://github.com/kentcdodds/react-testing-library/blob/master/src/__tests__/react-context.js)
+* [`react-redux`](https://github.com/kentcdodds/react-testing-library/blob/master/examples/__tests__/react-redux.js)
+* [`react-router`](https://github.com/kentcdodds/react-testing-library/blob/master/examples/__tests__/react-router.js)
+* [`react-context`](https://github.com/kentcdodds/react-testing-library/blob/master/examples/__tests__/react-context.js)
Examples of TDD with react-testing-library:
@@ -546,7 +546,7 @@ render(
Kent C. Dodds](https://kentcdodds.com)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [π](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [
Ryan Castner](http://audiolion.github.io)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [
Daniel Sandiego](https://www.dnlsandiego.com)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") | [
PaweΕ MikoΕajczyk](https://github.com/Miklet)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=Miklet "Code") | [
Alejandro ΓÑñez Ortiz](http://co.linkedin.com/in/alejandronanez/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=alejandronanez "Documentation") | [
Matt Parrish](https://github.com/pbomb)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Apbomb "Bug reports") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Documentation") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Tests") | [
Justin Hall](https://github.com/wKovacs64)
[π¦](#platform-wKovacs64 "Packaging/porting to new platform") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [
Anto Aravinth](https://github.com/antoaravinth)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Code") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Tests") [π](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Documentation") | [
Jonah Moses](https://github.com/JonahMoses)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=JonahMoses "Documentation") | [
Εukasz Gandecki](http://team.thebrain.pro)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Code") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Tests") [π](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Documentation") | [
Ivan Babak](https://sompylasar.github.io)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Asompylasar "Bug reports") [π€](#ideas-sompylasar "Ideas, Planning, & Feedback") | [
Jesse Day](https://github.com/jday3)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=jday3 "Code") | [
Ernesto GarcΓa](http://gnapse.github.io)
[π¬](#question-gnapse "Answering Questions") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Documentation") | [
Josef Maxx Blake](http://jomaxx.com)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Documentation") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Tests") |
| [
Michal Baranowski](https://twitter.com/baranovskim)
[π](#blog-mbaranovski "Blogposts") [β
](#tutorial-mbaranovski "Tutorials") | [
Arthur Puthin](https://github.com/aputhin)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [
Thomas Chia](https://github.com/thchia)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Documentation") | [
Thiago Galvani](http://ilegra.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") | [
Christian](http://Chriswcs.github.io)
[β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=ChrisWcs "Tests") | [
Alex Krolick](https://alexkrolick.com)
[π¬](#question-alexkrolick "Answering Questions") [π](https://github.com/kentcdodds/react-testing-library/commits?author=alexkrolick "Documentation") [π‘](#example-alexkrolick "Examples") [π€](#ideas-alexkrolick "Ideas, Planning, & Feedback") |
-
This project follows the [all-contributors][all-contributors] specification.
diff --git a/examples/.eslintrc.js b/examples/.eslintrc.js
new file mode 100644
index 00000000..67ff778c
--- /dev/null
+++ b/examples/.eslintrc.js
@@ -0,0 +1,15 @@
+module.exports = {
+ // we have to do this so our tests can reference 'react-testing-library'
+ overrides: [
+ {
+ files: ['**/__tests__/**'],
+ settings: {
+ 'import/resolver': {
+ jest: {
+ jestConfigFile: require.resolve('./jest.config.js'),
+ },
+ },
+ },
+ },
+ ],
+}
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 00000000..6eda8302
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,30 @@
+# Examples
+
+Here we have some examples for you to know how to not only use
+`react-testing-library` but also in general how to test common scenarios that
+pop up with React. Check out the `__tests__` directory for the different
+examples.
+
+## Setup
+
+The examples have a unique jest/eslint set up so the test files will resemble
+how they might appear in your project. (You'll see in the tests that we can
+`import {render} from 'react-testing-library'`).
+
+## Contribute
+
+We're always happy to accept contributions to the examples. Can't have too many
+of these as there are TONs of different ways to test React. Examples of testing
+components that use different and common libraries is always welcome. Try to
+keep examples simple enough for people to understand the main thing we're trying
+to demonstrate from the example.
+
+Please follow the guidelines found in [CONTRIBUTING.md][contributing] to set up
+the project.
+
+To run the tests, you can run `npm test examples`, or if you're working on a
+specific example, you can run `npm test name-of-your-file`. This will put you
+into Jest's interactive watch mode with a filter based on the name you provided.
+
+[contributing]: https://github.com/kentcdodds/react-testing-library/blob/master/CONTRIBUTING.md
+[jest-dom]: https://github.com/gnapse/jest-dom
diff --git a/src/__tests__/mock.react-transition-group.js b/examples/__tests__/mock.react-transition-group.js
similarity index 96%
rename from src/__tests__/mock.react-transition-group.js
rename to examples/__tests__/mock.react-transition-group.js
index 67a8b790..f2547195 100644
--- a/src/__tests__/mock.react-transition-group.js
+++ b/examples/__tests__/mock.react-transition-group.js
@@ -1,6 +1,6 @@
import React from 'react'
import {CSSTransition} from 'react-transition-group'
-import {render, Simulate} from '../'
+import {render, Simulate} from 'react-testing-library'
function Fade({children, ...props}) {
return (
diff --git a/examples/__tests__/react-context.js b/examples/__tests__/react-context.js
new file mode 100644
index 00000000..00d47b58
--- /dev/null
+++ b/examples/__tests__/react-context.js
@@ -0,0 +1,56 @@
+import React from 'react'
+import {render} from 'react-testing-library'
+import 'jest-dom/extend-expect'
+import {NameContext, NameProvider, NameConsumer} from '../react-context'
+
+/**
+ * Test default values by rendering a context consumer without a
+ * matching provider
+ */
+test('NameConsumer shows default value', () => {
+ const {getByText} = render(