refacto config test
This commit is contained in:
@@ -32,23 +32,47 @@ global.fetch = jest.fn(() =>
|
||||
})
|
||||
) as jest.Mock;
|
||||
|
||||
// 🟡 Ignore le warning pdfjs-dist
|
||||
// 🟡 Ignore les warnings pdfjs-dist
|
||||
const originalWarn = console.warn;
|
||||
console.warn = (...args) => {
|
||||
if (
|
||||
typeof args[0] === 'string' &&
|
||||
args[0].includes('ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG')
|
||||
) {
|
||||
const message = typeof args[0] === 'string' ? args[0] : '';
|
||||
|
||||
// Liste des warnings à ignorer
|
||||
const ignoredWarnings = [
|
||||
'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG',
|
||||
'loadPackages',
|
||||
'pdfjs-dist',
|
||||
];
|
||||
|
||||
if (ignoredWarnings.some((warning) => message.includes(warning))) {
|
||||
return;
|
||||
}
|
||||
|
||||
originalWarn(...args);
|
||||
};
|
||||
|
||||
// 🔴 Ignore le log angularx-qrcode après les tests
|
||||
const originalError = console.error;
|
||||
console.error = (...args) => {
|
||||
if (typeof args[0] === 'string' && args[0].includes('[angularx-qrcode]')) {
|
||||
// 🟡 Ignore les logs angularx-qrcode
|
||||
const originalLog = console.log;
|
||||
console.log = (...args) => {
|
||||
const message = typeof args[0] === 'string' ? args[0] : '';
|
||||
|
||||
const ignoredLogs = ['Warning: loadPackages', 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG'];
|
||||
|
||||
if (ignoredLogs.some((log) => message.includes(log))) {
|
||||
return;
|
||||
}
|
||||
|
||||
originalLog(...args);
|
||||
};
|
||||
|
||||
// 🔴 Ignore les errors angularx-qrcode
|
||||
const originalError = console.error;
|
||||
console.error = (...args) => {
|
||||
const message = typeof args[0] === 'string' ? args[0] : '';
|
||||
|
||||
if (message.includes('[angularx-qrcode]')) {
|
||||
return;
|
||||
}
|
||||
|
||||
originalError(...args);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user