-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1618 from canalplus/misc/remove-webdriverio-depre…
…cation-notices [Proposal] Remove webdriverio deprecation notice the ugly way
- Loading branch information
Showing
3 changed files
with
45 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import createContentServer from "./contents/server.mjs"; | ||
|
||
const realConsoleWarn = console.warn; | ||
let contentServer; | ||
|
||
/** | ||
* Peform actions we want to setup before tests. | ||
*/ | ||
export function setup() { | ||
removeAnnoyingDeprecationNotice(); | ||
contentServer = createContentServer(); | ||
} | ||
|
||
/** | ||
* Peform actions to clean-up after tests. | ||
*/ | ||
export function teardown() { | ||
contentServer?.close(); | ||
} | ||
|
||
/** | ||
* Webdriverio just spams a deprecation notice with the current version of | ||
* vitest (one per test, though as we have thousands of tests, it just fills the | ||
* output into something unreadable). | ||
* | ||
* This is so annoying that I just chose to mute it by monkey-patching the | ||
* console function here. | ||
* | ||
* This should hopefully be very temporary. | ||
*/ | ||
function removeAnnoyingDeprecationNotice() { | ||
console.warn = function (...args) { | ||
if ( | ||
typeof args[0] === "string" && | ||
args[0].startsWith( | ||
'⚠️ [WEBDRIVERIO DEPRECATION NOTICE] The "switchToFrame" command is deprecated and we encourage everyone to use `switchFrame` instead for switching into frames.', | ||
) | ||
) { | ||
return; | ||
} | ||
return realConsoleWarn.apply(console, args); | ||
}; | ||
} |
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