-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate utils modules to TS. (#3869)
--------- Co-authored-by: Ravi Sawlani <ravisawlani04@gmail.com>
- Loading branch information
Showing
16 changed files
with
591 additions
and
84 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
4 changes: 2 additions & 2 deletions
4
lib/utils/alwaysDisplayError.js → lib/utils/alwaysDisplayError.ts
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = function(err) { | ||
export = function(err: unknown) { | ||
return (err instanceof Error) && [ | ||
'TypeError', 'SyntaxError', 'ReferenceError', 'RangeError' | ||
].includes(err.name); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
const BrowserName = module.exports = { | ||
class BrowserName { | ||
get CHROME() { | ||
return 'chrome'; | ||
}, | ||
} | ||
|
||
get FIREFOX() { | ||
return 'firefox'; | ||
}, | ||
} | ||
|
||
get SAFARI() { | ||
return 'safari'; | ||
}, | ||
} | ||
|
||
get EDGE() { | ||
return 'MicrosoftEdge'; | ||
}, | ||
} | ||
|
||
get INTERNET_EXPLORER() { | ||
return 'internet explorer'; | ||
}, | ||
} | ||
|
||
get OPERA() { | ||
return 'opera'; | ||
} | ||
}; | ||
} | ||
|
||
Object.freeze(BrowserName); | ||
export = new BrowserName(); |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
interface Deferred<T> { | ||
promise: Promise<T>; | ||
resolve: ((value: T | PromiseLike<T>) => void); | ||
reject: ((reason?: unknown) => void); | ||
} | ||
|
||
export = function createPromise<T>(): Deferred<T> { | ||
const deferred = <Deferred<T>> {}; | ||
|
||
deferred.promise = new Promise((resolve, reject) => { | ||
deferred.resolve = resolve; | ||
deferred.reject = reject; | ||
}); | ||
|
||
return deferred; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = function(err) { | ||
export = function(err: unknown) { | ||
return err instanceof Error || Object.prototype.toString.call(err) === '[object Error]'; | ||
}; | ||
}; |
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,5 @@ | ||
export interface NightwatchError extends Error { | ||
detailedErr: string; | ||
link: string; | ||
help: string[]; | ||
} |
Oops, something went wrong.