Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
273 commits
Select commit Hold shift + click to select a range
18eee86
ui5-library-reference-inquirer tests
cianmSAP Apr 9, 2026
fe4224d
ui5-config tests
cianmSAP Apr 9, 2026
e5fd2cf
system-access tests
cianmSAP Apr 9, 2026
5f52a50
ui5-info tests
cianmSAP Apr 9, 2026
5aac2fd
ui5-library-inquirer tests
cianmSAP Apr 9, 2026
22a66cd
ui5-info tests
cianmSAP Apr 9, 2026
7a337ee
cap-config-writer tests
cianmSAP Apr 9, 2026
b6fa0fc
odata-service-writer tests
cianmSAP Apr 9, 2026
7368c38
backend-proxy-middleware tests
cianmSAP Apr 9, 2026
4f05a14
flp-config-sub-generator tests
cianmSAP Apr 9, 2026
71b3f0e
mockserver-config-writer tests
cianmSAP Apr 9, 2026
9208dfd
project-integrity tests
cianmSAP Apr 9, 2026
b5c1d6b
fiori-freestyle-writer tests
cianmSAP Apr 9, 2026
d127d75
ui5-proxy-middleware tests
cianmSAP Apr 9, 2026
4487c74
ui5-application-inquirer tests
cianmSAP Apr 9, 2026
182ae66
ui-service-inquirer tests
cianmSAP Apr 9, 2026
053defe
inquirer-common tests
cianmSAP Apr 9, 2026
2fec30d
ui5-application-writer tests
cianmSAP Apr 9, 2026
cb06f77
fiori-generator-shared tests
cianmSAP Apr 9, 2026
1723c0d
abap-deploy-config-sub-generator tests
cianmSAP Apr 9, 2026
6fc7b19
ui5-library-reference-sub-generator tests
cianmSAP Apr 9, 2026
823ab2f
launch-config tests
cianmSAP Apr 9, 2026
b07ed9d
backend-proxy-middleware-cf tests
cianmSAP Apr 9, 2026
a38d757
flp-config-inquirer tests
cianmSAP Apr 9, 2026
8ab996a
deploy-config-sub-generator tests
cianmSAP Apr 9, 2026
31dfc18
ui5-library-sub-generator tests
cianmSAP Apr 9, 2026
5b1304e
cf-deploy-config-inquirer tests
cianmSAP Apr 9, 2026
6d7fe80
jest-environment-ui5 tests
cianmSAP Apr 9, 2026
003e63b
deploy-tooling tests
cianmSAP Apr 9, 2026
be7cb7b
fiori-elements-writer tests
cianmSAP Apr 9, 2026
c435e0a
ui-prompting tests
cianmSAP Apr 9, 2026
7b4e760
control-property-editor tests
cianmSAP Apr 9, 2026
1cde91e
cf-deploy-config-sub-generator tests
cianmSAP Apr 9, 2026
a6f48d8
sap-systems-ext-webapp tests
cianmSAP Apr 9, 2026
5bd2ca6
ui-service-sub-generator tests
cianmSAP Apr 9, 2026
ca377d6
generator-odata-downloader tests
cianmSAP Apr 9, 2026
3055e20
deploy-config-sub-generator tests
cianmSAP Apr 9, 2026
478f6c4
fiori-docs-embeddings tests
cianmSAP Apr 9, 2026
f077ef7
fiori-docs-embeddings tests
cianmSAP Apr 9, 2026
272c4b6
store tests
cianmSAP Apr 9, 2026
282193b
i18n tests
cianmSAP Apr 9, 2026
bf7892e
fiori-docs-embeddings tests
cianmSAP Apr 9, 2026
680f46d
telemetry tests: fix OOM and ESM compatibility
cianmSAP Apr 9, 2026
70d24a6
abap-deploy-config-inquirer tests
cianmSAP Apr 9, 2026
ed36aff
adp-flp-config-sub-generator tests
cianmSAP Apr 9, 2026
a2233b0
preview-middleware tests
cianmSAP Apr 9, 2026
44c39da
environment-check tests
cianmSAP Apr 9, 2026
a53c425
environment-check remaining test files ESM migration
cianmSAP Apr 9, 2026
ee1b0a4
eslint-plugin-fiori-tools tests
cianmSAP Apr 9, 2026
5b3908b
cf-deploy-config-writer tests
cianmSAP Apr 9, 2026
63aa785
fe-fpm-writer tests
cianmSAP Apr 9, 2026
df99dfe
repo-app-import-sub-generator tests
cianmSAP Apr 9, 2026
30c7ccf
fiori-app-sub-generator tests
cianmSAP Apr 9, 2026
c3ddafe
generator-adp tests
cianmSAP Apr 9, 2026
5e77b7b
project-access tests
cianmSAP Apr 9, 2026
e6faea4
fiori-annotation-api tests
cianmSAP Apr 9, 2026
48d71db
create tests
cianmSAP Apr 9, 2026
1a6aa4f
odata-service-inquirer tests
cianmSAP Apr 9, 2026
b8ff721
cds-odata-annotation-converter tests
cianmSAP Apr 9, 2026
d9b22c9
annotation-generator tests
cianmSAP Apr 9, 2026
9984254
adp-tooling tests
cianmSAP Apr 9, 2026
ca47a46
fiori-mcp-server tests
cianmSAP Apr 9, 2026
af1d474
odata-service-inquirer tests
cianmSAP Apr 9, 2026
bf310c2
axios-extension tests
cianmSAP Apr 9, 2026
89c7602
sap-systems-ext tests: ESM migration for 28 test files
cianmSAP Apr 9, 2026
ee30dc2
repo-app-import-sub-generator tests
cianmSAP Apr 9, 2026
6033aea
create: fix ESM directory imports
cianmSAP Apr 9, 2026
6da24d0
control-property-editor: fix TypeScript config for ESM, exclude test …
cianmSAP Apr 9, 2026
1506719
sap-systems-ext: exclude test files from TypeScript build
cianmSAP Apr 9, 2026
8b21fdf
preview-middleware-client: exclude test TS files from build type chec…
cianmSAP Apr 9, 2026
a7bd90e
odata-service-inquirer: remove redundant type modifiers from type import
cianmSAP Apr 9, 2026
336de04
fiori-app-sub-generator: remove redundant type modifier from type import
cianmSAP Apr 9, 2026
0a476d4
mockserver-config-writer: fix ESM directory import
cianmSAP Apr 9, 2026
98db3c1
mockserver-config-writer: fix prompt directory import for ESM
cianmSAP Apr 9, 2026
3c5e4e4
fiori-mcp-server: add ESM format to esbuild for top-level await support
cianmSAP Apr 9, 2026
98a8c51
sap-systems-ext: change esbuild format to ESM for top-level await sup…
cianmSAP Apr 9, 2026
2669c48
fix: deploy-config-generator-shared ESM test migration
cianmSAP Apr 10, 2026
5887907
fix: ui5-library-reference-inquirer ESM test migration
cianmSAP Apr 10, 2026
826d356
fix: ui5-library-sub-generator ESM test migration
cianmSAP Apr 10, 2026
afec7b9
fix: flp-config-inquirer ESM test migration
cianmSAP Apr 10, 2026
dfb86e4
fix: cf-deploy-config-inquirer ESM test migration
cianmSAP Apr 10, 2026
c5e5ed5
fix: fiori-freestyle-writer ESM test migration
cianmSAP Apr 10, 2026
1a87351
fix: ui-service-inquirer ESM test migration
cianmSAP Apr 10, 2026
aadb8d2
fix: flp-config-sub-generator ESM test migration
cianmSAP Apr 10, 2026
5eccfa4
fix: align vscode-logging-logger mocks to standardized pattern
cianmSAP Apr 10, 2026
de39d7c
fix: ui5-application-inquirer ESM test migration
cianmSAP Apr 10, 2026
c9627b8
fix: ui5-library-reference-sub-generator ESM test migration
cianmSAP Apr 10, 2026
214c1e6
fix: inquirer-common ESM test migration
cianmSAP Apr 10, 2026
f3d0f4e
fix: fiori-elements-writer ESM test migration
cianmSAP Apr 10, 2026
1c476c1
fix: abap-deploy-config-sub-generator ESM test migration
cianmSAP Apr 10, 2026
0e77d4c
fix: generator-odata-downloader ESM test migration
cianmSAP Apr 10, 2026
231c272
fix(cf-deploy-config-sub-generator): add ESM-compatible mocks for @vs…
cianmSAP Apr 10, 2026
cee74b1
fix: deploy-config-sub-generator ESM test migration (partial)
cianmSAP Apr 10, 2026
3427de2
fix(cf-deploy-config-writer,deploy-config-sub-generator): replace __d…
cianmSAP Apr 10, 2026
e3afa1a
fix(telemetry): add CJS fs mock for findit2 compatibility in ESM tests
cianmSAP Apr 10, 2026
329810d
fix(deploy-config-sub-generator): remove hasbin moduleNameMapper in f…
cianmSAP Apr 10, 2026
5c632cf
fix(deploy-tooling): add vscode-logging/logger ESM mock for test comp…
cianmSAP Apr 10, 2026
c24f484
fix(fe-fpm-writer): resolve ESM test failures (22/25 suites passing)
cianmSAP Apr 10, 2026
51e2862
jest-environment-ui5: fix ESM test configuration
cianmSAP Apr 10, 2026
4c74704
eslint-plugin-fiori-tools: partial ESM test fix
cianmSAP Apr 10, 2026
f3968e0
environment-check: fix yamljs ESM default import in workspace.ts
cianmSAP Apr 10, 2026
0850235
ui-components: add null guards for getCellFromCoords in UITable
cianmSAP Apr 10, 2026
cea987f
fix(preview-middleware-client): fix undefined variable references in …
cianmSAP Apr 10, 2026
c3267ee
fiori-mcp-server: mock serviceStore to fix ESM test failures in page/…
cianmSAP Apr 10, 2026
399323c
fix(fe-fpm-writer): fix ESM mock issues in 3 test files
cianmSAP Apr 10, 2026
490ea91
fix(preview-middleware-client): fix 65 test assertions for ESM mock p…
cianmSAP Apr 10, 2026
b6d72fa
fix(eslint-plugin-fiori-tools): mock synckit to prevent Jest ESM dead…
cianmSAP Apr 10, 2026
5dbb6a9
fix(fe-fpm-writer): resolve 3 test failures with project-access deep …
cianmSAP Apr 10, 2026
8279021
fix(fiori-elements-writer): fix test flakiness from shared mutable st…
cianmSAP Apr 10, 2026
ed22096
fix(backend-proxy-middleware-cf): resolve merge conflict in middlewar…
cianmSAP Apr 10, 2026
a4e425b
fix(adp-tooling): resolve merge conflicts and convert tests to ESM mo…
cianmSAP Apr 10, 2026
d6faddb
fix(deploy-config-sub-generator): move dynamic imports inside functio…
cianmSAP Apr 10, 2026
de6e4f6
chore: add changeset for deploy-config-sub-generator ESM test fix
cianmSAP Apr 10, 2026
afa22e9
fix(backend-proxy-middleware-cf): convert tunnel tests to ESM mocking
cianmSAP Apr 10, 2026
2c0d378
fix(cf-deploy-config-writer): convert tests to ESM mocking
cianmSAP Apr 10, 2026
f184450
fix: fiori-elements-writer update OPA test snapshots
cianmSAP Apr 10, 2026
feb0620
chore: update test snapshots and fix mock reference
cianmSAP Apr 10, 2026
7db8dff
fix: resolve CodeQL security issues in test files
cianmSAP Apr 10, 2026
3ed2f89
fix: add cross-env for Windows compatibility with NODE_OPTIONS in tes…
cianmSAP Apr 10, 2026
c554232
linting fixed for feature-toggle
cianmSAP Apr 13, 2026
25f70c7
linting fixed for btp-utils
cianmSAP Apr 13, 2026
d1c10d8
linting fixed for ui5-test-writer
cianmSAP Apr 13, 2026
48394c3
linting fixed for eslint-plugin-fiori-tools
cianmSAP Apr 13, 2026
ba63d0a
linting fixed for odata-vocabularies
cianmSAP Apr 13, 2026
820f506
linting fixed for serve-static-middleware
cianmSAP Apr 13, 2026
43dd8dd
linting fixed for nodejs-utils
cianmSAP Apr 13, 2026
c6c1eae
linting fixed for ui-service-inquirer
cianmSAP Apr 13, 2026
a4c280a
linting fixed for project-input-validator
cianmSAP Apr 13, 2026
224c7ef
linting fixed for cds-odata-annotation-converter
cianmSAP Apr 13, 2026
671157a
linting fixed for annotation-generator
cianmSAP Apr 13, 2026
fe8ff0d
linting fixed for ui5-library-reference-inquirer
cianmSAP Apr 13, 2026
c456ed3
linting fixed for ui5-library-reference-sub-generator
cianmSAP Apr 13, 2026
9606d45
linting fixed for adp-flp-config-sub-generator
cianmSAP Apr 13, 2026
1394c83
linting fixed for ui5-library-sub-generator
cianmSAP Apr 13, 2026
80cd3f8
linting fixed for reload-middleware
cianmSAP Apr 13, 2026
430e562
linting fixed for launch-config
cianmSAP Apr 13, 2026
bc55bd8
linting fixed for playwright
cianmSAP Apr 13, 2026
f374be8
linting fixed for ui5-library-inquirer
cianmSAP Apr 13, 2026
a5c61e8
linting fixed for ui5-info
cianmSAP Apr 13, 2026
0ea8b4e
linting fixed for inquirer-common
cianmSAP Apr 13, 2026
84159f0
linting fixed for fiori-docs-embeddings
cianmSAP Apr 13, 2026
a4a6b8d
linting fixed for project-integrity
cianmSAP Apr 13, 2026
5dea92b
linting fixed for backend-proxy-middleware
cianmSAP Apr 13, 2026
ba11aca
linting fixed for system-access
cianmSAP Apr 13, 2026
9b24a3a
linting fixed for deploy-config-generator-shared
cianmSAP Apr 13, 2026
c12b08f
linting fixed for fiori-freestyle-writer
cianmSAP Apr 13, 2026
9b974f3
linting fixed for flp-config-inquirer
cianmSAP Apr 13, 2026
ff4901d
linting fixed for cf-deploy-config-sub-generator
cianmSAP Apr 13, 2026
926f92f
linting fixed for abap-deploy-config-sub-generator
cianmSAP Apr 13, 2026
5187f8d
linting fixed for deploy-config-sub-generator
cianmSAP Apr 13, 2026
72308ab
linting fixed for sap-systems-ext-webapp
cianmSAP Apr 13, 2026
5cf386f
linting fixed for ui5-application-inquirer
cianmSAP Apr 13, 2026
c12c0ab
linting fixed for cf-deploy-config-inquirer
cianmSAP Apr 13, 2026
4657a5f
linting fixed for flp-config-sub-generator
cianmSAP Apr 13, 2026
01ac529
linting fixed for fiori-generator-shared
cianmSAP Apr 13, 2026
a82bf9b
linting fixed for telemetry
cianmSAP Apr 13, 2026
c459825
linting fixed for ui5-proxy-middleware
cianmSAP Apr 13, 2026
e4c41cc
linting fixed for deploy-tooling
cianmSAP Apr 13, 2026
c6e4fc5
linting fixed for axios-extension
cianmSAP Apr 13, 2026
8a56e3a
linting fixed for i18n
cianmSAP Apr 13, 2026
33be7e3
linting fixed for fe-fpm-writer
cianmSAP Apr 13, 2026
9d7026b
linting fixed for backend-proxy-middleware-cf
cianmSAP Apr 13, 2026
ed7ed2e
linting fixed for generator-odata-downloader
cianmSAP Apr 13, 2026
b1ce038
linting fixed for repo-app-import-sub-generator
cianmSAP Apr 13, 2026
2ffb420
linting fixed for fiori-elements-writer
cianmSAP Apr 13, 2026
bf5ce4c
linting fixed for cap-config-writer
cianmSAP Apr 13, 2026
c1b84a5
linting fixed for sap-systems-ext
cianmSAP Apr 13, 2026
624f060
linting fixed for cf-deploy-config-writer
cianmSAP Apr 13, 2026
2bb154d
linting fixed for control-property-editor
cianmSAP Apr 13, 2026
b946265
docs: update LINT-FIX-GUIDE.md with patterns 6 and 7
cianmSAP Apr 13, 2026
000ac09
linting fixed for store
cianmSAP Apr 13, 2026
d06429b
linting fixed for environment-check
cianmSAP Apr 13, 2026
9d56403
linting fixed for project-access
cianmSAP Apr 13, 2026
8901a43
linting fixed for abap-deploy-config-inquirer
cianmSAP Apr 13, 2026
2df44b0
linting fixed for fiori-app-sub-generator
cianmSAP Apr 13, 2026
e8344f2
linting fixed for generator-adp
cianmSAP Apr 13, 2026
ab2a619
linting fixed for app-config-writer
cianmSAP Apr 13, 2026
3603f0a
linting fixed for fiori-mcp-server
cianmSAP Apr 13, 2026
05df18e
linting fixed for odata-service-inquirer
cianmSAP Apr 13, 2026
62c97ce
linting fixed for create
cianmSAP Apr 13, 2026
5bc557b
docs: update LINT-FIX-GUIDE.md with patterns 8 and 9
cianmSAP Apr 13, 2026
04266e4
linting fixed for ui-service-sub-generator
cianmSAP Apr 13, 2026
2701c9e
linting fixed for preview-middleware
cianmSAP Apr 13, 2026
677999a
linting fixed for fiori-annotation-api
cianmSAP Apr 13, 2026
a050e1c
docs: update LINT-FIX-GUIDE.md with fiori-annotation-api pattern
cianmSAP Apr 13, 2026
8faef4e
linting fixed for adp-tooling
cianmSAP Apr 13, 2026
ff9e7fc
linting fixed for preview-middleware-client
cianmSAP Apr 13, 2026
0a9f025
tests
cianmSAP Apr 13, 2026
42f512b
fix: add permanent ESM import fixes for project-access and dependencies
cianmSAP Apr 13, 2026
b1153e8
fix: add permanent ESM import fixes for odata-annotation-core
cianmSAP Apr 13, 2026
b5b87b4
fix: add permanent ESM import fixes for remaining ESM packages
cianmSAP Apr 13, 2026
9dc3f11
fix: convert sap-systems-ext sapSystems test mock to ESM-compatible u…
cianmSAP Apr 13, 2026
e55b17e
fix: mock writeFileSync in store backend-system tests
cianmSAP Apr 13, 2026
15fc42e
fix: resolve getDefaultTargetFolder undefined in fiori-generator-shar…
cianmSAP Apr 13, 2026
a0dfee6
docs: add Pattern 10 - jest.spyOn not intercepting ESM named imports
cianmSAP Apr 13, 2026
b763d01
fix: increase timeout for lrop template generation tests
cianmSAP Apr 13, 2026
ba475c5
fix: disable telemetry in headless integration tests
cianmSAP Apr 13, 2026
f14ffd8
docs: add Pattern 11 - telemetry initialization errors in tests
cianmSAP Apr 13, 2026
edd72c4
fix: increase Node.js heap size for eslint-plugin-fiori-tools tests
cianmSAP Apr 13, 2026
50ca348
docs: add Pattern 12 - heap out of memory during tests
cianmSAP Apr 13, 2026
2edc0ce
fix: increase timeouts for fiori-app-sub-generator headless integrati…
cianmSAP Apr 13, 2026
dbe819f
merge from main
cianmSAP Apr 14, 2026
e1b16b5
Linting auto fix commit
github-actions[bot] Apr 14, 2026
9e256f2
fix: increase lrop test timeout to 60s for CI compatibility
cianmSAP Apr 14, 2026
30153b4
Merge branch 'esm-update' of https://github.com/SAP/open-ux-tools int…
cianmSAP Apr 14, 2026
7ffdeec
fix: replace require.resolve with ESM-compatible path resolution in p…
cianmSAP Apr 14, 2026
88fac96
docs: add Pattern 13 - require not defined in ES module scope
cianmSAP Apr 14, 2026
4cf5881
fix: add ESM __dirname setup for preview-middleware integration tests
cianmSAP Apr 14, 2026
a0cc555
fix: add import attribute for JSON import in preview-middleware
cianmSAP Apr 14, 2026
30e3536
fix: add import attribute for JSON import in adp-tooling
cianmSAP Apr 14, 2026
e668771
docs: add Pattern 14 - JSON import requires type attribute
cianmSAP Apr 14, 2026
f39e7e4
fix: add JSON import type attributes for ESM compatibility
cianmSAP Apr 14, 2026
2784820
docs: update LINT-FIX-GUIDE Pattern 14 with all 46 fixed packages
cianmSAP Apr 14, 2026
961a2df
fix(control-property-editor): update module to ESNext for import attr…
cianmSAP Apr 14, 2026
00c7230
docs: add tsconfig module troubleshooting to Pattern 14
cianmSAP Apr 14, 2026
8727fef
fix(eslint-plugin-fiori-tools): convert global-setup.ts to .mjs for W…
cianmSAP Apr 14, 2026
0289327
docs: add Pattern 15 for Jest setupFiles Windows ESM issue
cianmSAP Apr 14, 2026
7afa641
eslint plugin fiori tools fix
cianmSAP Apr 14, 2026
a7b56c8
fix(eslint-plugin-fiori-tools): convert eslint config to ESM and fix …
cianmSAP Apr 14, 2026
68ab7bb
fix(project-integrity): normalize file paths to forward slashes for c…
cianmSAP Apr 14, 2026
833b1cd
docs: add Pattern 16 - Windows path separators in test snapshots/JSON…
cianmSAP Apr 14, 2026
d114b13
fix(jest-environment-ui5): add cross-env to test-ut script for Window…
cianmSAP Apr 14, 2026
e96f993
fix(fiori-docs-embeddings): override setupFiles to fix Windows Jest E…
cianmSAP Apr 14, 2026
b679718
Merge branch 'main' into esm-update
cianmSAP Apr 14, 2026
3ff96cb
fix(preview-middleware): mock createRequire in tests to fix MODULE_NO…
cianmSAP Apr 14, 2026
21bc1ab
fix(adp-tooling): convert deploy tests to ESM mocking
cianmSAP Apr 14, 2026
ef6d581
Merge main into esm-update
cianmSAP Apr 14, 2026
aba2967
fix(axios-extension): update proxy test expectations for per-request …
cianmSAP Apr 14, 2026
bdb48f8
fix(cds-annotation-parser): avoid redundant string replacement in pat…
cianmSAP Apr 14, 2026
3b6ecbf
chore: resolve merge conflict in cf-deploy-config-writer package.json
cianmSAP Apr 14, 2026
c81d4d9
Linting auto fix commit
github-actions[bot] Apr 14, 2026
e0d529e
freestyle snapshot
cianmSAP Apr 14, 2026
53c0b97
Merge branch 'esm-update' of https://github.com/SAP/open-ux-tools int…
cianmSAP Apr 14, 2026
90e11d7
fix(odata-annotation-core): replace directory imports with explicit i…
cianmSAP Apr 14, 2026
f165f19
fix(project-access): replace directory imports with explicit file ext…
cianmSAP Apr 14, 2026
965ceb4
move fix esm import script
cianmSAP Apr 14, 2026
4e6aa2f
fix(eslint-plugin-fiori-tools): add explicit .js extensions to relati…
cianmSAP Apr 14, 2026
c0c647c
chore: merge main into esm-update
cianmSAP Apr 15, 2026
761cedf
fix: resolve ESM test failures in ui5-test-writer and fiori-freestyle…
cianmSAP Apr 15, 2026
f89d1f5
Merge branch 'main' into esm-update
cianmSAP Apr 15, 2026
7da40cb
fix: update tests after merge - remove obsolete dataSourceName test a…
cianmSAP Apr 15, 2026
b03461e
fix(generator-adp): update add-new-model test for ESM and new API
cianmSAP Apr 15, 2026
69873c0
fix(create): add createNewModelData mock to new-model test
cianmSAP Apr 15, 2026
b9a888f
fix(adp-tooling): convert CF tests to ESM mocking pattern
cianmSAP Apr 15, 2026
4f15fba
fix(adp-tooling): update add-new-model prompts tests for merged model…
cianmSAP Apr 15, 2026
1f2f484
fix(adp-tooling): remove obsolete version prompts tests and fix valid…
cianmSAP Apr 15, 2026
c7c2bd2
fix(adp-tooling): mock getAppHostIds from correct module path
cianmSAP Apr 15, 2026
4b50626
fix(eslint-plugin-fiori-tools): add .js extension to diagnostics impo…
cianmSAP Apr 15, 2026
93bf3ef
fix(create): add mock for @sap-devx/yeoman-ui-types to resolve Jest E…
cianmSAP Apr 15, 2026
59d672f
adp tooling test
cianmSAP Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/deploy-config-headless-esm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sap-ux/deploy-config-sub-generator": patch
---

