Draft
Conversation
🦋 Changeset detectedLatest commit: 59d672f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Fix __dirname for ESM in src/index.ts and src/defaults.ts - Fix fs-extra named export issue in test files - Fix lodash named import in listdetail.test.ts - Convert generateOPATests.test.ts to use jest.unstable_mockModule - Convert basic.test.ts to use jest.unstable_mockModule for cap-config-writer mock - Move common.ts import to dynamic import in basic.test.ts to prevent premature module loading - Fix __dirname and require.resolve in test/common.ts for ESM compatibility - Update snapshot for basic_with_toolsId (real package info instead of mocked values)
- Convert jest.mock() calls to jest.unstable_mockModule() for ESM compatibility
- Pre-import actual modules before mocking to preserve all exports
- Replace jest.spyOn on frozen ESM modules with mock functions
- Use dynamic imports for modules under test after mock setup
- Add import { jest } from '@jest/globals'
…s compatibility The test-ut script was using NODE_OPTIONS directly without cross-env, which fails on Windows command prompt. All other test scripts already use cross-env correctly. Fixes Windows CI failure: 'NODE_OPTIONS' is not recognized as an internal or external command
…SM error The root jest.setup.mjs file cannot be loaded on Windows because Jest doesn't treat .mjs files as ES modules by default, causing 'Cannot use import statement outside a module' errors. Since all tests in this package already import from @jest/globals, they don't need the global injection from the setup file. Override setupFiles to empty array to skip the problematic root setup file. Fixes Windows CI failure where Jest couldn't parse jest.setup.mjs
Resolved conflict in packages/adp-tooling/test/unit/cf/core/auth.test.ts by consolidating ESM-style mocks using jest.unstable_mockModule for both cfGetAvailableOrgs and cfGetAuthToken. Removed duplicate CommonJS-style jest.mock() that was causing conflicts.
…T_FOUND errors All 51 test failures were caused by require.resolve() trying to resolve @sap-ux/control-property-editor-sources at runtime in addEditorRoutes(). The package's dist/app.js entry point hasn't been built in the test environment, causing MODULE_NOT_FOUND errors. Fixed by: - Added jest.unstable_mockModule for node:module in both test files - Mocked createRequire to return a require.resolve that points to a dummy fixture - Created test/fixtures/dummy-cpe/index.js as a minimal placeholder This allows tests to run without requiring the full control-property-editor-sources build, while still testing the middleware routing logic. All tests now pass: 159/159 tests, 8/8 suites Coverage: 94.9% statements (above 80% threshold)
- Replace jest.mock() with jest.unstable_mockModule() for ESM compatibility - Move all mock declarations before jest.unstable_mockModule calls - Import modules under test with await import() after mocks are set up - Use direct mock function references instead of jest.requireMock() This fixes 16 failing tests where isLoggedInCf mock was not being applied properly.
- Resolved conflicts in package.json files (abap-deploy-config-inquirer, odata-vocabularies) - Kept both @jest/globals 30.3.0 (for ESM) and axios 1.15.0 (security upgrade) - Resolved conflict in axios-extension/test/factory.test.ts - Integrated new per-request proxy resolution logic with ESM mocking - Updated test to use mockGetProxyForUrl (ESM mock) instead of getProxyForUrlSpy - Includes axios security upgrade from 1.13.6 to 1.15.0 across affected packages
…resolution - Updated 'create' test to expect full URL in getProxyForUrl call (not just server) - Added mockClear() in 'create with proxy' test to avoid cross-test contamination - Aligns with main branch changes where proxy is resolved per-request, not at construction time
…h normalization - Only replace backslashes with forward slashes on Windows - On non-Windows platforms, use the path as-is (already has forward slashes) - Resolves CodeQL warning: 'replacement of substring with itself' Fixes a logic error where on non-Windows platforms, forward slashes were being replaced with themselves, which was redundant and flagged by CodeQL.
- Keep ESM configuration (type: module, NODE_OPTIONS, @jest/globals) - Use version 0.3.97 from main branch - Maintain ESM-specific build and test scripts from esm-update branch
…ndex.js imports - Changed 'from ..' to 'from ../index.js' in normalization.ts, parse.ts, metadata.ts - Directory imports are not supported in ESM - must explicitly reference index.js - Fixes ESLint error on CI: 'Directory import is not supported resolving ES modules' This ensures the package builds correctly on CI where dist files are generated fresh.
…ve imports for ESM
Resolved conflicts: - cf-deploy-config-writer/package.json: kept ESM config with version 0.3.98 from main - ui5-test-writer/src/fiori-elements-opa-writer.ts: merged imports (dirname, fileURLToPath from HEAD + existsSync from main) - ui5-test-writer/test/unit/fiori-elements.test.ts: combined ESM mocking with unstable_mockModule and dynamic import
…-writer ui5-test-writer: - Replace jest.requireActual() with await import() for ESM compatibility - Updated 6 occurrences in test/unit/fiori-elements.test.ts - Mock factories for node:fs and opaQUnitUtils now use dynamic imports - beforeAll and afterEach hooks use await import() to restore real implementations fiori-freestyle-writer: - Update snapshot for basic_with_toolsId test (version bump 2.5.91 -> 2.5.93) All tests pass: - ui5-test-writer: 7 suites, 217 tests, 22 snapshots ✓ - fiori-freestyle-writer: 5 suites, 36 tests, 27 snapshots ✓ - abap-deploy-config-sub-generator: 4 suites, 21 tests ✓ - cf-deploy-config-sub-generator: 4 suites, 26 tests ✓ All lint and build checks pass with 0 errors.
# Conflicts: # packages/adp-tooling/test/unit/btp/api.test.ts # packages/adp-tooling/test/unit/cf/project/yaml.test.ts # packages/adp-tooling/test/unit/cf/services/api.test.ts # packages/adp-tooling/test/unit/prompts/add-new-model/index.test.ts # packages/adp-tooling/test/unit/writer/cf.test.ts # packages/adp-tooling/test/unit/writer/changes/writers/index.test.ts # packages/create/test/unit/cli/add/new-model.test.ts # packages/generator-adp/test/unit/add-new-model/index.test.ts
…nd add createNewModelData to mocks - Remove dataSourceName prompt test in adp-tooling (merged into modelAndDatasourceName) - Add createNewModelData export to adp-tooling mock in create package - Fixes failing tests after main merge
…AndDatasourceName field
…ation expectations
…rt for ESM compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work in progress
Summary
Summary
This branch contains a comprehensive ESM (ECMAScript Module) migration and test stabilization effort across open-ux-tools.
✅ Work Completed