Repository navigation
Conversation
The ilib base path resolution only checked directories relative to the package directory (app.context). In an npm workspaces monorepo, dependencies are hoisted to the root node_modules, so ilib is not found at packages/*/node_modules/ilib. Add resolveIlibDir() that first checks the existing local paths for backward compatibility, then falls back to require.resolve() which follows Node's standard module resolution and naturally walks up to parent node_modules directories. This fixes jest moduleNameMapper and ILIB_BASE_PATH for projects using npm workspaces without requiring symlink workarounds. Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Replace the separate function with a single-line expression using the existing iLibDirs.find() with a require.resolve() fallback. Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Checklist
Issue Resolved / Feature Added
NXT-21937: The jest config ilib base path resolution only checked directories relative to
app.context(the package directory). In an npm workspaces monorepo, dependencies are hoisted to the rootnode_modules, so ilib was not found atpackages/*/node_modules/ilib, causing jestmoduleNameMapperandILIB_BASE_PATHto point to non-existent paths.Resolution
Added
resolveIlibDir()toconfig/jest/jest.config.jsthat:node_modules/@enact/i18n/ilib,node_modules/ilib,ilib) for backward compatibilityrequire.resolve("ilib/package.json", {paths: [context]})which follows Node's standard module resolution and naturally walks up to parentnode_modulesdirectoriesThis fixes both
moduleNameMapperandILIB_BASE_PATHfor projects using npm workspaces without requiring symlink workarounds.Tested against
enactjs/enactwith npm workspaces enabled — all 107 test suites pass (core 21, i18n 6, spotlight 15, ui 63, webos 2).Additional Considerations
Fully backward compatible — the existing local directory checks run first, and
require.resolveis only used as a fallback when none of them match.Links
NXT-21937
Comments
Enact-DCO-1.0-Signed-off-by: Taeyoung Hong (taeyoung.hong@lge.com)