Skip to content

Commit a70c02a

Browse files
authored
Merge branch 'main' into types/remove-unused
2 parents ee47217 + 7e42f4e commit a70c02a

File tree

15 files changed

+521
-195
lines changed

15 files changed

+521
-195
lines changed

.all-contributorsrc

+18
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,24 @@
13531353
"contributions": [
13541354
"doc"
13551355
]
1356+
},
1357+
{
1358+
"login": "yinm",
1359+
"name": "Yusuke Iinuma",
1360+
"avatar_url": "https://avatars.githubusercontent.com/u/13295106?v=4",
1361+
"profile": "http://yinm.info",
1362+
"contributions": [
1363+
"code"
1364+
]
1365+
},
1366+
{
1367+
"login": "trappar",
1368+
"name": "Jeff Way",
1369+
"avatar_url": "https://avatars.githubusercontent.com/u/525726?v=4",
1370+
"profile": "https://github.com/trappar",
1371+
"contributions": [
1372+
"code"
1373+
]
13561374
}
13571375
],
13581376
"contributorsPerLine": 7,

.github/ISSUE_TEMPLATE/Bug_Report.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,8 @@ https://github.com/testing-library/testing-library-docs
6060
### Reproduction:
6161

6262
<!--
63-
If possible, please create a repository that reproduces the issue with the
64-
minimal amount of code possible.
65-
66-
Template repo: https://github.com/testing-library/dom-testing-library-template
67-
68-
Or if you can, try to reproduce the issue in a Codesandbox. You can fork the one
69-
here: https://codesandbox.io/s/5z6x4r7n0p
63+
If possible, please try to reproduce this issue in Stackblitz. You can fork the one
64+
here: https://testing-library.com/new-rtl
7065
-->
7166

7267
### Problem description:

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ Thanks goes to these people ([emoji key][emojis]):
630630
</tr>
631631
<tr>
632632
<td align="center" valign="top" width="14.28%"><a href="http://cmdcolin.github.io"><img src="https://avatars.githubusercontent.com/u/6511937?v=4?s=100" width="100px;" alt="Colin Diesh"/><br /><sub><b>Colin Diesh</b></sub></a><br /><a href="https://github.com/testing-library/react-testing-library/commits?author=cmdcolin" title="Documentation">📖</a></td>
633+
<td align="center" valign="top" width="14.28%"><a href="http://yinm.info"><img src="https://avatars.githubusercontent.com/u/13295106?v=4?s=100" width="100px;" alt="Yusuke Iinuma"/><br /><sub><b>Yusuke Iinuma</b></sub></a><br /><a href="https://github.com/testing-library/react-testing-library/commits?author=yinm" title="Code">💻</a></td>
634+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/trappar"><img src="https://avatars.githubusercontent.com/u/525726?v=4?s=100" width="100px;" alt="Jeff Way"/><br /><sub><b>Jeff Way</b></sub></a><br /><a href="https://github.com/testing-library/react-testing-library/commits?author=trappar" title="Code">💻</a></td>
633635
</tr>
634636
</tbody>
635637
</table>

jest.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const {jest: jestConfig} = require('kcd-scripts/config')
2+
3+
module.exports = Object.assign(jestConfig, {
4+
coverageThreshold: {
5+
...jestConfig.coverageThreshold,
6+
// Full coverage across the build matrix (React versions) but not in a single job
7+
// Ful coverage is checked via codecov
8+
'./src/pure.js': {
9+
// minimum coverage of jobs using different React versions
10+
branches: 97,
11+
functions: 88,
12+
lines: 94,
13+
statements: 94,
14+
},
15+
},
16+
})

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@testing-library/jest-dom": "^5.11.6",
5454
"chalk": "^4.1.2",
5555
"dotenv-cli": "^4.0.0",
56-
"jest-diff": "^29.4.1",
56+
"jest-diff": "^29.7.0",
5757
"kcd-scripts": "^13.0.0",
5858
"npm-run-all": "^4.1.5",
5959
"react": "^18.0.0",

src/__tests__/__snapshots__/render.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`supports fragments 1`] = `
3+
exports[`render API supports fragments 1`] = `
44
<DocumentFragment>
55
<div>
66
<code>

src/__tests__/config.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import {configure, getConfig} from '../'
2+
3+
describe('configuration API', () => {
4+
let originalConfig
5+
beforeEach(() => {
6+
// Grab the existing configuration so we can restore
7+
// it at the end of the test
8+
configure(existingConfig => {
9+
originalConfig = existingConfig
10+
// Don't change the existing config
11+
return {}
12+
})
13+
})
14+
15+
afterEach(() => {
16+
configure(originalConfig)
17+
})
18+
19+
describe('DTL options', () => {
20+
test('configure can set by a plain JS object', () => {
21+
const testIdAttribute = 'not-data-testid'
22+
configure({testIdAttribute})
23+
24+
expect(getConfig().testIdAttribute).toBe(testIdAttribute)
25+
})
26+
27+
test('configure can set by a function', () => {
28+
// setup base option
29+
const baseTestIdAttribute = 'data-testid'
30+
configure({testIdAttribute: baseTestIdAttribute})
31+
32+
const modifiedPrefix = 'modified-'
33+
configure(existingConfig => ({
34+
testIdAttribute: `${modifiedPrefix}${existingConfig.testIdAttribute}`,
35+
}))
36+
37+
expect(getConfig().testIdAttribute).toBe(
38+
`${modifiedPrefix}${baseTestIdAttribute}`,
39+
)
40+
})
41+
})
42+
43+
describe('RTL options', () => {
44+
test('configure can set by a plain JS object', () => {
45+
configure({reactStrictMode: true})
46+
47+
expect(getConfig().reactStrictMode).toBe(true)
48+
})
49+
50+
test('configure can set by a function', () => {
51+
configure(existingConfig => ({
52+
reactStrictMode: !existingConfig.reactStrictMode,
53+
}))
54+
55+
expect(getConfig().reactStrictMode).toBe(true)
56+
})
57+
})
58+
59+
test('configure can set DTL and RTL options at once', () => {
60+
const testIdAttribute = 'not-data-testid'
61+
configure({testIdAttribute, reactStrictMode: true})
62+
63+
expect(getConfig().testIdAttribute).toBe(testIdAttribute)
64+
expect(getConfig().reactStrictMode).toBe(true)
65+
})
66+
})

0 commit comments

Comments
 (0)