refacto config test

This commit is contained in:
styve Lioumba
2025-11-16 12:39:53 +01:00
parent e33c8a229f
commit 61b0bd0d19
3 changed files with 49 additions and 9 deletions

View File

@@ -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);
};