diff --git a/tests/e2e/utils/withFailTimeout.js b/tests/e2e/utils/withFailTimeout.ts similarity index 61% rename from tests/e2e/utils/withFailTimeout.js rename to tests/e2e/utils/withFailTimeout.ts index d7ac50a64e00..bac21c58a169 100644 --- a/tests/e2e/utils/withFailTimeout.js +++ b/tests/e2e/utils/withFailTimeout.ts @@ -1,12 +1,13 @@ import CONFIG from '../config'; -const TIMEOUT = process.env.INTERACTION_TIMEOUT || CONFIG.INTERACTION_TIMEOUT; +// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing doesn't achieve the same result in this case +const TIMEOUT = Number(process.env.INTERACTION_TIMEOUT || CONFIG.INTERACTION_TIMEOUT); -const withFailTimeout = (promise, name) => +const withFailTimeout = (promise: Promise, name: string): Promise => new Promise((resolve, reject) => { const timeoutId = setTimeout(() => { reject(new Error(`"${name}": Interaction timed out after ${(TIMEOUT / 1000).toFixed(0)}s`)); - }, Number(TIMEOUT)); + }, TIMEOUT); promise .then((value) => {