@centreon/js-config 23.10.1-MON-24518-status-grid.6 → 23.10.1-MON-integrate-cypress-code-coverage.22
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.
|
@@ -141,10 +141,8 @@ Cypress.Commands.add(
|
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
143
|
|
|
144
|
-
Cypress.Commands.add('adjustViewport', () => cy.viewport(1280, 590));
|
|
145
|
-
|
|
146
144
|
Cypress.Commands.add('makeSnapshot', (title?: string) => {
|
|
147
|
-
cy.
|
|
145
|
+
cy.viewport(1280, 590);
|
|
148
146
|
cy.matchImageSnapshot(title);
|
|
149
147
|
});
|
|
150
148
|
|
|
@@ -157,7 +155,6 @@ Cypress.Commands.add('cssDisableMotion', (): void => {
|
|
|
157
155
|
declare global {
|
|
158
156
|
namespace Cypress {
|
|
159
157
|
interface Chainable {
|
|
160
|
-
adjustViewport: () => Cypress.Chainable;
|
|
161
158
|
cssDisableMotion: () => Cypress.Chainable;
|
|
162
159
|
interceptAPIRequest: <T extends object>(
|
|
163
160
|
props: InterceptAPIRequestProps<T>
|
|
@@ -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
|
-
|
|
41
|
-
|
|
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: {
|
|
@@ -49,8 +61,6 @@ module.exports = ({
|
|
|
49
61
|
reportFilename: '[name]-report.json'
|
|
50
62
|
},
|
|
51
63
|
video: true,
|
|
52
|
-
videosFolder: `${mainCypressFolder}/results/videos
|
|
53
|
-
viewportHeight: 590,
|
|
54
|
-
viewportWidth: 1280
|
|
64
|
+
videosFolder: `${mainCypressFolder}/results/videos`
|
|
55
65
|
});
|
|
56
66
|
};
|
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": "23.10.1-MON-
|
|
4
|
+
"version": "23.10.1-MON-integrate-cypress-code-coverage.22",
|
|
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
|
package/webpack/base/index.js
CHANGED
|
@@ -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,
|
|
@@ -33,7 +34,6 @@ const getBaseConfiguration = ({
|
|
|
33
34
|
shared: [
|
|
34
35
|
{
|
|
35
36
|
'@centreon/ui-context': {
|
|
36
|
-
requiredVersion: '24.x',
|
|
37
37
|
singleton: true
|
|
38
38
|
}
|
|
39
39
|
},
|