fix(deploy-config-sub-generator): move dynamic imports inside function for ESM test compatibility
1 change: 1 addition & 0 deletions .claude/scheduled_tasks.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sessionId":"1fbd758a-458c-41a7-a08a-719e779a31f3","pid":69530,"acquiredAt":1775805668040}
2 changes: 1 addition & 1 deletion .github/workflows/renovate-pr-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: pnpm build

- name: Run update script (fixtures & fallbacks)
run: node scripts/update-ui5manifest-version.js
run: node scripts/update-ui5manifest-version.mjs

- name: Check for changes
id: check-changes
Expand Down
File renamed without changes.
334 changes: 334 additions & 0 deletions ESM-TEST-FIX-GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
# ESM Test Migration Guide

This guide documents patterns for migrating tests to ESM (ECMAScript Modules) compatibility in the SAP UX Tools monorepo.

## Table of Contents

- [Overview](#overview)
- [Core Patterns](#core-patterns)
- [Common Issues and Solutions](#common-issues-and-solutions)
- [Migration Checklist](#migration-checklist)

## Overview

The monorepo is migrating from CommonJS to ESM. Tests must be updated to use ESM-compatible patterns, especially for mocking and module imports.

**Key Configuration:**
- Base config: `jest.base.mjs` (ESM format)
- Setup file: `jest.setup.mjs`
- Package configs: `jest.config.mjs` (per package)

## Core Patterns

### 1. Import Jest from @jest/globals

**Before (CommonJS):**
```typescript
import { jest } from '@jest/globals';
```

**After (ESM):**
```typescript
import { jest } from '@jest/globals';
```

This pattern is actually already correct - always import jest from `@jest/globals`.

### 2. Mocking with jest.unstable_mockModule

**Critical:** In ESM, you MUST use `jest.unstable_mockModule()` BEFORE importing the modules that depend on the mocks.

**Pattern:**
```typescript
import { jest } from '@jest/globals';

// Step 1: Define mock functions
const mockIsAppStudio = jest.fn();
const mockListDestinations = jest.fn();

// Step 2: Use jest.unstable_mockModule() to mock the module
jest.unstable_mockModule('@sap-ux/btp-utils', () => ({
isAppStudio: mockIsAppStudio,
listDestinations: mockListDestinations,
// Mock ALL exports, including types/enums as empty objects
AbapEnvType: {},
DestinationType: {},
Authentication: {},
// ... other exports
}));

// Step 3: Import the modules that use the mocked dependencies (AFTER mocking)
const { getProviderConfig } = await import('../../../src/abap/config');
const { SystemLookup } = await import('../../../src/source/systems');

// Step 4: Use in tests
describe('My tests', () => {
beforeEach(() => {
jest.clearAllMocks();
mockIsAppStudio.mockReturnValue(true);
});

it('should work', async () => {
// test code
});
});
```

**Key Points:**
- Use `jest.unstable_mockModule()` (NOT `jest.mock()`)
- Mock definition MUST come BEFORE any imports that use it
- Use `await import()` for dynamic imports AFTER mocking
- Mock ALL exports from the module (including types, enums, constants)
- Use empty objects `{}` for type/enum exports

### 3. Spying on Methods

**Before (CommonJS):**
```typescript
jest.spyOn(SystemLookup.prototype, 'getSystemByName').mockResolvedValue(value);
```

**After (ESM):**
```typescript
// Same pattern works, but must be done after import
const { SystemLookup } = await import('../../../src/source/systems');

let getSystemByNameSpy: ReturnType<typeof jest.spyOn>;

beforeEach(() => {
getSystemByNameSpy = jest.spyOn(SystemLookup.prototype, 'getSystemByName');
});
```

### 4. Type Imports

**Pattern:**
```typescript
// Type-only imports can be at the top
import type { ToolsLogger } from '@sap-ux/logger';
import type { AbapServiceProvider } from '@sap-ux/axios-extension';

// Or inline type imports
type RequestOptions = import('../../../src/abap/config').RequestOptions;
```

### 5. Jest Config Migration

**Old:** `jest.config.js`
```javascript
module.exports = {
...require('../../jest.base'),
displayName: 'package-name'
};
```

**New:** `jest.config.mjs`
```javascript
import baseConfig from '../../jest.base.mjs';

export default {
...baseConfig,
displayName: 'package-name'
};
```

## Common Issues and Solutions

### Issue 1: "ReferenceError: exports is not defined"

**Cause:** Using CommonJS-style `jest.mock()` or importing before mocking in ESM.

**Solution:**
1. Use `jest.unstable_mockModule()` instead of `jest.mock()`
2. Ensure mocks are defined BEFORE imports
3. Use `await import()` for modules that need mocking

**Example Fix:**
```typescript
// ❌ WRONG - will cause "exports is not defined"
import { myFunction } from '../../../src/myModule';
jest.mock('../../../src/dependency'); // Too late!

// ✅ CORRECT
import { jest } from '@jest/globals';

jest.unstable_mockModule('../../../src/dependency', () => ({
someDependency: jest.fn()
}));

const { myFunction } = await import('../../../src/myModule');
```

### Issue 2: Missing Mock Exports

**Cause:** Not mocking all exports from a module.

**Solution:** Include ALL exports in the mock, even if just as empty objects.

**Example:**
```typescript
jest.unstable_mockModule('@sap-ux/btp-utils', () => ({
// Functions
isAppStudio: jest.fn(),
listDestinations: jest.fn(),

// Constants
BAS_DEST_INSTANCE_CRED_HEADER: 'bas-destination-instance-cred',

// Enums/Types (as empty objects)
AbapEnvType: {},
DestinationType: {},
Authentication: {},
Suffix: {},
ProxyType: {}
}));
```

### Issue 3: Hoisting Issues

**Cause:** In ESM, jest.mock() hoisting doesn't work the same way as CommonJS.

**Solution:** Always follow the order:
1. Import jest from @jest/globals
2. Define mock functions with jest.fn()
3. Call jest.unstable_mockModule() with those functions
4. Import the modules under test with await import()
5. Write tests

### Issue 4: Circular Dependencies

**Cause:** Module A imports B which imports A.

**Solution:**
- Refactor to remove circular dependencies
- Use dynamic imports `await import()` where needed
- Consider dependency injection patterns

## Migration Checklist

When migrating a test file to ESM:

- [ ] Convert jest.config.js → jest.config.mjs (if it exists)
- [ ] Import jest from '@jest/globals' at the top
- [ ] Replace all `jest.mock()` with `jest.unstable_mockModule()`
- [ ] Move all mocks BEFORE the imports they affect
- [ ] Change imports to `await import()` for mocked modules
- [ ] Mock ALL exports from mocked modules (including types/enums as {})
- [ ] Add `jest.clearAllMocks()` in beforeEach() if using mock functions
- [ ] Run the test to verify it passes: `pnpm --filter @sap-ux/package-name test`
- [ ] Verify no "exports is not defined" errors
- [ ] Verify no "Cannot find module" errors
- [ ] Verify coverage is maintained (>80%)

## Testing the Migration

After migrating a test file:

```bash
# Test specific package
pnpm --filter @sap-ux/package-name test

# Test with verbose output
pnpm --filter @sap-ux/package-name test -- --verbose

# Test specific file
pnpm --filter @sap-ux/package-name test -- path/to/test.test.ts
```

## Real-World Examples

### Example 1: Simple Mock Migration

**Before:**
```typescript
jest.mock('@sap-ux/logger');
import { createLogger } from '@sap-ux/logger';
import { myFunction } from '../src/myModule';
```

**After:**
```typescript
import { jest } from '@jest/globals';

jest.unstable_mockModule('@sap-ux/logger', () => ({
createLogger: jest.fn(() => ({
info: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
debug: jest.fn()
})),
NullTransport: class {},
ToolsLogger: class {}
}));

const { myFunction } = await import('../src/myModule');
```

### Example 2: Complex Mock with Multiple Dependencies

See `packages/adp-tooling/test/unit/abap/provider.test.ts` for a complete example with:
- Multiple module mocks
- Mock functions
- Type imports
- Spy setup
- Test structure

## Additional Resources

- Jest ESM Support: https://jestjs.io/docs/ecmascript-modules
- jest.unstable_mockModule docs: https://jestjs.io/docs/es6-class-mocks
- Base config: `/jest.base.mjs`
- Setup file: `/jest.setup.mjs`

## Pattern Summary

```typescript
// Template for ESM test migration

import { jest } from '@jest/globals';
import type { TypeImports } from 'some-package'; // types at top

// 1. Mock functions
const mockFn1 = jest.fn();
const mockFn2 = jest.fn();

// 2. Mock modules
jest.unstable_mockModule('dependency-1', () => ({
export1: mockFn1,
export2: mockFn2,
TypeExport: {},
EnumExport: {}
}));

jest.unstable_mockModule('dependency-2', () => ({
someUtil: jest.fn()
}));

// 3. Import modules under test
const { functionUnderTest } = await import('../../../src/myModule');
const { ClassUnderTest } = await import('../../../src/myClass');

// 4. Tests
describe('My Feature', () => {
beforeEach(() => {
jest.clearAllMocks();
});

it('should do something', async () => {
// arrange
mockFn1.mockReturnValue('value');

// act
const result = await functionUnderTest();

// assert
expect(result).toBe('expected');
expect(mockFn1).toHaveBeenCalled();
});
});
```

---

**Last Updated:** 2026-04-09
**Status:** Living document - update with new patterns as discovered
Loading
Loading