@o3r/testing 11.5.0-prerelease.5 → 11.5.0-prerelease.50

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Prepare css rule to hide specific blocks
3
+ *
4
+ * Should be called only once during the visual test.
5
+ * @note: this function is evaluated in the context of the page and should not use external variables
6
+ * @param ignoreClass
7
+ */
8
+ export declare function prepareVisualTesting(ignoreClass?: string): void;
9
+ /**
10
+ * Determine if the visual testing is enabled
11
+ */
12
+ export declare function isVisualTestingEnabled(): boolean;
13
+ /**
14
+ * Toggle the visual testing view : if it is active, will hide tagged components as grey blocks.
15
+ * @note: this function is evaluated in the context of the page and cannot use external code
16
+ * @param enabled
17
+ */
18
+ export declare function toggleVisualTestingRender(enabled: boolean): void;
19
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/visual-test/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,SAAe,QAkB9D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,YAGrC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,QAOzD"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Prepare css rule to hide specific blocks
3
+ *
4
+ * Should be called only once during the visual test.
5
+ * @note: this function is evaluated in the context of the page and should not use external variables
6
+ * @param ignoreClass
7
+ */
8
+ export function prepareVisualTesting(ignoreClass = 'e2e-ignore') {
9
+ const visualTestingCss = document.createElement('style');
10
+ const visualTestingClass = 'visual-testing-render';
11
+ visualTestingCss.textContent = `
12
+ .${visualTestingClass} .${ignoreClass} {position: relative;}
13
+
14
+ .${visualTestingClass} .${ignoreClass}:before {
15
+ z-index: 999;
16
+ content: '';
17
+ width: 100%;
18
+ height: 100%;
19
+ background: grey;
20
+ position: absolute;
21
+ left: 0;
22
+ top: 0;
23
+ }`;
24
+ document.head.appendChild(visualTestingCss);
25
+ }
26
+ /**
27
+ * Determine if the visual testing is enabled
28
+ */
29
+ export function isVisualTestingEnabled() {
30
+ const visualTestingClass = 'visual-testing-render';
31
+ return document.body.classList.contains(visualTestingClass);
32
+ }
33
+ /**
34
+ * Toggle the visual testing view : if it is active, will hide tagged components as grey blocks.
35
+ * @note: this function is evaluated in the context of the page and cannot use external code
36
+ * @param enabled
37
+ */
38
+ export function toggleVisualTestingRender(enabled) {
39
+ const visualTestingClass = 'visual-testing-render';
40
+ if (enabled) {
41
+ document.body.classList.add(visualTestingClass);
42
+ }
43
+ else {
44
+ document.body.classList.remove(visualTestingClass);
45
+ }
46
+ }
47
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/visual-test/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAW,GAAG,YAAY;IAC7D,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;IACnD,gBAAgB,CAAC,WAAW,GAAG;OAC1B,kBAAkB,KAAK,WAAW;;OAElC,kBAAkB,KAAK,WAAW;;;;;;;;;IASrC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;IACnD,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;IACnD,IAAI,OAAO,EAAE,CAAC;QACZ,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/testing",
3
- "version": "11.5.0-prerelease.5",
3
+ "version": "11.5.0-prerelease.50",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,8 @@
21
21
  "prepare:build:builders": "yarn cpy 'schematics/**/*.json' 'schematics/**/templates/**' dist/schematics && yarn cpy '{collection,migration}.json' dist",
22
22
  "prepare:publish": "prepare-publish ./dist",
23
23
  "build:schematics": "tsc -b tsconfig.schematics.json --pretty && yarn generate-cjs-manifest",
24
- "build:tools": "tsc -b tsconfig.tools.json --pretty",
24
+ "build:tools": "tsc -b tsconfig.build.tools.json --pretty",
25
+ "build:utils": "tsc -b tsconfig.build.utils.json --pretty && node ./scripts/generate-esm-manifest.cjs",
25
26
  "postbuild": "patch-package-json-main"
26
27
  },
27
28
  "exports": {
@@ -90,11 +91,13 @@
90
91
  },
91
92
  "./visual-test/utils": {
92
93
  "types": "./visual-test/utils.d.ts",
93
- "default": "./visual-test/utils.js"
94
+ "default": "./visual-test/utils.js",
95
+ "import": "./esm/visual-test/utils.js"
94
96
  }
95
97
  },
96
98
  "peerDependencies": {
97
99
  "@amadeus-it-group/kassette": "^1.7.0",
100
+ "@angular-devkit/core": "~18.2.0",
98
101
  "@angular-devkit/schematics": "~18.2.0",
99
102
  "@angular/animations": "~18.2.0",
100
103
  "@angular/cli": "~18.2.0",
@@ -105,9 +108,9 @@
105
108
  "@material/slider": "^14.0.0",
106
109
  "@ngrx/store": "~18.0.0",
107
110
  "@ngx-translate/core": "~15.0.0",
108
- "@o3r/core": "^11.5.0-prerelease.5",
109
- "@o3r/localization": "^11.5.0-prerelease.5",
110
- "@o3r/schematics": "^11.5.0-prerelease.5",
111
+ "@o3r/core": "^11.5.0-prerelease.50",
112
+ "@o3r/localization": "^11.5.0-prerelease.50",
113
+ "@o3r/schematics": "^11.5.0-prerelease.50",
111
114
  "@playwright/test": "~1.48.0",
112
115
  "@schematics/angular": "~18.2.0",
113
116
  "pixelmatch": "^5.2.1",
@@ -115,12 +118,16 @@
115
118
  "protractor": "^7.0.0",
116
119
  "rxjs": "^7.8.1",
117
120
  "temporal-polyfill": "^0.2.0",
121
+ "type-fest": "^4.10.2",
118
122
  "typescript": "~5.5.4"
119
123
  },
