Skip to content

Commit f6d0604

Browse files
committed
chore: upgrade kcd-scripts dev dependency
1 parent 11fc773 commit f6d0604

File tree

7 files changed

+19
-6
lines changed

7 files changed

+19
-6
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@
5656
"jest-snapshot-serializer-ansi": "^1.0.0",
5757
"jest-watch-select-projects": "^2.0.0",
5858
"jsdom": "^16.4.0",
59-
"kcd-scripts": "^11.0.0",
59+
"kcd-scripts": "^12.2.0",
6060
"typescript": "^4.1.2"
6161
},
6262
"eslintConfig": {
6363
"extends": [
6464
"./node_modules/kcd-scripts/eslint.js",
6565
"plugin:import/typescript"
6666
],
67+
"parserOptions": {
68+
"ecmaVersion": 2020
69+
},
6770
"rules": {
6871
"@typescript-eslint/prefer-includes": "off",
6972
"import/prefer-default-export": "off",

src/__tests__/fake-timers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ test('recursive timers do not cause issues', async () => {
7070
let recurse = true
7171
function startTimer() {
7272
setTimeout(() => {
73+
// eslint-disable-next-line jest/no-conditional-in-test
7374
if (recurse) startTimer()
7475
}, 1)
7576
}

src/__tests__/role.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ test('accessible name filter implements TextMatch', () => {
274274
expect(
275275
getByRole('heading', {
276276
name: (name, element) => {
277+
// eslint-disable-next-line jest/no-conditional-in-test
277278
return element.nodeName === 'H2' && name === 'Your Signature'
278279
},
279280
}),

src/__tests__/wait-for-element-to-be-removed.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ test('rethrows non-testing-lib errors', () => {
9898
const error = new Error('my own error')
9999
return expect(
100100
waitForElementToBeRemoved(() => {
101+
// eslint-disable-next-line jest/no-conditional-in-test
101102
if (throwIt) {
102103
throw error
103104
}

src/__tests__/wait-for.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ test('does not work after it resolves', async () => {
275275
context = 'act'
276276
try {
277277
const result = callback()
278-
// eslint-disable-next-line jest/no-if
278+
// eslint-disable-next-line jest/no-if, jest/no-conditional-in-test
279279
if (typeof result?.then === 'function') {
280280
const thenable = result
281281
return {
@@ -319,6 +319,7 @@ test('does not work after it resolves', async () => {
319319

320320
await waitFor(
321321
() => {
322+
// eslint-disable-next-line jest/no-conditional-in-test
322323
if (data === null) {
323324
throw new Error('not found')
324325
}

src/helpers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function jestFakeTimersAreEnabled() {
99
// legacy timers
1010
setTimeout._isMockFunction === true ||
1111
// modern timers
12+
// Disabling linting rule - hasOwn is not available in Node 12/14
13+
// eslint-disable-next-line prefer-object-has-own
1214
Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
1315
)
1416
}

src/queries/label-text.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,23 @@ const queryAllByLabelText: AllByText = (
7171
if (
7272
matcher(label.content, label.formControl, text, matchNormalizer) &&
7373
label.formControl
74-
)
74+
) {
7575
labelledElements.push(label.formControl)
76+
}
7677
})
7778
const labelsValue = labelList
7879
.filter(label => Boolean(label.content))
7980
.map(label => label.content)
8081
if (
8182
matcher(labelsValue.join(' '), labelledElement, text, matchNormalizer)
82-
)
83+
) {
8384
labelledElements.push(labelledElement)
85+
}
8486
if (labelsValue.length > 1) {
8587
labelsValue.forEach((labelValue, index) => {
86-
if (matcher(labelValue, labelledElement, text, matchNormalizer))
88+
if (matcher(labelValue, labelledElement, text, matchNormalizer)) {
8789
labelledElements.push(labelledElement)
90+
}
8891

8992
const labelsFiltered = [...labelsValue]
9093
labelsFiltered.splice(index, 1)
@@ -97,8 +100,9 @@ const queryAllByLabelText: AllByText = (
97100
text,
98101
matchNormalizer,
99102
)
100-
)
103+
) {
101104
labelledElements.push(labelledElement)
105+
}
102106
}
103107
})
104108
}

0 commit comments

Comments
 (0)