-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto whitelist users created during Cypress tests runs
- Loading branch information
1 parent
c60dd3f
commit 66f3a13
Showing
7 changed files
with
75 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { promisify } from 'util' | ||
|
||
const promisifiedTimeout = promisify(setTimeout) | ||
|
||
export const timeout = async (millis, errorMessage = null) => { | ||
await promisifiedTimeout(millis) | ||
|
||
if (errorMessage) { | ||
throw new Error(errorMessage) | ||
} | ||
} | ||
|
||
export default async function requestTimeout(millis, timeoutReason = null) { | ||
let errorMessage = 'Request timeout' | ||
|
||
if (timeoutReason) { | ||
errorMessage += `: ${timeoutReason}` | ||
} | ||
|
||
await timeout(millis, errorMessage) | ||
} |