mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
fix(ui): migrate setupTests to typescript
This commit is contained in:
committed by
Łukasz Mierzwa
parent
cd4c68a86a
commit
ef1e6c0c81
Generated
+8
@@ -4769,6 +4769,14 @@
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/enzyme-adapter-react-16": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.0.6.tgz",
|
||||
"integrity": "sha512-VonDkZ15jzqDWL8mPFIQnnLtjwebuL9YnDkqeCDYnB4IVgwUm0mwKkqhrxLL6mb05xm7qqa3IE95m8CZE9imCg==",
|
||||
"requires": {
|
||||
"@types/enzyme": "*"
|
||||
}
|
||||
},
|
||||
"@types/eslint-visitor-keys": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"@types/body-scroll-lock": "2.6.1",
|
||||
"@types/bricks.js": "1.8.1",
|
||||
"@types/enzyme": "3.10.5",
|
||||
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||
"@types/fontfaceobserver": "0.0.6",
|
||||
"@types/jest": "26.0.5",
|
||||
"@types/lodash.debounce": "4.0.6",
|
||||
|
||||
@@ -15,16 +15,19 @@ require("jest-canvas-mock");
|
||||
// used to mock current time since we render moment.fromNow() in some places
|
||||
require("jest-date-mock");
|
||||
|
||||
// ensure that all console messages throw errors
|
||||
for (const level of ["error", "warn", "info", "log", "trace"]) {
|
||||
// https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#new-deprecations
|
||||
const reactDeprecationWarning = /.*has been renamed, and is not recommended for use.*/;
|
||||
global.console[level] = (message, ...args) => {
|
||||
if (reactDeprecationWarning.test(message) === false) {
|
||||
throw new Error(`message=${message} args=${args}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
// https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#new-deprecations
|
||||
const reactDeprecationWarning = /.*has been renamed, and is not recommended for use.*/;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const consoleHandler = (message?: any, ...args: any): void => {
|
||||
if (reactDeprecationWarning.test(message as string) === false) {
|
||||
throw new Error(`message=${message} args=${args}`);
|
||||
}
|
||||
};
|
||||
global.console.error = consoleHandler;
|
||||
global.console.warn = consoleHandler;
|
||||
global.console.info = consoleHandler;
|
||||
global.console.log = consoleHandler;
|
||||
global.console.trace = consoleHandler;
|
||||
|
||||
FetchRetryConfig.minTimeout = 2;
|
||||
FetchRetryConfig.maxTimeout = 10;
|
||||
Reference in New Issue
Block a user