@centreon/js-config 24.4.1-MON-fix-package-publish.2 → 24.4.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.
@@ -3,6 +3,7 @@ const { defineConfig } = require('cypress');
3
3
  const {
4
4
  addMatchImageSnapshotPlugin
5
5
  } = require('@simonsmith/cypress-image-snapshot/plugin');
6
+ const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
6
7
 
7
8
  module.exports = ({
8
9
  webpackConfig,
@@ -25,6 +26,8 @@ module.exports = ({
25
26
  setupNodeEvents: (on, config) => {
26
27
  addMatchImageSnapshotPlugin(on, config);
27
28
 
29
+ cypressCodeCoverageTask(on, config);
30
+
28
31
  on('before:browser:launch', (browser, launchOptions) => {
29
32
  if (browser.name === 'chrome' && browser.isHeadless) {
30
33
  launchOptions.args.push('--headless=new');
@@ -37,8 +40,17 @@ module.exports = ({
37
40
  supportFile: `${mainCypressFolder}/support/component.tsx`
38
41
  },
39
42
  env: {
40
- ...env,
41
- baseUrl: 'http://localhost:9092'
43
+ baseUrl: 'http://localhost:9092',
44
+ codeCoverage: {
45
+ exclude: [
46
+ 'cypress/**/*.*',
47
+ 'packages/**',
48
+ 'node_modules',
49
+ '**/*.js',
50
+ '**/*.spec.tsx'
51
+ ]
52
+ },
53
+ ...env
42
54
  },
43
55
  reporter: 'mochawesome',
44
56
  reporterOptions: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@centreon/js-config",
3
- "description": "Centreon Frontend shared build configuration ",
4
- "version": "24.4.1-MON-fix-package-publish.2",
3
+ "description": "Centreon Frontend shared build configuration",
4
+ "version": "24.4.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -4,7 +4,7 @@ const excludeNodeModulesExceptCentreonUi =
4
4
  module.exports = {
5
5
  cache: false,
6
6
  excludeNodeModulesExceptCentreonUi,
7
- getModuleConfiguration: (jscTransformConfiguration) => ({
7
+ getModuleConfiguration: (jscTransformConfiguration, enableCoverage) => ({
8
8
  rules: [
9
9
  {
10
10
  parser: { system: false },
@@ -17,6 +17,11 @@ module.exports = {
17
17
  loader: 'swc-loader',
18
18
  options: {
19
19
  jsc: {
20
+ experimental: {
21
+ plugins: [
22
+ enableCoverage && ['swc-plugin-coverage-instrument', {}]
23
+ ].filter(Boolean)
24
+ },
20
25
  parser: {
21
26
  syntax: 'typescript',
22
27
  tsx: true
@@ -13,10 +13,11 @@ const {
13
13
  const getBaseConfiguration = ({
14
14
  moduleName,
15
15
  moduleFederationConfig,
16
- jscTransformConfiguration
16
+ jscTransformConfiguration,
17
+ enableCoverage
17
18
  }) => ({
18
19
  cache,
19
- module: getModuleConfiguration(jscTransformConfiguration),
20
+ module: getModuleConfiguration(jscTransformConfiguration, enableCoverage),
20
21
  optimization,
21
22
  output: {
22
23
  ...output,