forked from kptdev/kpt-backstage-plugins-kpt-variant
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathjest.setup.js
More file actions
34 lines (30 loc) · 1.03 KB
/
Copy pathjest.setup.js
File metadata and controls
34 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Polyfill for SlowBuffer removed in Node.js 26
const buffer = require('buffer');
if (!buffer.SlowBuffer) {
buffer.SlowBuffer = function SlowBuffer(length) {
return Buffer.allocUnsafe(length);
};
buffer.SlowBuffer.prototype = Buffer.prototype;
}
const { TextEncoder, TextDecoder } = require('util');
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
// Suppress jsdom CSS parsing errors from @backstage/ui's modern CSS nesting syntax
const originalConsoleError = console.error;
console.error = (...args) => {
if (
(typeof args[0] === 'object' && args[0]?.type === 'css-parsing') ||
(typeof args[0] === 'string' && args[0].includes('Could not parse CSS stylesheet'))
) {
return;
}
originalConsoleError(...args);
};
// Suppress jsdom CSS parsing exceptions thrown during module loading
const originalConsoleWarn = console.warn;
console.warn = (...args) => {
if (typeof args[0] === 'string' && args[0].includes('Could not parse CSS stylesheet')) {
return;
}
originalConsoleWarn(...args);
};