diff --git a/src/__tests__/wait-for.js b/src/__tests__/wait-for.js
index 742bf8f..bb96141 100644
--- a/src/__tests__/wait-for.js
+++ b/src/__tests__/wait-for.js
@@ -1,4 +1,4 @@
-import {waitFor} from '../'
+import {waitFor} from '../index'
import {configure, getConfig} from '../config'
// import {render} from '../pure'
@@ -109,6 +109,7 @@ test('throws nice error if provided callback is not a function', () => {
)
})
+// eslint-disable-next-line jest/no-commented-out-tests
// test('timeout logs a pretty DOM', async () => {
// renderIntoDocument(`
how pretty
`)
// const error = await waitFor(
diff --git a/src/get-user-code-frame.js b/src/get-user-code-frame.js
index 32de6a8..5f53cff 100644
--- a/src/get-user-code-frame.js
+++ b/src/get-user-code-frame.js
@@ -12,7 +12,7 @@ try {
'@babel/code-frame',
).codeFrameColumns
chalk = nodeRequire.call(module, 'chalk')
-} catch {
+} catch (e) {
// We're in a browser environment
}
@@ -32,7 +32,7 @@ function getCodeFrame(frame) {
let rawFileContents = ''
try {
rawFileContents = readFileSync(filename, 'utf-8')
- } catch {
+ } catch (e) {
return ''
}
diff --git a/src/helpers.js b/src/helpers.js
index 1b68ada..d70cf65 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -5,7 +5,7 @@ function jestFakeTimersAreEnabled() {
// legacy timers
setTimeout._isMockFunction === true ||
// modern timers
- Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
+ Object.hasOwn(setTimeout, 'clock')
)
}
// istanbul ignore next
@@ -48,7 +48,7 @@ function debounce(func, timeout) {
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
- // eslint-disable-next-line @babel/no-invalid-this
+ // eslint-disable-next-line no-invalid-this
func.apply(this, args)
}, timeout)
}
diff --git a/src/index.js b/src/index.js
index a4f42a0..5f73193 100644
--- a/src/index.js
+++ b/src/index.js
@@ -4,7 +4,7 @@ import {cleanup} from './pure'
// or teardown then we'll automatically run cleanup afterEach test
// this ensures that tests run in isolation from each other
// if you don't like this then set the CTL_SKIP_AUTO_CLEANUP env variable to 'true'.
-if (typeof process === 'undefined' || !process.env?.CTL_SKIP_AUTO_CLEANUP) {
+if (typeof process === 'undefined' || !(process.env && process.env.CTL_SKIP_AUTO_CLEANUP)) {
// ignore teardown() in code coverage because Jest does not support it
/* istanbul ignore else */
if (typeof afterEach === 'function') {
diff --git a/src/matchers/to-be-in-the-console.js b/src/matchers/to-be-in-the-console.js
index 22ba877..e52f44d 100644
--- a/src/matchers/to-be-in-the-console.js
+++ b/src/matchers/to-be-in-the-console.js
@@ -1,4 +1,4 @@
-/* eslint-disable @babel/no-invalid-this */
+/* eslint-disable no-invalid-this */
import {getDefaultNormalizer} from '../matches'
import {checkCliInstance, getMessage} from './utils'
diff --git a/src/matchers/to-have-errormessage.js b/src/matchers/to-have-errormessage.js
index 3ed8863..63af9dd 100644
--- a/src/matchers/to-have-errormessage.js
+++ b/src/matchers/to-have-errormessage.js
@@ -1,4 +1,4 @@
-/* eslint-disable @babel/no-invalid-this */
+/* eslint-disable no-invalid-this */
import {getDefaultNormalizer} from '../matches'
import {checkCliInstance, getMessage} from './utils'
diff --git a/src/matchers/utils.js b/src/matchers/utils.js
index d7eb400..54a6882 100644
--- a/src/matchers/utils.js
+++ b/src/matchers/utils.js
@@ -26,7 +26,7 @@ class GenericTypeError extends Error {
'',
),
'',
- // eslint-disable-next-line @babel/new-cap
+ // eslint-disable-next-line new-cap
`${context.utils.RECEIVED_COLOR(
'received',
)} value must ${expectedString}.`,
@@ -65,11 +65,11 @@ function getMessage(
) {
return [
`${matcher}\n`,
- // eslint-disable-next-line @babel/new-cap
+ // eslint-disable-next-line new-cap
`${expectedLabel}:\n${context.utils.EXPECTED_COLOR(
redent(display(context, expectedValue), 2),
)}`,
- // eslint-disable-next-line @babel/new-cap
+ // eslint-disable-next-line new-cap
`${receivedLabel}:\n${context.utils.RECEIVED_COLOR(
redent(display(context, receivedValue), 2),
)}`,
diff --git a/src/wait-for.js b/src/wait-for.js
index a31fd78..6ee9d11 100644
--- a/src/wait-for.js
+++ b/src/wait-for.js
@@ -122,7 +122,7 @@ function waitFor(
if (promiseStatus === 'pending') return
try {
const result = callback() // runWithExpensiveErrorDiagnosticsDisabled(callback)
- if (typeof result?.then === 'function') {
+ if (typeof (result && result.then) === 'function') {
promiseStatus = 'pending'
result.then(
resolvedValue => {