mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
In the latest versions of ESLint, more and more formatting rules were removed or declared deprecated. These rules have been integrated into the new Stylistic package (https://eslint.style/guide/why) and expanded. Stylistic acts as a better formatter for JavaScript as Prettier. With this PR there are many changes that make the code more uniform, but it may be difficult to review due to the large amount. Even if I have no worries about the changes, perhaps this would be something for the release after next. Let me know what you think.
29 lines
603 B
JavaScript
29 lines
603 B
JavaScript
/**
|
|
* Suppresses errors concerning web server already shut down.
|
|
* @param {string} err The error message.
|
|
*/
|
|
const mockError = (err) => {
|
|
if (
|
|
err.includes("ECONNREFUSED")
|
|
|| err.includes("ECONNRESET")
|
|
|| err.includes("socket hang up")
|
|
|| err.includes("exports is not defined")
|
|
|| err.includes("write EPIPE")
|
|
|| err.includes("AggregateError")
|
|
|| err.includes("ERR_SOCKET_CONNECTION_TIMEOUT")
|
|
) {
|
|
jest.fn();
|
|
} else {
|
|
console.dir(err);
|
|
}
|
|
};
|
|
|
|
global.console = {
|
|
log: jest.fn(),
|
|
dir: console.dir,
|
|
error: mockError,
|
|
warn: console.warn,
|
|
info: jest.fn(),
|
|
debug: console.debug
|
|
};
|