@trackunit/react-test-setup 1.6.19 → 1.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -54,6 +54,10 @@ const setupCanvasMock = () => {
54
54
  * This will make your tests fail if they log to console.error during the tests.
55
55
  * See more details here: https://www.npmjs.com/package/jest-fail-on-console
56
56
  *
57
+ * This setup also automatically suppresses jsdom CSS parsing errors for modern CSS features
58
+ * that jsdom doesn't support (@container queries and :has() selector). Other CSS parsing
59
+ * errors will still cause tests to fail.
60
+ *
57
61
  * If your tests logs to console.error on purpose, you should spy on the console like so:
58
62
  * ```
59
63
  * jest.spyOn(console, 'error').mockImplementation()
@@ -65,6 +69,16 @@ const setupFailOnConsole = (overrides = {}) => {
65
69
  failOnConsole({
66
70
  shouldFailOnError: true,
67
71
  shouldFailOnWarn: false,
72
+ silenceMessage: (message, _methodName) => {
73
+ // Suppress ONLY jsdom CSS parsing errors for specific modern CSS features
74
+ // that we know jsdom doesn't support (@container queries, :has() selector)
75
+ if (typeof message === "string" &&
76
+ message.includes("Could not parse CSS stylesheet") &&
77
+ (message.includes("@container") || message.includes(":has("))) {
78
+ return true;
79
+ }
80
+ return false;
81
+ },
68
82
  ...overrides,
69
83
  });
70
84
  };
@@ -720,7 +734,7 @@ const setupWebStreams = () => {
720
734
  *
721
735
  * This convenience function sets up all the test mocks provided by the library:
722
736
  * - Canvas API mocks
723
- * - Console error reporting to fail tests
737
+ * - Console error reporting to fail tests (includes automatic CSS parser error suppression)
724
738
  * - Google Maps API and components mocks
725
739
  * - React Helmet mocks
726
740
  * - IntersectionObserver mocks
package/index.esm.js CHANGED
@@ -33,6 +33,10 @@ const setupCanvasMock = () => {
33
33
  * This will make your tests fail if they log to console.error during the tests.
34
34
  * See more details here: https://www.npmjs.com/package/jest-fail-on-console
35
35
  *
36
+ * This setup also automatically suppresses jsdom CSS parsing errors for modern CSS features
37
+ * that jsdom doesn't support (@container queries and :has() selector). Other CSS parsing
38
+ * errors will still cause tests to fail.
39
+ *
36
40
  * If your tests logs to console.error on purpose, you should spy on the console like so:
37
41
  * ```
38
42
  * jest.spyOn(console, 'error').mockImplementation()
@@ -44,6 +48,16 @@ const setupFailOnConsole = (overrides = {}) => {
44
48
  failOnConsole({
45
49
  shouldFailOnError: true,
46
50
  shouldFailOnWarn: false,
51
+ silenceMessage: (message, _methodName) => {
52
+ // Suppress ONLY jsdom CSS parsing errors for specific modern CSS features
53
+ // that we know jsdom doesn't support (@container queries, :has() selector)
54
+ if (typeof message === "string" &&
55
+ message.includes("Could not parse CSS stylesheet") &&
56
+ (message.includes("@container") || message.includes(":has("))) {
57
+ return true;
58
+ }
59
+ return false;
60
+ },
47
61
  ...overrides,
48
62
  });
49
63
  };
@@ -699,7 +713,7 @@ const setupWebStreams = () => {
699
713
  *
700
714
  * This convenience function sets up all the test mocks provided by the library:
701
715
  * - Canvas API mocks
702
- * - Console error reporting to fail tests
716
+ * - Console error reporting to fail tests (includes automatic CSS parser error suppression)
703
717
  * - Google Maps API and components mocks
704
718
  * - React Helmet mocks
705
719
  * - IntersectionObserver mocks
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trackunit/react-test-setup",
3
3
  "description": "Test setup utilities for React applications",
4
- "version": "1.6.19",
4
+ "version": "1.6.20",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
7
7
  "engines": {
@@ -7,7 +7,7 @@ export interface SetupAllMocksOptions {
7
7
  *
8
8
  * This convenience function sets up all the test mocks provided by the library:
9
9
  * - Canvas API mocks
10
- * - Console error reporting to fail tests
10
+ * - Console error reporting to fail tests (includes automatic CSS parser error suppression)
11
11
  * - Google Maps API and components mocks
12
12
  * - React Helmet mocks
13
13
  * - IntersectionObserver mocks
@@ -3,6 +3,10 @@ import failOnConsole from "jest-fail-on-console";
3
3
  * This will make your tests fail if they log to console.error during the tests.
4
4
  * See more details here: https://www.npmjs.com/package/jest-fail-on-console
5
5
  *
6
+ * This setup also automatically suppresses jsdom CSS parsing errors for modern CSS features
7
+ * that jsdom doesn't support (@container queries and :has() selector). Other CSS parsing
8
+ * errors will still cause tests to fail.
9
+ *
6
10
  * If your tests logs to console.error on purpose, you should spy on the console like so:
7
11
  * ```
8
12
  * jest.spyOn(console, 'error').mockImplementation()