120
124
  "peerDependenciesMeta": {
121
125
  "@amadeus-it-group/kassette": {
122
126
  "optional": true
123
127
  },
128
+ "@angular-devkit/core": {
129
+ "optional": true
130
+ },
124
131
  "@angular-devkit/schematics": {
125
132
  "optional": true
126
133
  },
@@ -159,6 +166,9 @@
159
166
  },
160
167
  "temporal-polyfill": {
161
168
  "optional": true
169
+ },
170
+ "type-fest": {
171
+ "optional": true
162
172
  }
163
173
  },
164
174
  "dependencies": {
@@ -180,20 +190,20 @@
180
190
  "@angular/forms": "~18.2.0",
181
191
  "@angular/platform-browser": "~18.2.0",
182
192
  "@angular/platform-browser-dynamic": "~18.2.0",
183
- "@babel/core": "~7.25.0",
184
- "@babel/preset-typescript": "~7.25.0",
193
+ "@babel/core": "~7.26.0",
194
+ "@babel/preset-typescript": "~7.26.0",
185
195
  "@compodoc/compodoc": "^1.1.19",
186
196
  "@material/slider": "^14.0.0",
187
197
  "@ngrx/store": "~18.0.0",
188
198
  "@ngx-translate/core": "~15.0.0",
189
199
  "@nx/eslint-plugin": "~19.5.0",
190
200
  "@nx/jest": "~19.5.0",
191
- "@o3r/build-helpers": "^11.5.0-prerelease.5",
192
- "@o3r/core": "^11.5.0-prerelease.5",
193
- "@o3r/eslint-plugin": "^11.5.0-prerelease.5",
194
- "@o3r/localization": "^11.5.0-prerelease.5",
195
- "@o3r/schematics": "^11.5.0-prerelease.5",
196
- "@o3r/test-helpers": "^11.5.0-prerelease.5",
201
+ "@o3r/build-helpers": "^11.5.0-prerelease.50",
202
+ "@o3r/core": "^11.5.0-prerelease.50",
203
+ "@o3r/eslint-plugin": "^11.5.0-prerelease.50",
204
+ "@o3r/localization": "^11.5.0-prerelease.50",
205
+ "@o3r/schematics": "^11.5.0-prerelease.50",
206
+ "@o3r/test-helpers": "^11.5.0-prerelease.50",
197
207
  "@playwright/test": "~1.48.0",
198
208
  "@schematics/angular": "~18.2.0",
199
209
  "@stylistic/eslint-plugin-ts": "~2.4.0",
@@ -1,13 +1,10 @@
1
1
  const getJestProjectConfig = require('<%= rootRelativePath %>/jest.config.ut').getJestProjectConfig;
2
2
 
3
+ const baseConfig = getJestProjectConfig(__dirname, <%= isAngularSetup %>);
4
+
3
5
  /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
4
6
  module.exports = {
5
- ...getJestProjectConfig(__dirname, <%= isAngularSetup %>),
6
- displayName: require('./package.json').name,
7
- testPathIgnorePatterns: [
8
- '<rootDir>/dist',
9
- '<rootDir>/.*/templates/.*',
10
- '\\.it\\.spec\\.ts$'
11
- ]
7
+ ...baseConfig,
8
+ displayName: require('./package.json').name
12
9
  };
13
10
 
@@ -1,7 +1,10 @@
1
1
  const { getJestProjects } = require('@o3r/workspace');
2
+ const { getJestGlobalConfig } = require('./jest.config.ut');
2
3
 
3
4
  /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
4
5
  module.exports = {
6
+ ...getJestGlobalConfig(__dirname),
7
+ passWithNoTests: true,
5
8
  projects: getJestProjects(__dirname),
6
9
  globalSetup: 'jest-preset-angular/global-setup',
7
10
  reporters: [
@@ -28,7 +28,7 @@ module.exports.getJestProjectConfig = (rootDir, isAngularSetup) => {
28
28
  return {
29
29
  preset: 'ts-jest',
30
30
  setupFilesAfterEnv: ['<rootDir>/testing/setup-jest.ts'],
31
- rootDir: '.',
31
+ rootDir,
32
32
  moduleNameMapper,
33
33
  modulePathIgnorePatterns: [
34
34
  '<rootDir>/dist'
@@ -72,11 +72,22 @@ module.exports.getJestProjectConfig = (rootDir, isAngularSetup) => {
72
72
  };
73
73
  };
74
74
 
75
- module.exports.getJestGlobalConfig = () => {
75
+ /**
76
+ * @param rootDir {string} Root directory, default to '.'
77
+ * @returns {import('ts-jest/dist/types').JestConfigWithTsJest}
78
+ */
79
+ module.exports.getJestGlobalConfig = (rootDir) => {
76
80
  return {
81
+ rootDir: rootDir || '.',
82
+ testMatch: [
83
+ '<rootDir>/**/*.spec.ts'
84
+ ],
85
+ testPathIgnorePatterns: [
86
+ '\\.spec\\.ts$'
87
+ ],
77
88
  reporters: [
78
89
  'default',
79
- ['jest-junit', {outputDirectory: '<rootDir>/dist-test', outputName: 'ut-report.xml'}],
90
+ ['jest-junit', {outputDirectory: '<rootDir>/dist-test', outputName: 'junit.xml'}],
80
91
  'github-actions'
81
92
  ],
82
93
  }