@centreon/js-config 25.10.2-dev-25-10-x.0 → 25.11.0

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.
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-namespace */
2
2
  import React from 'react';
3
3
 
4
- import { mount } from 'cypress/react18';
4
+ import { mount } from 'cypress/react';
5
5
  import { equals, isNil } from 'ramda';
6
6
 
7
7
  import { Box, CssBaseline } from '@mui/material';
@@ -6,6 +6,9 @@ const {
6
6
  } = require('@simonsmith/cypress-image-snapshot/plugin');
7
7
  const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
8
8
 
9
+ import fs from 'fs';
10
+ import path from 'path';
11
+
9
12
  module.exports = ({
10
13
  rspackConfig,
11
14
  cypressFolder,
@@ -37,10 +40,43 @@ module.exports = ({
37
40
  launchOptions.args.push('--headless=new');
38
41
  launchOptions.args.push('--force-color-profile=srgb');
39
42
  launchOptions.args.push('--window-size=1400,1200');
43
+ launchOptions.args.push('--max-old-space-size=4096');
44
+ launchOptions.args.push('--disable-dev-shm-usage');
45
+ launchOptions.args.push('--disable-gpu');
46
+ launchOptions.args.push('--no-sandbox');
40
47
  }
41
48
 
42
49
  return launchOptions;
43
50
  });
51
+
52
+ on('after:run', (results) => {
53
+ const testRetries = {};
54
+ if ('runs' in results) {
55
+ results.runs.forEach((run) => {
56
+ run.tests.forEach((test) => {
57
+ if (test.attempts && test.attempts.length > 1 && test.state === 'passed') {
58
+ const testTitle = test.title.join(' > '); // Convert the array to a string
59
+ testRetries[testTitle] = test.attempts.length - 1;
60
+ }
61
+ });
62
+ });
63
+ }
64
+
65
+ // Save the testRetries object to a file in the e2e/results directory
66
+ const resultFilePath = path.join(
67
+ mainCypressFolder,
68
+ 'results',
69
+ 'retries.json'
70
+ );
71
+
72
+ fs.writeFileSync(resultFilePath, JSON.stringify(testRetries, null, 2));
73
+ });
74
+
75
+ on('after:spec', () => {
76
+ if (global.__coverage__) {
77
+ delete global.__coverage__;
78
+ }
79
+ });
44
80
  },
45
81
  specPattern,
46
82
  supportFile: `${mainCypressFolder}/support/component.tsx`
@@ -58,6 +94,7 @@ module.exports = ({
58
94
  },
59
95
  ...env
60
96
  },
97
+ numTestsKeptInMemory: 1,
61
98
  reporter: 'mochawesome',
