@o3r/testing 12.0.0-next.1 → 12.0.0-next.12

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.
@@ -53,7 +53,7 @@ var LocalizationDependencyMocks = /** @class */ (function () {
53
53
  if (pipeWithPrefix === void 0) { pipeWithPrefix = false; }
54
54
  return {
55
55
  ngModule: LocalizationDependencyMocks_1,
56
- providers: [{ provide: localization_1.LocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }]
56
+ providers: [{ provide: localization_1.O3rLocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }]
57
57
  };
58
58
  };
59
59
  var LocalizationDependencyMocks_1;
@@ -1 +1 @@
1
- {"version":3,"file":"localization-mock.js","sourceRoot":"","sources":["../../src/localization/localization-mock.ts"],"names":[],"mappings":";;;AAsEA,wDAoBC;;AA1FD,sCAMuB;AACvB,4CAG6B;AAC7B,kDAI2B;AAC3B,6BAEc;AAEd,IAAM,gCAAgC,GAAG;IACvC,gBAAgB,EAAE,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,IAAI;CAC+B,CAAC;AAGxD;IAAA;IAIA,CAAC;IAHQ,qCAAS,GAAhB;QAAiB,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAf,CAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAHU,iBAAiB;QAD7B,IAAA,WAAI,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;OACf,iBAAiB,CAI7B;IAAD,wBAAC;CAAA,AAJD,IAIC;AAJY,8CAAiB;AAO9B;IAAA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B,EAAzB,CAAyB,CAAC;QAC3D,sBAAe,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE;gBACN,OAAO,EAAE,sBAAe;gBACxB,QAAQ,EAAE;oBACR,cAAc,EAAE,UAAC,IAAY,IAAK,OAAA,IAAA,SAAE,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAtB,CAAsB;iBACzD;aACF;YACD,QAAQ,EAAE,2BAA2B;SACtC,CAAC;OACC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAC1E;AACJ,CAAC","sourcesContent":["import {\n ModuleWithProviders,\n NgModule,\n Pipe,\n PipeTransform,\n Provider,\n} from '@angular/core';\nimport {\n TranslateLoader,\n TranslateModule,\n} from '@ngx-translate/core';\nimport {\n LocalizationConfiguration,\n LocalizationModule,\n LocalizationTranslatePipe,\n} from '@o3r/localization';\nimport {\n of,\n} from 'rxjs';\n\nconst defaultLocalizationConfiguration = {\n supportedLocales: ['en'],\n language: 'en',\n endPointUrl: '',\n fallbackLanguage: 'en'\n} as const satisfies Partial<LocalizationConfiguration>;\n\n@Pipe({ name: 'translate' })\nexport class TranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@Pipe({ name: 'o3rTranslate' })\nexport class O3rTranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@NgModule({\n declarations: [TranslatePipeMock, O3rTranslatePipeMock],\n exports: [TranslatePipeMock, O3rTranslatePipeMock]\n})\nexport class LocalizationDependencyMocks {\n public static forTest(pipeWithPrefix = false): ModuleWithProviders<LocalizationDependencyMocks> {\n return {\n ngModule: LocalizationDependencyMocks,\n providers: [{ provide: LocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }]\n };\n }\n}\n\n/** Mock to provide to the MockTranslation module */\nexport interface MockTranslations {\n [lang: string]: {\n [key: string]: any;\n };\n}\n\n/**\n * Function to get the list of modules required to test component using Localization module\n * @param localizationConfiguration Localization configuration\n * @param translations Translations to use\n * @param translationCompilerProvider Provider for translations compiler\n * @param mockPipe Enable translation pipe mocking\n * @param pipeWithPrefix Enable pipe with prefix\n * @returns List of modules to import in the TestBed\n */\nexport function mockTranslationModules(\n localizationConfiguration: Partial<LocalizationConfiguration> = defaultLocalizationConfiguration,\n translations: MockTranslations = {},\n translationCompilerProvider?: Provider,\n mockPipe = false,\n pipeWithPrefix = false\n): ModuleWithProviders<LocalizationModule>[] {\n return [\n LocalizationModule.forRoot(() => localizationConfiguration),\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useValue: {\n getTranslation: (lang: string) => of(translations[lang])\n }\n },\n compiler: translationCompilerProvider\n }),\n ...(mockPipe ? [LocalizationDependencyMocks.forTest(pipeWithPrefix)] : [])\n ];\n}\n"]}
1
+ {"version":3,"file":"localization-mock.js","sourceRoot":"","sources":["../../src/localization/localization-mock.ts"],"names":[],"mappings":";;;AAsEA,wDAoBC;;AA1FD,sCAMuB;AACvB,4CAG6B;AAC7B,kDAI2B;AAC3B,6BAEc;AAEd,IAAM,gCAAgC,GAAG;IACvC,gBAAgB,EAAE,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,IAAI;CAC+B,CAAC;AAGxD;IAAA;IAIA,CAAC;IAHQ,qCAAS,GAAhB;QAAiB,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAf,CAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,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CAAA,EAAA,4DAAgG;IAChG,6BAAA,EAAA,iBAAmC;IAEnC,yBAAA,EAAA,gBAAgB;IAChB,+BAAA,EAAA,sBAAsB;IAEtB;QACE,iCAAkB,CAAC,OAAO,CAAC,cAAM,OAAA,yBAAyB,EAAzB,CAAyB,CAAC;QAC3D,sBAAe,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE;gBACN,OAAO,EAAE,sBAAe;gBACxB,QAAQ,EAAE;oBACR,cAAc,EAAE,UAAC,IAAY,IAAK,OAAA,IAAA,SAAE,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAtB,CAAsB;iBACzD;aACF;YACD,QAAQ,EAAE,2BAA2B;SACtC,CAAC;OACC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAC1E;AACJ,CAAC","sourcesContent":["import {\n ModuleWithProviders,\n NgModule,\n Pipe,\n PipeTransform,\n Provider,\n} from '@angular/core';\nimport {\n TranslateLoader,\n TranslateModule,\n} from '@ngx-translate/core';\nimport {\n LocalizationConfiguration,\n LocalizationModule,\n O3rLocalizationTranslatePipe,\n} from '@o3r/localization';\nimport {\n of,\n} from 'rxjs';\n\nconst defaultLocalizationConfiguration = {\n supportedLocales: ['en'],\n language: 'en',\n endPointUrl: '',\n fallbackLanguage: 'en'\n} as const satisfies Partial<LocalizationConfiguration>;\n\n@Pipe({ name: 'translate' })\nexport class TranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@Pipe({ name: 'o3rTranslate' })\nexport class O3rTranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@NgModule({\n declarations: [TranslatePipeMock, O3rTranslatePipeMock],\n exports: [TranslatePipeMock, O3rTranslatePipeMock]\n})\nexport class LocalizationDependencyMocks {\n public static forTest(pipeWithPrefix = false): ModuleWithProviders<LocalizationDependencyMocks> {\n return {\n ngModule: LocalizationDependencyMocks,\n providers: [{ provide: O3rLocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }]\n };\n }\n}\n\n/** Mock to provide to the MockTranslation module */\nexport interface MockTranslations {\n [lang: string]: {\n [key: string]: any;\n };\n}\n\n/**\n * Function to get the list of modules required to test component using Localization module\n * @param localizationConfiguration Localization configuration\n * @param translations Translations to use\n * @param translationCompilerProvider Provider for translations compiler\n * @param mockPipe Enable translation pipe mocking\n * @param pipeWithPrefix Enable pipe with prefix\n * @returns List of modules to import in the TestBed\n */\nexport function mockTranslationModules(\n localizationConfiguration: Partial<LocalizationConfiguration> = defaultLocalizationConfiguration,\n translations: MockTranslations = {},\n translationCompilerProvider?: Provider,\n mockPipe = false,\n pipeWithPrefix = false\n): ModuleWithProviders<LocalizationModule>[] {\n return [\n LocalizationModule.forRoot(() => localizationConfiguration),\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useValue: {\n getTranslation: (lang: string) => of(translations[lang])\n }\n },\n compiler: translationCompilerProvider\n }),\n ...(mockPipe ? [LocalizationDependencyMocks.forTest(pipeWithPrefix)] : [])\n ];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/testing",
3
- "version": "12.0.0-next.1",
3
+ "version": "12.0.0-next.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -98,27 +98,28 @@
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@amadeus-it-group/kassette": "^1.7.0",
101
- "@angular-devkit/core": "^18.2.0",
102
- "@angular-devkit/schematics": "^18.2.0",
103
- "@angular/animations": "^18.2.0",
104
- "@angular/cli": "^18.2.0",
105
- "@angular/common": "^18.2.0",
106
- "@angular/core": "^18.2.0",
107
- "@angular/forms": "^18.2.0",
108
- "@angular/platform-browser": "^18.2.0",
101
+ "@angular-devkit/core": "^19.0.0",
102
+ "@angular-devkit/schematics": "^19.0.0",
103
+ "@angular/animations": "^19.0.0",
104
+ "@angular/cli": "^19.0.0",
105
+ "@angular/common": "^19.0.0",
106
+ "@angular/core": "^19.0.0",
107
+ "@angular/forms": "^19.0.0",
108
+ "@angular/platform-browser": "^19.0.0",
109
109
  "@material/slider": "^14.0.0",
110
- "@ngrx/store": "^18.0.0",
110
+ "@ngrx/store": "^19.0.0",
111
111
  "@ngx-translate/core": "^15.0.0",
112
- "@o3r/core": "^12.0.0-next.1",
113
- "@o3r/localization": "^12.0.0-next.1",
114
- "@o3r/schematics": "^12.0.0-next.1",
112
+ "@o3r/core": "^12.0.0-next.12",
113
+ "@o3r/localization": "^12.0.0-next.12",
114
+ "@o3r/schematics": "^12.0.0-next.12",
115
115
  "@playwright/test": "^1.49.0",
116
- "@schematics/angular": "^18.2.0",
117
- "pixelmatch": "^5.2.1",
116
+ "@schematics/angular": "^19.0.0",
117
+ "pixelmatch": "^6.0.0",
118
118
  "pngjs": "^7.0.0",
119
119
  "protractor": "^7.0.0",
120
120
  "rxjs": "^7.8.1",
121
121
  "temporal-polyfill": "^0.2.0",
122
+ "ts-node": "~10.9.2",
122
123
  "type-fest": "^4.10.2",
123
124
  "typescript": "^5.5.4"
124
125
  },
@@ -179,45 +180,45 @@
179
180
  },
180
181
  "devDependencies": {
181
182
  "@amadeus-it-group/kassette": "^1.7.0",
182
- "@angular-devkit/build-angular": "~18.2.0",
183
- "@angular-devkit/core": "~18.2.0",
184
- "@angular-devkit/schematics": "~18.2.0",
185
- "@angular/cli": "~18.2.0",
186
- "@angular/common": "~18.2.0",
187
- "@angular/compiler": "~18.2.0",
188
- "@angular/compiler-cli": "~18.2.0",
189
- "@angular/core": "~18.2.0",
190
- "@angular/forms": "~18.2.0",
191
- "@angular/platform-browser": "~18.2.0",
192
- "@angular/platform-browser-dynamic": "~18.2.0",
183
+ "@angular-devkit/build-angular": "~19.0.0",
184
+ "@angular-devkit/core": "~19.0.0",
185
+ "@angular-devkit/schematics": "~19.0.0",
186
+ "@angular/cli": "~19.0.0",
187
+ "@angular/common": "~19.0.0",
188
+ "@angular/compiler": "~19.0.0",
189
+ "@angular/compiler-cli": "~19.0.0",
190
+ "@angular/core": "~19.0.0",
191
+ "@angular/forms": "~19.0.0",
192
+ "@angular/platform-browser": "~19.0.0",
193
+ "@angular/platform-browser-dynamic": "~19.0.0",
193
194
  "@babel/core": "~7.26.0",
194
195
  "@babel/preset-typescript": "~7.26.0",
195
196
  "@compodoc/compodoc": "^1.1.19",
196
197
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
197
198
  "@material/slider": "^14.0.0",
198
- "@ngrx/store": "~18.0.0",
199
+ "@ngrx/store": "~19.0.0",
199
200
  "@ngx-translate/core": "~15.0.0",
200
201
  "@nx/eslint-plugin": "~19.8.0",
201
202
  "@nx/jest": "~19.8.0",
202
- "@o3r/build-helpers": "^12.0.0-next.1",
203
- "@o3r/core": "^12.0.0-next.1",
204
- "@o3r/eslint-plugin": "^12.0.0-next.1",
205
- "@o3r/localization": "^12.0.0-next.1",
206
- "@o3r/schematics": "^12.0.0-next.1",
207
- "@o3r/test-helpers": "^12.0.0-next.1",
203
+ "@o3r/build-helpers": "^12.0.0-next.12",
204
+ "@o3r/core": "^12.0.0-next.12",
205
+ "@o3r/eslint-plugin": "^12.0.0-next.12",
206
+ "@o3r/localization": "^12.0.0-next.12",
207
+ "@o3r/schematics": "^12.0.0-next.12",
208
+ "@o3r/test-helpers": "^12.0.0-next.12",
208
209
  "@playwright/test": "~1.49.0",
209
- "@schematics/angular": "~18.2.0",
210
+ "@schematics/angular": "~19.0.0",
210
211
  "@stylistic/eslint-plugin": "~2.7.0",
211
212
  "@swc/helpers": "~0.5.0",
212
213
  "@types/jest": "~29.5.2",
213
214
  "@types/node": "^20.0.0",
214
215
  "@types/pixelmatch": "^5.2.3",
215
216
  "@types/pngjs": "^6.0.0",
216
- "@typescript-eslint/parser": "~8.18.0",
217
- "angular-eslint": "~18.4.0",
218
- "concurrently": "^8.0.0",
217
+ "@typescript-eslint/parser": "~8.21.0",
218
+ "angular-eslint": "~19.0.0",
219
+ "concurrently": "^9.1.0",
219
220
  "cpy-cli": "^5.0.0",
220
- "eslint": "~9.14.0",
221
+ "eslint": "~9.17.0",
221
222
  "eslint-import-resolver-node": "^0.3.9",
222
223
  "eslint-import-resolver-typescript": "^3.6.3",
223
224
  "eslint-plugin-import": "^2.31.0",
@@ -232,22 +233,22 @@
232
233
  "jest": "~29.7.0",
233
234
  "jest-environment-jsdom": "~29.7.0",
234
235
  "jest-junit": "~16.0.0",
235
- "jest-preset-angular": "~14.2.0",
236
+ "jest-preset-angular": "~14.5.0",
236
237
  "jsonc-eslint-parser": "~2.4.0",
237
238
  "nx": "~19.8.0",
238
239
  "pid-from-port": "^1.1.3",
239
- "pixelmatch": "^5.2.1",
240
+ "pixelmatch": "^6.0.0",
240
241
  "pngjs": "^7.0.0",
241
242
  "protractor": "^7.0.0",
242
243
  "rxjs": "^7.8.1",
243
244
  "semver": "^7.5.2",
244
245
  "temporal-polyfill": "^0.2.0",
245
- "ts-jest": "~29.2.0",
246
+ "ts-jest": "~29.2.5",
246
247
  "ts-node": "~10.9.2",
247
- "type-fest": "^4.10.2",
248
- "typescript": "~5.5.4",
249
- "typescript-eslint": "~8.18.0",
250
- "zone.js": "~0.14.2"
248
+ "type-fest": "^4.30.1",
249
+ "typescript": "~5.6.2",
250
+ "typescript-eslint": "~8.21.0",
251
+ "zone.js": "~0.15.0"
251
252
  },
252
253
  "schematics": "./collection.json",
253
254
  "ng-update": {
@@ -1 +1 @@
1
- {"version":3,"file":"path-replacement.d.ts","sourceRoot":"","sources":["../../../src/tools/path-replacement/path-replacement.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAIjB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,YAAY,GAAG,YAAY,EAAE,sBAAsB,GAAE,gBAAqB,QAgDnH"}
1
+ {"version":3,"file":"path-replacement.d.ts","sourceRoot":"","sources":["../../../src/tools/path-replacement/path-replacement.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAIjB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,YAAY,GAAG,YAAY,EAAE,sBAAsB,GAAE,gBAAqB,QAiDnH"}
@@ -16,6 +16,7 @@ var module_from_string_1 = require("module-from-string");
16
16
  function adjustPath(frameworkName, customTransformOptions) {
17
17
  if (customTransformOptions === void 0) { customTransformOptions = {}; }
18
18
  var modulesCache = {};
19
+ // eslint-disable-next-line @typescript-eslint/unbound-method -- No need to bind the method, we are using `apply`
19
20
  var originalRequire = node_module_1.Module.prototype.require;
20
21
  var regex = new RegExp("@o3r/testing/core(?!/".concat(frameworkName, ")(.*)"));
21
22
  node_module_1.Module.prototype.require = function (id) {
@@ -1 +1 @@
1
- {"version":3,"file":"path-replacement.js","sourceRoot":"","sources":["../../../src/tools/path-replacement/path-replacement.ts"],"names":[],"mappings":";;AAkBA,gCAgDC;;AAlED,4BAA8B;AAC9B,2CAEqB;AACrB,gCAAkC;AAClC,mCAGiB;AACjB,yDAE4B;AAC5B;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,aAA0C,EAAE,sBAA6C;IAA7C,uCAAA,EAAA,2BAA6C;IAClH,IAAM,YAAY,GAAwB,EAAE,CAAC;IAC7C,IAAM,eAAe,GAAG,oBAAM,CAAC,SAAS,CAAC,OAAO,CAAC;IACjD,IAAM,KAAK,GAAG,IAAI,MAAM,CAAC,+BAAwB,aAAa,UAAO,CAAC,CAAC;IACvE,oBAAM,CAAC,SAAS,CAAC,OAAO,GAAG,UAA+B,EAAU;QAClE,IAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,4BAAqB,aAAa,OAAI,CAAC,CAAC;QAExE,IAAI,CAAC;YACH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AC;YACH,CAAC;YAED,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;IACH,CAAmB,CAAC;AACtB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport {\n Module,\n} from 'node:module';\nimport * as path from 'node:path';\nimport {\n TransformOptions,\n transformSync,\n} from 'esbuild';\nimport {\n requireFromString,\n} from 'module-from-string';\n/**\n * Switch to the needed implementation of core testing, when running e2e tests\n * transforms ESM into CJS when needed\n * @param frameworkName Name of the framework used for e2e testing (playwright|protractor)\n * @param customTransformOptions\n */\nexport function adjustPath(frameworkName: 'playwright' | 'protractor', customTransformOptions: TransformOptions = {}) {\n const modulesCache: Record<string, any> = {};\n const originalRequire = Module.prototype.require;\n const regex = new RegExp(`@o3r/testing/core(?!/${frameworkName})(.*)`);\n Module.prototype.require = function (this: NodeJS.Module, id: string) {\n const newId = id.replace(regex, `@o3r/testing/core/${frameworkName}$1`);\n\n try {\n return Reflect.apply(originalRequire, this, [newId]);\n } catch {\n const paths = ([] as string[])\n .concat(this.paths, this.paths.map((i) => i.replace(/[/\\\\]node_modules$/, '')));\n\n const filePath = require.resolve(newId, { paths });\n if (!modulesCache[filePath]) {\n const fileContent = fs.readFileSync(filePath);\n const cwd = path.resolve(process.cwd(), 'src');\n // we use ESBUILD to transform it into CJS\n const trans = transformSync(fileContent.toString(), {\n loader: 'js',\n format: 'cjs',\n target: 'es2016',\n sourcesContent: true,\n sourceRoot: cwd,\n ...customTransformOptions\n });\n\n /**\n * requireFromString will execute the file apart from just returning a module\n * It can throw an exception which will prevent stop the execution\n *\n * That main blocker includes IVY-compatible libraries which have\n * no compiler facade in a global scope.\n */\n try {\n modulesCache[filePath] = requireFromString(trans.code, {\n dirname: path.dirname(filePath),\n useCurrentGlobal: true\n });\n } catch (ex) {\n // eslint-disable-next-line no-console -- no other logger available\n console.error(ex);\n }\n }\n\n return modulesCache[filePath];\n }\n } as NodeJS.Require;\n}\n"]}
1
+ {"version":3,"file":"path-replacement.js","source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,KAAK,CAAC,CAAC;gBAC/C,0CAA0C;gBAC1C,IAAM,KAAK,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,QAAQ,EAAE,qBAChD,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,QAAQ,EAChB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,GAAG,IACZ,sBAAsB,EACzB,CAAC;gBAEH;;;;;;mBAMG;gBACH,IAAI,CAAC;oBACH,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAA,sCAAiB,EAAC,KAAK,CAAC,IAAI,EAAE;wBACrD,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;wBAC/B,gBAAgB,EAAE,IAAI;qBACvB,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACZ,mEAAmE;oBACnE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC;YAED,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;IACH,CAAmB,CAAC;AACtB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport {\n Module,\n} from 'node:module';\nimport * as path from 'node:path';\nimport {\n TransformOptions,\n transformSync,\n} from 'esbuild';\nimport {\n requireFromString,\n} from 'module-from-string';\n/**\n * Switch to the needed implementation of core testing, when running e2e tests\n * transforms ESM into CJS when needed\n * @param frameworkName Name of the framework used for e2e testing (playwright|protractor)\n * @param customTransformOptions\n */\nexport function adjustPath(frameworkName: 'playwright' | 'protractor', customTransformOptions: TransformOptions = {}) {\n const modulesCache: Record<string, any> = {};\n // eslint-disable-next-line @typescript-eslint/unbound-method -- No need to bind the method, we are using `apply`\n const originalRequire = Module.prototype.require;\n const regex = new RegExp(`@o3r/testing/core(?!/${frameworkName})(.*)`);\n Module.prototype.require = function (this: NodeJS.Module, id: string) {\n const newId = id.replace(regex, `@o3r/testing/core/${frameworkName}$1`);\n\n try {\n return Reflect.apply(originalRequire, this, [newId]);\n } catch {\n const paths = ([] as string[])\n .concat(this.paths, this.paths.map((i) => i.replace(/[/\\\\]node_modules$/, '')));\n\n const filePath = require.resolve(newId, { paths });\n if (!modulesCache[filePath]) {\n const fileContent = fs.readFileSync(filePath);\n const cwd = path.resolve(process.cwd(), 'src');\n // we use ESBUILD to transform it into CJS\n const trans = transformSync(fileContent.toString(), {\n loader: 'js',\n format: 'cjs',\n target: 'es2016',\n sourcesContent: true,\n sourceRoot: cwd,\n ...customTransformOptions\n });\n\n /**\n * requireFromString will execute the file apart from just returning a module\n * It can throw an exception which will prevent stop the execution\n *\n * That main blocker includes IVY-compatible libraries which have\n * no compiler facade in a global scope.\n */\n try {\n modulesCache[filePath] = requireFromString(trans.code, {\n dirname: path.dirname(filePath),\n useCurrentGlobal: true\n });\n } catch (ex) {\n // eslint-disable-next-line no-console -- no other logger available\n console.error(ex);\n }\n }\n\n return modulesCache[filePath];\n }\n } as NodeJS.Require;\n}\n"]}