@centreon/js-config 23.10.14 → 23.10.16
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/cypress/component/configuration.js +2 -10
- package/cypress/e2e/commands.ts +20 -110
- package/cypress/e2e/configuration.ts +1 -1
- package/eslint/base.typescript.eslintrc.js +3 -15
- package/jest/index.js +1 -5
- package/package.json +1 -3
- package/tsconfig/index.json +4 -5
- package/webpack/base/index.js +57 -14
- package/eslint/lambda/typescript.eslintrc.js +0 -48
- package/jest/lambda/typescript.js +0 -49
- package/tsconfig/lambda/tsconfig.json +0 -14
- package/webpack/base/globalConfig.js +0 -71
|
@@ -4,24 +4,16 @@ const {
|
|
|
4
4
|
addMatchImageSnapshotPlugin
|
|
5
5
|
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
6
6
|
|
|
7
|
-
module.exports = ({
|
|
8
|
-
webpackConfig,
|
|
9
|
-
cypressFolder,
|
|
10
|
-
specPattern,
|
|
11
|
-
env,
|
|
12
|
-
useVite = false,
|
|
13
|
-
excludeSpecPattern
|
|
14
|
-
}) => {
|
|
7
|
+
module.exports = ({ webpackConfig, cypressFolder, specPattern, env }) => {
|
|
15
8
|
const mainCypressFolder = cypressFolder || 'cypress';
|
|
16
9
|
|
|
17
10
|
return defineConfig({
|
|
18
11
|
component: {
|
|
19
12
|
devServer: {
|
|
20
|
-
bundler:
|
|
13
|
+
bundler: 'webpack',
|
|
21
14
|
framework: 'react',
|
|
22
15
|
webpackConfig
|
|
23
16
|
},
|
|
24
|
-
excludeSpecPattern,
|
|
25
17
|
setupNodeEvents: (on, config) => {
|
|
26
18
|
addMatchImageSnapshotPlugin(on, config);
|
|
27
19
|
},
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -4,8 +4,6 @@ import './commands/configuration';
|
|
|
4
4
|
|
|
5
5
|
const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
|
|
6
6
|
|
|
7
|
-
const artifactIllegalCharactersMatcher = /[,\s/|<>*?:"]/g;
|
|
8
|
-
|
|
9
7
|
Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
|
|
10
8
|
return cy
|
|
11
9
|
.exec(
|
|
@@ -23,7 +21,7 @@ Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
|
|
|
23
21
|
|
|
24
22
|
Cypress.Commands.add('getIframeBody', (): Cypress.Chainable => {
|
|
25
23
|
return cy
|
|
26
|
-
.get('iframe#main-content'
|
|
24
|
+
.get('iframe#main-content')
|
|
27
25
|
.its('0.contentDocument.body')
|
|
28
26
|
.should('not.be.empty')
|
|
29
27
|
.then(cy.wrap);
|
|
@@ -39,13 +37,6 @@ Cypress.Commands.add(
|
|
|
39
37
|
}
|
|
40
38
|
);
|
|
41
39
|
|
|
42
|
-
Cypress.Commands.add(
|
|
43
|
-
'clickSubRootMenuItem',
|
|
44
|
-
(page: string): Cypress.Chainable => {
|
|
45
|
-
return cy.get('div[data-cy="collapse"]').eq(1).contains(page).click();
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
40
|
interface NavigateToProps {
|
|
50
41
|
page: string;
|
|
51
42
|
rootItemNumber: number;
|
|
@@ -58,8 +49,8 @@ Cypress.Commands.add(
|
|
|
58
49
|
if (subMenu) {
|
|
59
50
|
cy.hoverRootMenuItem(rootItemNumber)
|
|
60
51
|
.contains(subMenu)
|
|
61
|
-
.trigger('mouseover');
|
|
62
|
-
cy.
|
|
52
|
+
.trigger('mouseover', { force: true });
|
|
53
|
+
cy.contains(page).click({ force: true });
|
|
63
54
|
|
|
64
55
|
return;
|
|
65
56
|
}
|
|
@@ -92,35 +83,29 @@ Cypress.Commands.add(
|
|
|
92
83
|
|
|
93
84
|
interface CopyFromContainerProps {
|
|
94
85
|
destination: string;
|
|
95
|
-
name?: string;
|
|
96
86
|
source: string;
|
|
97
87
|
}
|
|
98
88
|
|
|
99
89
|
Cypress.Commands.add(
|
|
100
90
|
'copyFromContainer',
|
|
101
|
-
({
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}: CopyFromContainerProps) => {
|
|
106
|
-
return cy.exec(`docker cp ${name}:${source} "${destination}"`);
|
|
91
|
+
({ source, destination }: CopyFromContainerProps) => {
|
|
92
|
+
return cy.exec(
|
|
93
|
+
`docker cp ${Cypress.env('dockerName')}:${source} "${destination}"`
|
|
94
|
+
);
|
|
107
95
|
}
|
|
108
96
|
);
|
|
109
97
|
|
|
110
98
|
interface CopyToContainerProps {
|
|
111
99
|
destination: string;
|
|
112
|
-
name?: string;
|
|
113
100
|
source: string;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
103
|
Cypress.Commands.add(
|
|
117
104
|
'copyToContainer',
|
|
118
|
-
({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}: CopyToContainerProps) => {
|
|
123
|
-
return cy.exec(`docker cp ${source} ${name}:${destination}`);
|
|
105
|
+
({ source, destination }: CopyToContainerProps) => {
|
|
106
|
+
return cy.exec(
|
|
107
|
+
`docker cp ${source} ${Cypress.env('dockerName')}:${destination}`
|
|
108
|
+
);
|
|
124
109
|
}
|
|
125
110
|
);
|
|
126
111
|
|
|
@@ -211,9 +196,7 @@ Cypress.Commands.add(
|
|
|
211
196
|
'startContainer',
|
|
212
197
|
({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
|
|
213
198
|
return cy
|
|
214
|
-
.exec(`docker image inspect ${image} || docker pull ${image}
|
|
215
|
-
timeout: 120000
|
|
216
|
-
})
|
|
199
|
+
.exec(`docker image inspect ${image} || docker pull ${image}`)
|
|
217
200
|
.task('startContainer', { image, name, portBindings });
|
|
218
201
|
}
|
|
219
202
|
);
|
|
@@ -229,7 +212,7 @@ Cypress.Commands.add(
|
|
|
229
212
|
'startWebContainer',
|
|
230
213
|
({
|
|
231
214
|
name = Cypress.env('dockerName'),
|
|
232
|
-
os =
|
|
215
|
+
os = 'alma9',
|
|
233
216
|
useSlim = true,
|
|
234
217
|
version = Cypress.env('WEB_IMAGE_VERSION')
|
|
235
218
|
}: StartWebContainerProps = {}): Cypress.Chainable => {
|
|
@@ -266,47 +249,25 @@ Cypress.Commands.add(
|
|
|
266
249
|
({
|
|
267
250
|
name = Cypress.env('dockerName')
|
|
268
251
|
}: StopWebContainerProps = {}): Cypress.Chainable => {
|
|
269
|
-
const logDirectory = `cypress/results/logs/${
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
)}/${Cypress.currentTest.title.replace(
|
|
273
|
-
artifactIllegalCharactersMatcher,
|
|
274
|
-
'_'
|
|
275
|
-
)}`;
|
|
252
|
+
const logDirectory = `cypress/results/logs/${
|
|
253
|
+
Cypress.spec.name
|
|
254
|
+
}/${Cypress.currentTest.title.replace(/,|\s|\//g, '_')}`;
|
|
276
255
|
|
|
277
256
|
return cy
|
|
278
257
|
.visitEmptyPage()
|
|
279
258
|
.exec(`mkdir -p "${logDirectory}"`)
|
|
280
259
|
.copyFromContainer({
|
|
281
260
|
destination: `${logDirectory}/broker`,
|
|
282
|
-
name,
|
|
283
261
|
source: '/var/log/centreon-broker'
|
|
284
262
|
})
|
|
285
263
|
.copyFromContainer({
|
|
286
264
|
destination: `${logDirectory}/engine`,
|
|
287
|
-
name,
|
|
288
265
|
source: '/var/log/centreon-engine'
|
|
289
266
|
})
|
|
290
267
|
.copyFromContainer({
|
|
291
268
|
destination: `${logDirectory}/centreon`,
|
|
292
|
-
name,
|
|
293
269
|
source: '/var/log/centreon'
|
|
294
270
|
})
|
|
295
|
-
.then(() => {
|
|
296
|
-
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
|
297
|
-
return cy.copyFromContainer({
|
|
298
|
-
destination: `${logDirectory}/php`,
|
|
299
|
-
name,
|
|
300
|
-
source: '/var/log/php-fpm'
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return cy.copyFromContainer({
|
|
305
|
-
destination: `${logDirectory}/php8.1-fpm-centreon-error.log`,
|
|
306
|
-
name,
|
|
307
|
-
source: '/var/log/php8.1-fpm-centreon-error.log'
|
|
308
|
-
});
|
|
309
|
-
})
|
|
310
271
|
.stopContainer({ name });
|
|
311
272
|
}
|
|
312
273
|
);
|
|
@@ -320,11 +281,10 @@ Cypress.Commands.add(
|
|
|
320
281
|
({ name }: StopContainerProps): Cypress.Chainable => {
|
|
321
282
|
cy.exec(`docker logs ${name}`).then(({ stdout }) => {
|
|
322
283
|
cy.writeFile(
|
|
323
|
-
`cypress/results/logs/${
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
artifactIllegalCharactersMatcher,
|
|
284
|
+
`cypress/results/logs/${
|
|
285
|
+
Cypress.spec.name
|
|
286
|
+
}/${Cypress.currentTest.title.replace(
|
|
287
|
+
/,|\s|\//g,
|
|
328
288
|
'_'
|
|
329
289
|
)}/container-${name}.log`,
|
|
330
290
|
stdout
|
|
@@ -335,56 +295,9 @@ Cypress.Commands.add(
|
|
|
335
295
|
}
|
|
336
296
|
);
|
|
337
297
|
|
|
338
|
-
interface Dashboard {
|
|
339
|
-
description?: string;
|
|
340
|
-
name: string;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
Cypress.Commands.add(
|
|
344
|
-
'insertDashboardList',
|
|
345
|
-
(fixtureFile: string): Cypress.Chainable => {
|
|
346
|
-
return cy.fixture(fixtureFile).then((dashboardList) => {
|
|
347
|
-
cy.wrap(
|
|
348
|
-
Promise.all(
|
|
349
|
-
dashboardList.map((dashboardBody: Dashboard) =>
|
|
350
|
-
cy.insertDashboard({ ...dashboardBody })
|
|
351
|
-
)
|
|
352
|
-
)
|
|
353
|
-
);
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
Cypress.Commands.add(
|
|
359
|
-
'insertDashboard',
|
|
360
|
-
(dashboardBody: Dashboard): Cypress.Chainable => {
|
|
361
|
-
return cy.request({
|
|
362
|
-
body: {
|
|
363
|
-
...dashboardBody
|
|
364
|
-
},
|
|
365
|
-
method: 'POST',
|
|
366
|
-
url: '/centreon/api/latest/configuration/dashboards'
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
|
|
371
|
-
Cypress.Commands.add('getTimeFromHeader', (): Cypress.Chainable => {
|
|
372
|
-
return cy.waitUntil(() => {
|
|
373
|
-
return cy.get('header div[data-cy="clock"]').then(($time) => {
|
|
374
|
-
const headerTime = $time.children()[1].textContent;
|
|
375
|
-
if (headerTime?.match(/\d+:\d+/)) {
|
|
376
|
-
return headerTime;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return false;
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
|
|
384
298
|
declare global {
|
|
385
299
|
namespace Cypress {
|
|
386
300
|
interface Chainable {
|
|
387
|
-
clickSubRootMenuItem: (page: string) => Cypress.Chainable;
|
|
388
301
|
copyFromContainer: (props: CopyFromContainerProps) => Cypress.Chainable;
|
|
389
302
|
copyToContainer: (props: CopyToContainerProps) => Cypress.Chainable;
|
|
390
303
|
execInContainer: ({
|
|
@@ -392,11 +305,8 @@ declare global {
|
|
|
392
305
|
name
|
|
393
306
|
}: ExecInContainerProps) => Cypress.Chainable;
|
|
394
307
|
getIframeBody: () => Cypress.Chainable;
|
|
395
|
-
getTimeFromHeader: () => Cypress.Chainable;
|
|
396
308
|
getWebVersion: () => Cypress.Chainable;
|
|
397
309
|
hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
|
|
398
|
-
insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
|
|
399
|
-
insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
|
|
400
310
|
loginByTypeOfUser: ({
|
|
401
311
|
jsonName = 'admin',
|
|
402
312
|
loginViaApi = false
|
|
@@ -21,15 +21,11 @@ module.exports = {
|
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
'@typescript-eslint/camelcase': 'off',
|
|
24
|
-
'@typescript-eslint/consistent-type-definitions': [
|
|
25
|
-
'@typescript-eslint/explicit-function-return-type': [
|
|
24
|
+
'@typescript-eslint/consistent-type-definitions': [
|
|
26
25
|
'error',
|
|
27
|
-
|
|
28
|
-
allowExpressions: true,
|
|
29
|
-
allowHigherOrderFunctions: true,
|
|
30
|
-
allowTypedFunctionExpressions: true
|
|
31
|
-
}
|
|
26
|
+
'interface'
|
|
32
27
|
],
|
|
28
|
+
'@typescript-eslint/explicit-function-return-type': ['error'],
|
|
33
29
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
34
30
|
'error',
|
|
35
31
|
{
|
|
@@ -80,21 +76,13 @@ module.exports = {
|
|
|
80
76
|
}
|
|
81
77
|
],
|
|
82
78
|
camelcase: 'off',
|
|
83
|
-
'import/no-cycle': 'off',
|
|
84
|
-
'import/no-named-as-default': 'warn',
|
|
85
79
|
'no-shadow': 'off',
|
|
86
80
|
'no-unused-expressions': 'off'
|
|
87
81
|
},
|
|
88
82
|
settings: {
|
|
89
|
-
'import/parsers': {
|
|
90
|
-
'@typescript-eslint/parser': ['.ts', '.tsx']
|
|
91
|
-
},
|
|
92
83
|
'import/resolver': {
|
|
93
84
|
alias: {
|
|
94
85
|
extensions: ['.ts', '.tsx', '.js', '.jsx']
|
|
95
|
-
},
|
|
96
|
-
typescript: {
|
|
97
|
-
alwaysTryTypes: true
|
|
98
86
|
}
|
|
99
87
|
}
|
|
100
88
|
}
|
package/jest/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
moduleNameMapper: {
|
|
3
3
|
'\\.(s?css|png|svg|jpg)$': 'identity-obj-proxy',
|
|
4
|
-
'^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
|
|
5
|
-
'jest-transform-stub',
|
|
6
4
|
'^react($|/.+)': '<rootDir>/node_modules/react$1'
|
|
7
5
|
},
|
|
8
6
|
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
9
7
|
testEnvironment: 'jsdom',
|
|
10
|
-
testPathIgnorePatterns: ['/node_modules/'
|
|
8
|
+
testPathIgnorePatterns: ['/node_modules/'],
|
|
11
9
|
transform: {
|
|
12
|
-
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
|
|
13
|
-
'jest-transform-stub',
|
|
14
10
|
'^.+\\.[jt]sx?$': [
|
|
15
11
|
'@swc/jest',
|
|
16
12
|
{
|
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.
|
|
4
|
+
"version": "23.10.16",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@badeball/cypress-cucumber-preprocessor": "^14.0.0",
|
|
20
|
-
"@tsconfig/node16": "^1.0.4",
|
|
21
20
|
"@types/dockerode": "^3.3.16",
|
|
22
21
|
"dockerode": "^3.3.5",
|
|
23
22
|
"eslint": "^8.17.0",
|
|
24
23
|
"eslint-config-airbnb": "19.0.4",
|
|
25
24
|
"eslint-config-prettier": "^8.5.0",
|
|
26
25
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
27
|
-
"eslint-import-resolver-typescript": "^3.5.5",
|
|
28
26
|
"eslint-plugin-babel": "^5.3.1",
|
|
29
27
|
"eslint-plugin-hooks": "^0.4.3",
|
|
30
28
|
"eslint-plugin-import": "^2.26.0",
|
package/tsconfig/index.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"moduleResolution": "
|
|
3
|
+
"moduleResolution": "node",
|
|
4
4
|
"downlevelIteration": true,
|
|
5
|
-
"module": "
|
|
6
|
-
"target": "
|
|
5
|
+
"module": "es6",
|
|
6
|
+
"target": "es6",
|
|
7
7
|
"jsx": "react-jsx",
|
|
8
8
|
"strict": true,
|
|
9
9
|
"noImplicitAny": false,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true
|
|
12
|
-
"resolveJsonModule": true
|
|
11
|
+
"esModuleInterop": true
|
|
13
12
|
}
|
|
14
13
|
}
|
package/webpack/base/index.js
CHANGED
|
@@ -3,22 +3,68 @@ const path = require('path');
|
|
|
3
3
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
4
4
|
const { ModuleFederationPlugin } = require('webpack').container;
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
optimization,
|
|
9
|
-
output,
|
|
10
|
-
cache
|
|
11
|
-
} = require('./globalConfig');
|
|
6
|
+
const excludeNodeModulesExceptCentreonUi =
|
|
7
|
+
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
|
|
12
8
|
|
|
13
9
|
const getBaseConfiguration = ({
|
|
14
10
|
moduleName,
|
|
15
11
|
moduleFederationConfig,
|
|
16
12
|
jscTransformConfiguration
|
|
17
13
|
}) => ({
|
|
18
|
-
cache,
|
|
19
|
-
module:
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
cache: false,
|
|
15
|
+
module: {
|
|
16
|
+
rules: [
|
|
17
|
+
{
|
|
18
|
+
parser: { system: false },
|
|
19
|
+
test: /\.[cm]?(j|t)sx?$/
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
23
|
+
test: /\.[jt]sx?$/,
|
|
24
|
+
use: {
|
|
25
|
+
loader: 'swc-loader',
|
|
26
|
+
options: {
|
|
27
|
+
jsc: {
|
|
28
|
+
parser: {
|
|
29
|
+
syntax: 'typescript',
|
|
30
|
+
tsx: true
|
|
31
|
+
},
|
|
32
|
+
transform: jscTransformConfiguration
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
test: /\.icon.svg$/,
|
|
39
|
+
use: ['@svgr/webpack']
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
exclude: excludeNodeModulesExceptCentreonUi,
|
|
43
|
+
test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
|
|
44
|
+
use: [
|
|
45
|
+
{
|
|
46
|
+
loader: 'url-loader',
|
|
47
|
+
options: {
|
|
48
|
+
limit: 10000,
|
|
49
|
+
name: '[name].[hash:8].[ext]'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
optimization: {
|
|
57
|
+
splitChunks: {
|
|
58
|
+
chunks: 'all',
|
|
59
|
+
maxSize: 400 * 1024
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
output: {
|
|
63
|
+
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
64
|
+
filename: '[name].[chunkhash:8].js',
|
|
65
|
+
libraryTarget: 'umd',
|
|
66
|
+
umdNamedDefine: true
|
|
67
|
+
},
|
|
22
68
|
plugins: [
|
|
23
69
|
new CleanWebpackPlugin(),
|
|
24
70
|
moduleName &&
|
|
@@ -75,10 +121,7 @@ const getBaseConfiguration = ({
|
|
|
75
121
|
].filter(Boolean),
|
|
76
122
|
resolve: {
|
|
77
123
|
alias: {
|
|
78
|
-
react: path.resolve('./node_modules/react')
|
|
79
|
-
'@centreon/ui/fonts': path.resolve(
|
|
80
|
-
'./node_modules/@centreon/ui/public/fonts'
|
|
81
|
-
)
|
|
124
|
+
react: path.resolve('./node_modules/react')
|
|
82
125
|
},
|
|
83
126
|
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
|
84
127
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [ '../node/typescript.eslintrc.js'],
|
|
3
|
-
overrides: [
|
|
4
|
-
{
|
|
5
|
-
files: ["*.spec.js", "*.test.ts", "*.tests.ts"],
|
|
6
|
-
rules: {
|
|
7
|
-
"import/first": 0,
|
|
8
|
-
"import/order": 0,
|
|
9
|
-
"@typescript-eslint/ban-ts-comment": 0,
|
|
10
|
-
"@typescript-eslint/no-explicit-any": 0
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
rules: {
|
|
15
|
-
"import/extensions": ["off"],
|
|
16
|
-
"no-console": "off",
|
|
17
|
-
"no-underscore-dangle": "off",
|
|
18
|
-
"class-methods-use-this": "off",
|
|
19
|
-
"@typescript-eslint/naming-convention": [
|
|
20
|
-
"error",
|
|
21
|
-
{
|
|
22
|
-
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
23
|
-
selector: "variable"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
filter: {
|
|
27
|
-
match: false,
|
|
28
|
-
regex: "(__esModule|.+-.+)"
|
|
29
|
-
},
|
|
30
|
-
format: ["snake_case", "camelCase", "PascalCase", "UPPER_CASE"],
|
|
31
|
-
selector: "property",
|
|
32
|
-
leadingUnderscore: "allow"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
filter: {
|
|
36
|
-
match: false,
|
|
37
|
-
regex: "^_$"
|
|
38
|
-
},
|
|
39
|
-
format: ["snake_case", "camelCase", "PascalCase"],
|
|
40
|
-
selector: "parameter"
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"@typescript-eslint/require-array-sort-compare": "error"
|
|
44
|
-
},
|
|
45
|
-
parserOptions: {
|
|
46
|
-
project: ["./tsconfig.json"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Centreon Team
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
18
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
19
|
-
const path = require('path');
|
|
20
|
-
|
|
21
|
-
const rootPath = path.join(__dirname);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
module.exports = {
|
|
26
|
-
rootDir: rootPath,
|
|
27
|
-
// Automatically clear mock calls and instances between every test
|
|
28
|
-
clearMocks: true,
|
|
29
|
-
// The directory where Jest should output its coverage files
|
|
30
|
-
coverageDirectory: '<rootDir>/coverage',
|
|
31
|
-
// An array of regexp pattern strings used to skip coverage collection
|
|
32
|
-
coveragePathIgnorePatterns: ['\\\\node_modules\\\\', 'tests'],
|
|
33
|
-
|
|
34
|
-
// An array of file extensions your modules use
|
|
35
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
36
|
-
|
|
37
|
-
// Automatically reset mock state between every test
|
|
38
|
-
// resetMocks: true,
|
|
39
|
-
|
|
40
|
-
testMatch: ['**/*.(test|tests|spec|specs).+(ts|tsx|js)'],
|
|
41
|
-
|
|
42
|
-
// This option allows the use of a custom results processor
|
|
43
|
-
// testResultsProcessor: 'jest-sonar-reporter',
|
|
44
|
-
|
|
45
|
-
// A map from regular expressions to paths to transformers
|
|
46
|
-
transform: {
|
|
47
|
-
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const excludeNodeModulesExceptCentreonUi =
|
|
2
|
-
/node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
cache: false,
|
|
6
|
-
excludeNodeModulesExceptCentreonUi,
|
|
7
|
-
getModuleConfiguration: (jscTransformConfiguration) => ({
|
|
8
|
-
rules: [
|
|
9
|
-
{
|
|
10
|
-
parser: { system: false },
|
|
11
|
-
test: /\.[cm]?(j|t)sx?$/
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
exclude: [excludeNodeModulesExceptCentreonUi],
|
|
15
|
-
test: /\.[jt]sx?$/,
|
|
16
|
-
use: {
|
|
17
|
-
loader: 'swc-loader',
|
|
18
|
-
options: {
|
|
19
|
-
jsc: {
|
|
20
|
-
parser: {
|
|
21
|
-
syntax: 'typescript',
|
|
22
|
-
tsx: true
|
|
23
|
-
},
|
|
24
|
-
transform: jscTransformConfiguration
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
test: /\.icon.svg$/,
|
|
31
|
-
use: ['@svgr/webpack']
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
exclude: excludeNodeModulesExceptCentreonUi,
|
|
35
|
-
test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
|
|
36
|
-
use: [
|
|
37
|
-
{
|
|
38
|
-
loader: 'url-loader',
|
|
39
|
-
options: {
|
|
40
|
-
limit: 10000,
|
|
41
|
-
name: '[name].[hash:8].[ext]'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
generator: {
|
|
48
|
-
filename: '[name][ext]'
|
|
49
|
-
},
|
|
50
|
-
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
51
|
-
type: 'asset/resource'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
test: /\.css$/i,
|
|
55
|
-
use: ['style-loader', 'css-loader']
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}),
|
|
59
|
-
optimization: {
|
|
60
|
-
splitChunks: {
|
|
61
|
-
chunks: 'all',
|
|
62
|
-
maxSize: 400 * 1024
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
output: {
|
|
66
|
-
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
67
|
-
filename: '[name].[chunkhash:8].js',
|
|
68
|
-
libraryTarget: 'umd',
|
|
69
|
-
umdNamedDefine: true
|
|
70
|
-
}
|
|
71
|
-
};
|