diff --git a/CHANGELOG.md b/CHANGELOG.md index 5abfccd6..24a298d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## unreleased + +### test + +* Fixed jest config to support npm workspaces where ilib may be hoisted to a parent node_modules directory. + ## 7.4.0 (November 9, 2026) * Updated dependencies, including major updates to `chalk` (v6), `dotenv` (v18), `dotenv-expand` (v1000), `validate-npm-package-name` (v8), `@testing-library/jest-dom` (v7), `less-loader` (v13), `sass-loader` (v17), and `postcss-preset-env` (v11). diff --git a/config/jest/jest.config.js b/config/jest/jest.config.js index 17c36671..97d5266e 100644 --- a/config/jest/jest.config.js +++ b/config/jest/jest.config.js @@ -23,7 +23,15 @@ const rbConst = name => const iLibDirs = ['node_modules/@enact/i18n/ilib', 'node_modules/ilib', 'ilib']; const globals = { __DEV__: true, - ILIB_BASE_PATH: iLibDirs.find(f => fs.existsSync(path.join(app.context, f))) || iLibDirs[1], + // Support npm workspaces where ilib may be hoisted to a parent node_modules + ILIB_BASE_PATH: iLibDirs.find(f => fs.existsSync(path.join(app.context, f))) || + (() => { + try { + return path.relative(app.context, path.dirname(require.resolve('ilib/package.json', {paths: [app.context]}))); + } catch { + return iLibDirs[1]; + } + })(), ILIB_RESOURCES_PATH: 'resources', ILIB_CACHE_ID: new Date().getTime() + '', [rbConst(app.name)]: 'resources'