Skip to content

Commit f26b8df

Browse files
Kent C. Doddskentcdodds
authored andcommitted
chore: cleanup repo (#600)
1 parent 7942f68 commit f26b8df

File tree

12 files changed

+34
-53
lines changed

12 files changed

+34
-53
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
node_modules
22
coverage
33
dist
4-
.opt-in
5-
.opt-out
64
.DS_Store
7-
.eslintcache
8-
9-
yarn-error.log
105

116
# these cause more harm than good
127
# when working with contributors
138
package-lock.json
149
yarn.lock
15-

.prettierignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
package.json
21
node_modules
3-
dist
42
coverage
3+
dist

.prettierrc

Lines changed: 0 additions & 11 deletions
This file was deleted.

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('kcd-scripts/prettier')

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cache: npm
33
notifications:
44
email: false
55
node_js:
6-
- 10.14
6+
- 10.18
77
- 12
88
- node
99
install:

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
"main": "dist/index.js",
66
"module": "dist/@testing-library/react.esm.js",
77
"engines": {
8-
"node": ">=10"
8+
"node": ">=10.18"
99
},
1010
"scripts": {
1111
"prebuild": "rimraf dist",
1212
"build": "npm-run-all --parallel build:main build:bundle:main build:bundle:pure",
13-
"build:main": "kcd-scripts build --no-clean",
1413
"build:bundle:main": "kcd-scripts build --bundle --no-clean",
1514
"build:bundle:pure": "cross-env BUILD_FILENAME_SUFFIX=.pure BUILD_INPUT=src/pure.js kcd-scripts build --bundle --no-clean",
15+
"build:main": "kcd-scripts build --no-clean",
1616
"lint": "kcd-scripts lint",
17+
"setup": "npm install && npm run validate -s",
1718
"test": "kcd-scripts test",
1819
"test:update": "npm test -- --updateSnapshot --coverage",
19-
"validate": "kcd-scripts validate",
20-
"setup": "npm install && npm run validate -s"
20+
"validate": "kcd-scripts validate"
2121
},
2222
"husky": {
2323
"hooks": {
@@ -41,7 +41,7 @@
4141
"end-to-end",
4242
"e2e"
4343
],
44-
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
44+
"author": "Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)",
4545
"license": "MIT",
4646
"dependencies": {
4747
"@babel/runtime": "^7.8.7",
@@ -51,7 +51,7 @@
5151
"devDependencies": {
5252
"@reach/router": "^1.3.3",
5353
"@testing-library/jest-dom": "^5.1.1",
54-
"cross-env": "^7.0.1",
54+
"cross-env": "^7.0.2",
5555
"kcd-scripts": "^5.4.0",
5656
"npm-run-all": "^4.1.5",
5757
"react": "^16.9.0",
@@ -79,7 +79,7 @@
7979
],
8080
"repository": {
8181
"type": "git",
82-
"url": "https://github.com/testing-library/react-testing-library.git"
82+
"url": "https://github.com/testing-library/react-testing-library"
8383
},
8484
"bugs": {
8585
"url": "https://github.com/testing-library/react-testing-library/issues"

src/__tests__/act.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import {render, fireEvent} from '../'
2+
import {render, fireEvent, screen} from '../'
33

44
test('render calls useEffect immediately', () => {
55
const effectCb = jest.fn()
@@ -13,8 +13,8 @@ test('render calls useEffect immediately', () => {
1313

1414
test('findByTestId returns the element', async () => {
1515
const ref = React.createRef()
16-
const {findByTestId} = render(<div ref={ref} data-testid="foo" />)
17-
expect(await findByTestId('foo')).toBe(ref.current)
16+
render(<div ref={ref} data-testid="foo" />)
17+
expect(await screen.findByTestId('foo')).toBe(ref.current)
1818
})
1919

2020
test('fireEvent triggers useEffect calls', () => {

src/__tests__/debug.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import {render} from '../'
2+
import {render, screen} from '../'
33

44
beforeEach(() => {
55
jest.spyOn(console, 'log').mockImplementation(() => {})
@@ -26,8 +26,8 @@ test('debug pretty prints multiple containers', () => {
2626
<h1 data-testid="testId">Hello World</h1>
2727
</>
2828
)
29-
const {getAllByTestId, debug} = render(<HelloWorld />)
30-
const multipleElements = getAllByTestId('testId')
29+
const {debug} = render(<HelloWorld />)
30+
const multipleElements = screen.getAllByTestId('testId')
3131
debug(multipleElements)
3232

3333
expect(console.log).toHaveBeenCalledTimes(2)

src/__tests__/end-to-end.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import {render, wait} from '../'
2+
import {render, waitForElementToBeRemoved, screen} from '../'
33

44
const fetchAMessage = () =>
55
new Promise(resolve => {
@@ -30,10 +30,8 @@ class ComponentWithLoader extends React.Component {
3030
}
3131

3232
test('it waits for the data to be loaded', async () => {
33-
const {queryByText, queryByTestId} = render(<ComponentWithLoader />)
34-
35-
expect(queryByText('Loading...')).toBeTruthy()
36-
37-
await wait(() => expect(queryByText('Loading...')).toBeNull())
38-
expect(queryByTestId('message').textContent).toMatch(/Hello World/)
33+
render(<ComponentWithLoader />)
34+
const loading = () => screen.getByText('Loading...')
35+
await waitForElementToBeRemoved(loading)
36+
expect(screen.getByTestId('message')).toHaveTextContent(/Hello World/)
3937
})

0 commit comments

Comments
 (0)