62
99
  reporterOptions: {
63
100
  html: false,
@@ -66,6 +103,10 @@ module.exports = ({
66
103
  reportDir: `${mainCypressFolder}/results`,
67
104
  reportFilename: '[name]-report.json'
68
105
  },
106
+ retries: {
107
+ openMode: 0,
108
+ runMode: 2
109
+ },
69
110
  video: true,
70
111
  videosFolder: `${mainCypressFolder}/results/videos`,
71
112
  viewportHeight: 590,
@@ -54,6 +54,12 @@ export default ({
54
54
  commandTrimLength: 5000,
55
55
  defaultTrimLength: 5000,
56
56
  });
57
+ on("task", {
58
+ logVersion(message) {
59
+ console.log(`[LOG]: ${message}`);
60
+ return null;
61
+ },
62
+ });
57
63
  await esbuildPreprocessor(on, config);
58
64
  tasks(on);
59
65
 
@@ -65,7 +71,7 @@ export default ({
65
71
  },
66
72
  env: {
67
73
  ...env,
68
- DATABASE_IMAGE: 'bitnami/mariadb:10.11',
74
+ DATABASE_IMAGE: 'bitnamilegacy/mariadb:10.11',
69
75
  OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
70
76
  SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
71
77
  STABILITY: 'unstable',
@@ -19,6 +19,13 @@ interface Containers {
19
19
  [key: string]: StartedTestContainer;
20
20
  }
21
21
 
22
+ class NotFoundContainerError extends Error {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = 'NotFoundContainerError';
26
+ }
27
+ }
28
+
22
29
  export default (on: Cypress.PluginEvents): void => {
23
30
  let dockerEnvironment: StartedDockerComposeEnvironment | null = null;
24
31
  const containers: Containers = {};
@@ -31,7 +38,7 @@ export default (on: Cypress.PluginEvents): void => {
31
38
  } else if (containers[containerName]) {
32
39
  container = containers[containerName];
33
40
  } else {
34
- throw new Error(`Cannot get container ${containerName}`);
41
+ throw new NotFoundContainerError(`Cannot get container ${containerName}`);
35
42
  }
36
43
 
37
44
  return container;
@@ -54,35 +61,6 @@ export default (on: Cypress.PluginEvents): void => {
54
61
  }
55
62
 
56
63
  on("task", {
57
- checkDockerImage: async (params: StartContainerProps) => {
58
- const { image, name } = params;
59
- console.log(`🔍 [checkDockerImage] Checking if image exists: ${image}`);
60
-
61
- if (!image) {
62
- console.error("❌ [checkDockerImage] No image name provided");
63
- return { exists: false, error: "Image name is undefined" };
64
- }
65
-
66
- try {
67
- execSync(`docker image inspect ${image}`, { stdio: "ignore" });
68
- console.log(`✅ [checkDockerImage] Image already exists locally: ${image}`);
69
- return { exists: true, image };
70
- } catch {
71
- console.log(`â„šī¸ [checkDockerImage] Image not found locally, trying to pull...`);
72
-
73
- try {
74
- execSync(`docker pull ${image}`, { stdio: "pipe" });
75
- console.log(`✅ [checkDockerImage] Image successfully pulled: ${image}`);
76
- return { exists: true, image };
77
- } catch (err: unknown) {
78
- const errorMessage =
79
- err instanceof Error ? err.message : JSON.stringify(err);
80
- console.warn(`âš ī¸ [checkDockerImage] Image not found or pull failed: ${errorMessage}`);
81
-
82
- return { exists: false, error: errorMessage, image };
83
- }
84
- }
85
- },
86
64
  copyFromContainer: async ({ destination, serviceName, source }) => {
87
65
  try {
88
66
  const container = getContainer(serviceName);
@@ -97,7 +75,11 @@ export default (on: Cypress.PluginEvents): void => {
97
75
  });
98
76
  });
99
77
  } catch (error) {
100
- console.error(error);
78
+ if (error instanceof NotFoundContainerError) {
79
+ console.log(`Cannot get ${source} from container ${serviceName} because it doesn't exist.`);
80
+ } else {
81
+ console.error(error);
82
+ }
101
83
  }
102
84
 
103
85
  return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@centreon/js-config",
3
3
  "description": "Centreon Frontend shared build configuration",
4
- "version": "25.10.2-dev-25-10-x.0",
4
+ "version": "25.11.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -21,16 +21,16 @@
21
21
  "prettier": "^3.0.0"
22
22
  },
23
23
  "dependencies": {
24
- "@badeball/cypress-cucumber-preprocessor": "^20.1.2",
25
- "@bahmutov/cypress-esbuild-preprocessor": "^2.2.2",
24
+ "@badeball/cypress-cucumber-preprocessor": "^23.2.1",
25
+ "@bahmutov/cypress-esbuild-preprocessor": "^2.2.7",
26
26
  "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
27
27
  "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
28
28
  "@tsconfig/node16": "^16.1.3",
29
29
  "@tsconfig/node20": "^20.1.4",
30
30
  "@types/cypress-cucumber-preprocessor": "^4.0.5",
31
- "cypress": "^13.13.3",
32
- "cypress-multi-reporters": "^1.6.4",
33
- "cypress-terminal-report": "^6.1.2",
31
+ "cypress": "^15.5.0",
32
+ "cypress-multi-reporters": "^2.0.5",
33
+ "cypress-terminal-report": "^7.3.3",
34
34
  "cypress-wait-until": "^3.0.2",
35
35
  "dotenv": "^16.4.5",
36
36
  "esbuild": "^0.21.5",