@centreon/js-config 24.6.2 → 24.6.3

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.
@@ -48,7 +48,8 @@ export default ({
48
48
  reporterOptions: {
49
49
  configFile: `${__dirname}/reporter-config.js`
50
50
  },
51
- setupNodeEvents: async (on, config) => {
51
+ setupNodeEvents: async (cypressOn, config) => {
52
+ const on = require('cypress-on-fix')(cypressOn)
52
53
  installLogsPrinter(on);
53
54
  await esbuildPreprocessor(on, config);
54
55
  tasks(on);
@@ -67,9 +68,11 @@ export default ({
67
68
  WEB_IMAGE_VERSION: webImageVersion
68
69
  },
69
70
  execTimeout: 60000,
70
- experimentalMemoryManagement: true,
71
71
  requestTimeout: 20000,
72
- retries: 0,
72
+ retries: {
73
+ openMode: 0,
74
+ runMode: 2
75
+ },
73
76
  screenshotsFolder: `${resultsFolder}/screenshots`,
74
77
  video: isDevelopment,
75
78
  videoCompression: 0,
@@ -3,6 +3,9 @@
3
3
  /* eslint-disable @typescript-eslint/no-var-requires */
4
4
  /* eslint-disable no-param-reassign */
5
5
 
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+
6
9
  export default (
7
10
  on: Cypress.PluginEvents,
8
11
  config: Cypress.PluginConfigOptions
@@ -32,5 +35,38 @@ export default (
32
35
  return launchOptions;
33
36
  });
34
37
 
38
+ on('after:run', (results) => {
39
+ const testRetries: { [key: string]: boolean } = {};
40
+ if ('runs' in results) {
41
+ results.runs.forEach((run) => {
42
+ run.tests.forEach((test) => {
43
+ if (test.attempts && test.attempts.length > 1) {
44
+ const testTitle = test.title.join(' > '); // Convert the array to a string
45
+ testRetries[testTitle] = true;
46
+ }
47
+ });
48
+ });
49
+ }
50
+
51
+ console.log('After run results:', results);
52
+ console.log('Test retries:', testRetries);
53
+
54
+ // Save the testRetries object to a file in the e2e/results directory
55
+ const resultFilePath = path.join(
56
+ __dirname,
57
+ '../../../../tests/e2e/results',
58
+ 'hasRetries.json'
59
+ );
60
+ if (results.totalFailed > 0) {
61
+ fs.writeFileSync(resultFilePath, '{}');
62
+ } else if (Object.keys(testRetries).length > 0) {
63
+ // If tests succeeded but there were retries, write the retries to the file
64
+ fs.writeFileSync(resultFilePath, JSON.stringify(testRetries, null, 2));
65
+ } else {
66
+ // If no retries, empty the file
67
+ fs.writeFileSync(resultFilePath, '{}');
68
+ }
69
+ });
70
+
35
71
  return config;
36
72
  };
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": "24.6.2",
4
+ "version": "24.6.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"