Skip to content

Commit 8c4579c

Browse files
author
Kent C. Dodds
committed
fix example stuff
1 parent d780347 commit 8c4579c

File tree

6 files changed

+3
-9
lines changed

6 files changed

+3
-9
lines changed

examples/README.md

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ The examples have a unique jest/eslint set up so the test files will resemble
1111
how they might appear in your project. (You'll see in the tests that we can
1212
`import {render} from 'react-testing-library'`).
1313

14-
Another thing that we do for the tests is we have a `setup-test-env.js` file in
15-
the `other` directory of this repo which includes
16-
`import 'jest-dom/extend-expect'` which gives us a few handy assertions. It's
17-
recommended to use [`jest-dom`][jest-dom] with `react-testing-library`.
18-
1914
## Contribute
2015

2116
We're always happy to accept contributions to the examples. Can't have too many

examples/__tests__/react-context.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import {render} from 'react-testing-library'
3+
import 'jest-dom/extend-expect'
34
import {NameContext, NameProvider, NameConsumer} from '../react-context'
45

56
/**

examples/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const jestConfig = require('kcd-scripts/jest')
22

33
module.exports = Object.assign(jestConfig, {
44
rootDir: __dirname,
5+
roots: [__dirname],
56
displayName: 'example',
6-
setupTestFrameworkScriptFile: require.resolve('../other/setup-test-env'),
77
moduleNameMapper: {
88
// this is just here so our examples look like they would in a real project
99
'react-testing-library': require.resolve('../src'),

jest.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ const jestConfig = require('kcd-scripts/jest')
22

33
module.exports = Object.assign(jestConfig, {
44
displayName: 'library',
5-
setupTestFrameworkScriptFile: require.resolve('./other/setup-test-env'),
65
})

other/setup-test-env.js

-1
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "kcd-scripts build",
1313
"lint": "kcd-scripts lint",
1414
"test": "kcd-scripts test --config=other/jest.config.js",
15-
"test:update": "npm test -- --updateSnapshot --coverage --projects=src",
15+
"test:update": "npm test -- --updateSnapshot --coverage",
1616
"validate": "kcd-scripts validate",
1717
"setup": "npm install && npm run validate -s",
1818
"precommit": "kcd-scripts precommit"

0 commit comments

Comments
 (0)