@eeacms/volto-eea-website-theme 3.13.0 → 3.14.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [3.14.1](https://github.com/eea/volto-eea-website-theme/compare/3.14.0...3.14.1) - 13 November 2025
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(breadcrumbs): link for web report section [David Ichim - [`3fb7fcb`](https://github.com/eea/volto-eea-website-theme/commit/3fb7fcb96382b1ae2771dbab88145099c11ad798)]
12
+
13
+ ### [3.14.0](https://github.com/eea/volto-eea-website-theme/compare/3.13.0...3.14.0) - 6 November 2025
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Bump version from 3.13.0 to 3.14.0 [David Ichim - [`7e37c1d`](https://github.com/eea/volto-eea-website-theme/commit/7e37c1d97ab6037cb72444ace400f8b653334cba)]
7
18
  ### [3.13.0](https://github.com/eea/volto-eea-website-theme/compare/3.12.0...3.13.0) - 4 November 2025
8
19
 
9
20
  #### :hammer_and_wrench: Others
@@ -18,6 +29,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
18
29
  #### :hammer_and_wrench: Others
19
30
 
20
31
  - Release 3.12.0 [Alin Voinea - [`ea1e961`](https://github.com/eea/volto-eea-website-theme/commit/ea1e96144684b2a8238ae476fd8d47de82ff42b4)]
32
+ - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`2cac56e`](https://github.com/eea/volto-eea-website-theme/commit/2cac56e22e580e042d368b69254172539ed33b65)]
21
33
  ### [3.11.0](https://github.com/eea/volto-eea-website-theme/compare/3.10.1...3.11.0) - 29 September 2025
22
34
 
23
35
  #### :bug: Bug Fixes
@@ -111,6 +123,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
111
123
 
112
124
  #### :hammer_and_wrench: Others
113
125
 
126
+ - Add Sonarqube tag using fise-frontend addons list [EEA Jenkins - [`3d50874`](https://github.com/eea/volto-eea-website-theme/commit/3d50874281ebcb91a1ae3727248f656a6f26c603)]
127
+ - Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`a3f7676`](https://github.com/eea/volto-eea-website-theme/commit/a3f76767d99cb6dd93cc7fa0eafdea57e9000b2c)]
114
128
  ### [3.5.4](https://github.com/eea/volto-eea-website-theme/compare/3.5.3...3.5.4) - 30 January 2025
115
129
 
116
130
  #### :bug: Bug Fixes
@@ -211,6 +225,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
211
225
 
212
226
  #### :hammer_and_wrench: Others
213
227
 
228
+ - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`e417f83`](https://github.com/eea/volto-eea-website-theme/commit/e417f839312045c56b67ab8134fe5b0622b3e2c3)]
214
229
  ## [3.0.0](https://github.com/eea/volto-eea-website-theme/compare/2.4.0...3.0.0) - 21 October 2024
215
230
 
216
231
  #### :nail_care: Enhancements
@@ -296,6 +311,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
296
311
  - Refs #269520 - other_organisation test [Tripon Eugen - [`7558b27`](https://github.com/eea/volto-eea-website-theme/commit/7558b27a9d1cd6d3480a32b296c7325c796006c9)]
297
312
  - Refs #269520 - other_organisation token widget edit mode [Tripon Eugen - [`b6df127`](https://github.com/eea/volto-eea-website-theme/commit/b6df127bd91b6f55dda8f468e1107037d43752ff)]
298
313
  - Refs #269520 - other_organisation token widget [Tripon Eugen - [`6fd7543`](https://github.com/eea/volto-eea-website-theme/commit/6fd7543894bd2c593a1729116befd95c82ea3c8f)]
314
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`cbc36c7`](https://github.com/eea/volto-eea-website-theme/commit/cbc36c74dfcd5f7cb1013a4c673d9c02e0023766)]
299
315
  ### [2.1.1](https://github.com/eea/volto-eea-website-theme/compare/2.1.0...2.1.1) - 28 May 2024
300
316
 
301
317
  #### :bug: Bug Fixes
@@ -380,6 +396,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
380
396
 
381
397
  #### :hammer_and_wrench: Others
382
398
 
399
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`adc6730`](https://github.com/eea/volto-eea-website-theme/commit/adc6730e21a37afb865b842182624401de6a29f5)]
383
400
  ### [1.33.1](https://github.com/eea/volto-eea-website-theme/compare/1.33.0...1.33.1) - 4 April 2024
384
401
 
385
402
  #### :bug: Bug Fixes
@@ -513,6 +530,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
513
530
 
514
531
  - bump version [Razvan - [`721e939`](https://github.com/eea/volto-eea-website-theme/commit/721e939d12e324b459ebfa78a2e656ee7142a3d6)]
515
532
  - merge master into this branch [Razvan - [`586c8f9`](https://github.com/eea/volto-eea-website-theme/commit/586c8f910bac55a043bd8dda60e9444bd2ae1663)]
533
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`fd90044`](https://github.com/eea/volto-eea-website-theme/commit/fd9004442a9d1d465f7601ecdefe3e23c61e6a9c)]
534
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`4bc3dd3`](https://github.com/eea/volto-eea-website-theme/commit/4bc3dd3ae412a66befd04b5b80fab3716c929240)]
516
535
  - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c4dbd28`](https://github.com/eea/volto-eea-website-theme/commit/c4dbd289358205bc2d849aab7edb11ccf3b89cee)]
517
536
  - fix tests [Razvan - [`042330b`](https://github.com/eea/volto-eea-website-theme/commit/042330bc97d32ffe7ba769b4f2453f71cffed706)]
518
537
  - remove RemoveSchema logic [Razvan - [`08d10f8`](https://github.com/eea/volto-eea-website-theme/commit/08d10f8bf6f75478260e4e4c66d7316ba87b907a)]
@@ -607,6 +626,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
607
626
  - test: Add real image to cypress test [Alin Voinea - [`4ff591a`](https://github.com/eea/volto-eea-website-theme/commit/4ff591ae3318c9588b4e2114582c0fa6cfdf31ae)]
608
627
  - test: Add cypress tests for Image block styling position and align [Alin Voinea - [`7341ef7`](https://github.com/eea/volto-eea-website-theme/commit/7341ef7b92714fc0cc3ab0c31c39033e7b3e19e7)]
609
628
  - Revert "change(tests): commented out rss test since title block config is missing" [Alin Voinea - [`fb61191`](https://github.com/eea/volto-eea-website-theme/commit/fb611918d6ca380b89b594f283dcf9f685a4b294)]
629
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`6a3be30`](https://github.com/eea/volto-eea-website-theme/commit/6a3be3092589411af7808a235f76de5222fd3868)]
630
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c3978f2`](https://github.com/eea/volto-eea-website-theme/commit/c3978f23375ef066e9fd6f6c2e34ba6c1c058f69)]
631
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`f672779`](https://github.com/eea/volto-eea-website-theme/commit/f672779e845bec9240ccc901e9f53ec80c5a1819)]
632
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ae5d8e3`](https://github.com/eea/volto-eea-website-theme/commit/ae5d8e3f4e04dc2808d47ce2ee886e1b23b528da)]
633
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`170ff0c`](https://github.com/eea/volto-eea-website-theme/commit/170ff0c8e3b30e69479bdf1117e811fea94f1027)]
610
634
  ### [1.23.0](https://github.com/eea/volto-eea-website-theme/compare/1.22.1...1.23.0) - 2 November 2023
611
635
 
612
636
  #### :rocket: New Features
@@ -619,6 +643,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
619
643
 
620
644
  #### :house: Internal changes
621
645
 
646
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`f28fce3`](https://github.com/eea/volto-eea-website-theme/commit/f28fce3d1eb815f95fb9aa40de42b10b7e8e30c5)]
622
647
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`6d15088`](https://github.com/eea/volto-eea-website-theme/commit/6d150886c5aeb2ca0b569270486e60f7cc274e2c)]
623
648
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`20c0323`](https://github.com/eea/volto-eea-website-theme/commit/20c032380b33c0077c869a05136f93e2fb68e5d4)]
624
649
 
@@ -804,6 +829,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
804
829
 
805
830
  #### :house: Internal changes
806
831
 
832
+ - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
807
833
 
808
834
  #### :hammer_and_wrench: Others
809
835
 
@@ -959,6 +985,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
959
985
 
960
986
  #### :hammer_and_wrench: Others
961
987
 
988
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
962
989
  ### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
963
990
 
964
991
  #### :bug: Bug Fixes
@@ -1105,6 +1132,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1105
1132
 
1106
1133
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
1107
1134
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
1135
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
1108
1136
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
1109
1137
 
1110
1138
  #### :hammer_and_wrench: Others
@@ -1138,6 +1166,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1138
1166
 
1139
1167
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
1140
1168
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
1169
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
1141
1170
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
1142
1171
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
1143
1172
 
@@ -1147,6 +1176,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1147
1176
 
1148
1177
  #### :hammer_and_wrench: Others
1149
1178
 
1179
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
1150
1180
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
1151
1181
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
1152
1182
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -1157,6 +1187,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1157
1187
 
1158
1188
  #### :hammer_and_wrench: Others
1159
1189
 
1190
+ - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
1160
1191
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
1161
1192
 
1162
1193
  #### :rocket: New Features
@@ -1197,6 +1228,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1197
1228
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
1198
1229
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
1199
1230
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
1231
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
1200
1232
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
1201
1233
 
1202
1234
  #### :nail_care: Enhancements
@@ -1244,6 +1276,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1244
1276
 
1245
1277
  #### :hammer_and_wrench: Others
1246
1278
 
1279
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
1247
1280
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
1248
1281
 
1249
1282
  #### :hammer_and_wrench: Others
@@ -1511,6 +1544,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1511
1544
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
1512
1545
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
1513
1546
  - feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
1547
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
1514
1548
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
1515
1549
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
1516
1550
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -1552,4 +1586,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1552
1586
 
1553
1587
  #### :hammer_and_wrench: Others
1554
1588
 
1589
+ - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
1555
1590
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
@@ -1,10 +1,415 @@
1
+ /**
2
+ * Generic Jest configuration for Volto addons
3
+ *
4
+ * This configuration automatically:
5
+ * - Detects the addon name from the config file path
6
+ * - Configures test coverage to focus on the specific test path
7
+ * - Handles different ways of specifying test paths:
8
+ * - Full paths like src/addons/addon-name/src/components
9
+ * - Just filenames like Component.test.jsx
10
+ * - Just directory names like components
11
+ *
12
+ * Usage:
13
+ * RAZZLE_JEST_CONFIG=src/addons/addon-name/jest-addon.config.js CI=true yarn test [test-path] --collectCoverage
14
+ */
15
+
1
16
  require('dotenv').config({ path: __dirname + '/.env' });
2
17
 
18
+ const path = require('path');
19
+ const fs = require('fs');
20
+ const fg = require('fast-glob');
21
+
22
+ // Get the addon name from the current file path
23
+ const pathParts = __filename.split(path.sep);
24
+ const addonsIdx = pathParts.lastIndexOf('addons');
25
+ const addonName =
26
+ addonsIdx !== -1 && addonsIdx < pathParts.length - 1
27
+ ? pathParts[addonsIdx + 1]
28
+ : path.basename(path.dirname(__filename)); // Fallback to folder name
29
+ const addonBasePath = `src/addons/${addonName}/src`;
30
+
31
+ // --- Performance caches ---
32
+ const fileSearchCache = new Map();
33
+ const dirSearchCache = new Map();
34
+ const dirListingCache = new Map();
35
+ const statCache = new Map();
36
+ const implementationCache = new Map();
37
+
38
+ /**
39
+ * Cached fs.statSync wrapper to avoid redundant filesystem calls
40
+ * @param {string} p
41
+ * @returns {fs.Stats|null}
42
+ */
43
+ const getStatSync = (p) => {
44
+ if (statCache.has(p)) return statCache.get(p);
45
+ try {
46
+ const s = fs.statSync(p);
47
+ statCache.set(p, s);
48
+ return s;
49
+ } catch {
50
+ statCache.set(p, null);
51
+ return null;
52
+ }
53
+ };
54
+
55
+ /**
56
+ * Find files that match a specific pattern using fast-glob
57
+ * @param {string} baseDir - The base directory to search in
58
+ * @param {string} fileName - The name of the file to find
59
+ * @param {string} [pathPattern=''] - Optional path pattern to filter results
60
+ * @returns {string[]} - Array of matching file paths
61
+ */
62
+ const findFilesWithPattern = (baseDir, fileName, pathPattern = '') => {
63
+ const cacheKey = `${baseDir}|${fileName}|${pathPattern}`;
64
+ if (fileSearchCache.has(cacheKey)) {
65
+ return fileSearchCache.get(cacheKey);
66
+ }
67
+
68
+ let files = [];
69
+ try {
70
+ const patterns = fileName
71
+ ? [`${baseDir}/**/${fileName}`]
72
+ : [`${baseDir}/**/*.{js,jsx,ts,tsx}`];
73
+
74
+ files = fg.sync(patterns, { onlyFiles: true });
75
+
76
+ if (pathPattern) {
77
+ files = files.filter((file) => file.includes(pathPattern));
78
+ }
79
+ } catch {
80
+ files = [];
81
+ }
82
+
83
+ fileSearchCache.set(cacheKey, files);
84
+ return files;
85
+ };
86
+
87
+ /**
88
+ * Find directories that match a specific pattern using fast-glob
89
+ * @param {string} baseDir - The base directory to search in
90
+ * @param {string} dirName - The name of the directory to find
91
+ * @param {string} [pathPattern=''] - Optional path pattern to filter results
92
+ * @returns {string[]} - Array of matching directory paths
93
+ */
94
+ const findDirsWithPattern = (baseDir, dirName, pathPattern = '') => {
95
+ const cacheKey = `${baseDir}|${dirName}|${pathPattern}`;
96
+ if (dirSearchCache.has(cacheKey)) {
97
+ return dirSearchCache.get(cacheKey);
98
+ }
99
+
100
+ let dirs = [];
101
+ try {
102
+ const patterns = dirName
103
+ ? [`${baseDir}/**/${dirName}`]
104
+ : [`${baseDir}/**/`];
105
+
106
+ dirs = fg.sync(patterns, { onlyDirectories: true });
107
+
108
+ if (pathPattern) {
109
+ dirs = dirs.filter((dir) => dir.includes(pathPattern));
110
+ }
111
+ } catch {
112
+ dirs = [];
113
+ }
114
+
115
+ dirSearchCache.set(cacheKey, dirs);
116
+ return dirs;
117
+ };
118
+
119
+ /**
120
+ * Find files or directories in the addon using fast-glob
121
+ * @param {string} name - The name to search for
122
+ * @param {string} type - The type of item to find ('f' for files, 'd' for directories)
123
+ * @param {string} [additionalOptions=''] - Additional options for flexible path matching
124
+ * @returns {string|null} - The path of the found item or null if not found
125
+ */
126
+ const findInAddon = (name, type, additionalOptions = '') => {
127
+ const isFile = type === 'f';
128
+ const isDirectory = type === 'd';
129
+ const isFlexiblePathMatch = additionalOptions.includes('-path');
130
+
131
+ let pathPattern = '';
132
+ if (isFlexiblePathMatch) {
133
+ const match = additionalOptions.match(/-path "([^"]+)"/);
134
+ if (match && match[1]) {
135
+ pathPattern = match[1].replace(/\*/g, '');
136
+ }
137
+ }
138
+
139
+ try {
140
+ let results = [];
141
+ if (isFile) {
142
+ results = findFilesWithPattern(addonBasePath, name, pathPattern);
143
+ } else if (isDirectory) {
144
+ results = findDirsWithPattern(addonBasePath, name, pathPattern);
145
+ }
146
+ return results.length > 0 ? results[0] : null;
147
+ } catch (error) {
148
+ return null;
149
+ }
150
+ };
151
+
152
+ /**
153
+ * Find the implementation file for a test file
154
+ * @param {string} testPath - Path to the test file
155
+ * @returns {string|null} - Path to the implementation file or null if not found
156
+ */
157
+ const findImplementationFile = (testPath) => {
158
+ if (implementationCache.has(testPath)) {
159
+ return implementationCache.get(testPath);
160
+ }
161
+
162
+ if (!fs.existsSync(testPath)) {
163
+ implementationCache.set(testPath, null);
164
+ return null;
165
+ }
166
+
167
+ const dirPath = path.dirname(testPath);
168
+ const fileName = path.basename(testPath);
169
+
170
+ // Regex for common test file patterns (e.g., .test.js, .spec.ts)
171
+ const TEST_OR_SPEC_FILE_REGEX = /\.(test|spec)\.[jt]sx?$/;
172
+
173
+ if (!TEST_OR_SPEC_FILE_REGEX.test(fileName)) {
174
+ implementationCache.set(testPath, null);
175
+ return null;
176
+ }
177
+
178
+ const baseFileName = path
179
+ .basename(fileName, path.extname(fileName))
180
+ .replace(/\.(test|spec)$/, ''); // Remove .test or .spec
181
+
182
+ let dirFiles = dirListingCache.get(dirPath);
183
+ if (!dirFiles) {
184
+ dirFiles = fs.readdirSync(dirPath);
185
+ dirListingCache.set(dirPath, dirFiles);
186
+ }
187
+
188
+ const exactMatch = dirFiles.find((file) => {
189
+ const fileBaseName = path.basename(file, path.extname(file));
190
+ return (
191
+ fileBaseName === baseFileName && !TEST_OR_SPEC_FILE_REGEX.test(file) // Ensure it's not another test/spec file
192
+ );
193
+ });
194
+
195
+ if (exactMatch) {
196
+ const result = `${dirPath}/${exactMatch}`;
197
+ implementationCache.set(testPath, result);
198
+ return result;
199
+ }
200
+
201
+ const similarMatch = dirFiles.find((file) => {
202
+ if (
203
+ TEST_OR_SPEC_FILE_REGEX.test(file) ||
204
+ (getStatSync(`${dirPath}/${file}`)?.isDirectory() ?? false)
205
+ ) {
206
+ return false;
207
+ }
208
+ const fileBaseName = path.basename(file, path.extname(file));
209
+ return (
210
+ fileBaseName.toLowerCase().includes(baseFileName.toLowerCase()) ||
211
+ baseFileName.toLowerCase().includes(fileBaseName.toLowerCase())
212
+ );
213
+ });
214
+
215
+ if (similarMatch) {
216
+ const result = `${dirPath}/${similarMatch}`;
217
+ implementationCache.set(testPath, result);
218
+ return result;
219
+ }
220
+
221
+ implementationCache.set(testPath, null);
222
+ return null;
223
+ };
224
+
225
+ /**
226
+ * Get the test path from command line arguments
227
+ * @returns {string|null} - The resolved test path or null if not found
228
+ */
229
+ const getTestPath = () => {
230
+ const args = process.argv;
231
+ let testPath = null;
232
+ const TEST_FILE_REGEX = /\.test\.[jt]sx?$/; // Matches .test.js, .test.jsx, .test.ts, .test.tsx
233
+
234
+ testPath = args.find(
235
+ (arg) =>
236
+ arg.includes(addonName) &&
237
+ !arg.startsWith('--') &&
238
+ arg !== 'test' &&
239
+ arg !== 'node',
240
+ );
241
+
242
+ if (!testPath) {
243
+ const testIndex = args.findIndex((arg) => arg === 'test');
244
+ if (testIndex !== -1 && testIndex < args.length - 1) {
245
+ const nextArg = args[testIndex + 1];
246
+ if (!nextArg.startsWith('--')) {
247
+ testPath = nextArg;
248
+ }
249
+ }
250
+ }
251
+
252
+ if (!testPath) {
253
+ testPath = args.find((arg) => TEST_FILE_REGEX.test(arg));
254
+ }
255
+
256
+ if (!testPath) {
257
+ return null;
258
+ }
259
+
260
+ if (!testPath.includes(path.sep)) {
261
+ if (TEST_FILE_REGEX.test(testPath)) {
262
+ const foundTestFile = findInAddon(testPath, 'f');
263
+ if (foundTestFile) {
264
+ return foundTestFile;
265
+ }
266
+ } else {
267
+ const foundDir = findInAddon(testPath, 'd');
268
+ if (foundDir) {
269
+ return foundDir;
270
+ }
271
+ const flexibleDir = findInAddon(testPath, 'd', `-path "*${testPath}*"`);
272
+ if (flexibleDir) {
273
+ return flexibleDir;
274
+ }
275
+ }
276
+ } else if (
277
+ TEST_FILE_REGEX.test(testPath) && // Check if it looks like a test file path
278
+ !testPath.startsWith('src/addons/')
279
+ ) {
280
+ const testFileName = path.basename(testPath);
281
+ const foundTestFile = findInAddon(testFileName, 'f');
282
+ if (foundTestFile) {
283
+ const relativePath = path.dirname(testPath);
284
+ if (foundTestFile.includes(relativePath)) {
285
+ return foundTestFile;
286
+ }
287
+ const similarFiles = findFilesWithPattern(
288
+ addonBasePath,
289
+ testFileName,
290
+ relativePath,
291
+ );
292
+ if (similarFiles && similarFiles.length > 0) {
293
+ return similarFiles[0];
294
+ }
295
+ }
296
+ }
297
+
298
+ if (
299
+ !path
300
+ .normalize(testPath)
301
+ .startsWith(path.join('src', 'addons', addonName, 'src')) &&
302
+ !path.isAbsolute(testPath) // Use path.isAbsolute for robust check
303
+ ) {
304
+ testPath = path.join(addonBasePath, testPath); // Use path.join for OS-agnostic paths
305
+ }
306
+
307
+ if (fs.existsSync(testPath)) {
308
+ return testPath;
309
+ }
310
+
311
+ const pathWithoutTrailingSlash = testPath.endsWith(path.sep)
312
+ ? testPath.slice(0, -1)
313
+ : null;
314
+ if (pathWithoutTrailingSlash && fs.existsSync(pathWithoutTrailingSlash)) {
315
+ return pathWithoutTrailingSlash;
316
+ }
317
+
318
+ const pathWithTrailingSlash = !testPath.endsWith(path.sep)
319
+ ? testPath + path.sep
320
+ : null;
321
+ if (pathWithTrailingSlash && fs.existsSync(pathWithTrailingSlash)) {
322
+ // Generally, return paths without trailing slashes for consistency,
323
+ // unless it's specifically needed for a directory that only exists with it (rare).
324
+ return testPath;
325
+ }
326
+ return testPath; // Return the original path if no variations exist
327
+ };
328
+
329
+ /**
330
+ * Determine collectCoverageFrom patterns based on test path
331
+ * @returns {string[]} - Array of coverage patterns
332
+ */
333
+ const getCoveragePatterns = () => {
334
+ const excludePatterns = [
335
+ '!src/**/*.d.ts',
336
+ '!**/*.test.{js,jsx,ts,tsx}',
337
+ '!**/*.stories.{js,jsx,ts,tsx}',
338
+ '!**/*.spec.{js,jsx,ts,tsx}',
339
+ ];
340
+
341
+ const defaultPatterns = [
342
+ `${addonBasePath}/**/*.{js,jsx,ts,tsx}`,
343
+ ...excludePatterns,
344
+ ];
345
+
346
+ const ANY_SCRIPT_FILE_REGEX = /\.[jt]sx?$/;
347
+
348
+ const directoryArg = process.argv.find(
349
+ (arg) =>
350
+ !arg.includes(path.sep) &&
351
+ !arg.startsWith('--') &&
352
+ arg !== 'test' &&
353
+ arg !== 'node' &&
354
+ !ANY_SCRIPT_FILE_REGEX.test(arg) &&
355
+ ![
356
+ 'yarn',
357
+ 'npm',
358
+ 'npx',
359
+ 'collectCoverage',
360
+ 'CI',
361
+ 'RAZZLE_JEST_CONFIG',
362
+ ].some(
363
+ (reserved) =>
364
+ arg === reserved || arg.startsWith(reserved.split('=')[0] + '='),
365
+ ) &&
366
+ process.argv.indexOf(arg) >
367
+ process.argv.findIndex((item) => item === 'test'),
368
+ );
369
+
370
+ if (directoryArg) {
371
+ const foundDir = findInAddon(directoryArg, 'd');
372
+ if (foundDir) {
373
+ return [`${foundDir}/**/*.{js,jsx,ts,tsx}`, ...excludePatterns];
374
+ }
375
+ }
376
+
377
+ let testPath = getTestPath();
378
+
379
+ if (!testPath) {
380
+ return defaultPatterns;
381
+ }
382
+
383
+ if (testPath.endsWith(path.sep)) {
384
+ testPath = testPath.slice(0, -1);
385
+ }
386
+
387
+ const stats = getStatSync(testPath);
388
+
389
+ if (stats && stats.isFile()) {
390
+ const implFile = findImplementationFile(testPath);
391
+ if (implFile) {
392
+ return [implFile, '!src/**/*.d.ts'];
393
+ }
394
+ const dirPath = path.dirname(testPath);
395
+ return [`${dirPath}/**/*.{js,jsx,ts,tsx}`, ...excludePatterns];
396
+ } else if (stats && stats.isDirectory()) {
397
+ return [`${testPath}/**/*.{js,jsx,ts,tsx}`, ...excludePatterns];
398
+ }
399
+
400
+ return defaultPatterns;
401
+ };
402
+
403
+ const coverageConfig = getCoveragePatterns();
404
+
3
405
  module.exports = {
4
406
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
5
- collectCoverageFrom: [
6
- 'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
7
- '!src/**/*.d.ts',
407
+ collectCoverageFrom: coverageConfig,
408
+ coveragePathIgnorePatterns: [
409
+ '/node_modules/',
410
+ 'schema\\.[jt]s?$',
411
+ 'index\\.[jt]s?$',
412
+ 'config\\.[jt]sx?$',
8
413
  ],
9
414
  moduleNameMapper: {
10
415
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
@@ -45,7 +450,17 @@ module.exports = {
45
450
  },
46
451
  ...(process.env.JEST_USE_SETUP === 'ON' && {
47
452
  setupFilesAfterEnv: [
48
- '<rootDir>/node_modules/@eeacms/volto-eea-website-theme/jest.setup.js',
453
+ fs.existsSync(
454
+ path.join(
455
+ __dirname,
456
+ 'node_modules',
457
+ '@eeacms',
458
+ addonName,
459
+ 'jest.setup.js',
460
+ ),
461
+ )
462
+ ? `<rootDir>/node_modules/@eeacms/${addonName}/jest.setup.js`
463
+ : `<rootDir>/src/addons/${addonName}/jest.setup.js`,
49
464
  ],
50
465
  }),
51
466
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "3.13.0",
3
+ "version": "3.14.1",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -37,6 +37,7 @@
37
37
  "@plone/scripts": "*",
38
38
  "babel-plugin-transform-class-properties": "^6.24.1",
39
39
  "dotenv": "^16.3.2",
40
+ "fast-glob": "^3.1.1",
40
41
  "husky": "^8.0.3",
41
42
  "jsonwebtoken": "9.0.0",
42
43
  "lint-staged": "^14.0.1",