Skip to content

Commit 9832c05

Browse files
committed
test(color-picker): suppress react-color defaultProps deprecation warnings in test output
1 parent 0bb345a commit 9832c05

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const base = require("@mendix/pluggable-widgets-tools/test-config/jest.config.js");
2+
3+
module.exports = {
4+
...base,
5+
setupFilesAfterEnv: [...base.setupFilesAfterEnv, "<rootDir>/jest.setup.ts"]
6+
};

packages/pluggableWidgets/color-picker-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"publish-marketplace": "rui-publish-marketplace",
3939
"release": "cross-env MPKOUTPUT=ColorPicker.mpk pluggable-widgets-tools release:web",
4040
"start": "cross-env MPKOUTPUT=ColorPicker.mpk pluggable-widgets-tools start:server",
41-
"test": "pluggable-widgets-tools test:unit:web",
41+
"test": "jest",
4242
"update-changelog": "rui-update-changelog-widget",
4343
"verify": "rui-verify-package-format"
4444
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import "@testing-library/jest-dom";
2+
3+
const originalConsoleError = console.error.bind(console);
4+
console.error = (...args: unknown[]): void => {
5+
// react-color@2.19.3 uses defaultProps on function components, deprecated in React 18.3.
6+
// These warnings are from the library, not our widget code.
7+
if (typeof args[0] === "string" && args[0].includes("Support for defaultProps will be removed")) {
8+
return;
9+
}
10+
originalConsoleError(...args);
11+
};

0 commit comments

Comments
 (0)