Skip to content

Uprade Vite 8.x and Vitest 4.x#176

Open
nnoce14 wants to merge 17 commits intomainfrom
nnoce14/issue168
Open

Uprade Vite 8.x and Vitest 4.x#176
nnoce14 wants to merge 17 commits intomainfrom
nnoce14/issue168

Conversation

@nnoce14
Copy link
Copy Markdown
Member

@nnoce14 nnoce14 commented Mar 31, 2026

Summary by Sourcery

Upgrade the monorepo to Vite 8 and Vitest 4 with Istanbul coverage, updating shared Vitest configs, package tooling, and tests to align with the new ecosystem.

New Features:

  • Introduce a shared Storybook+Vitest browser testing setup using @vitest/browser-playwright and per-package browser API ports.
  • Add reusable utilities and tsconfig presets (e.g., getDirnameFromImportMetaUrl and tsconfig.vitest.json templates) for Vitest and TypeScript integration across packages.

Bug Fixes:

  • Ensure optional MongoDB fields bar and baz are correctly removed from persisted documents when set to undefined in MongoUnitOfWork.
  • Restore Vitest mocks between Mongo integration tests to avoid cross-test interference.

Enhancements:

  • Refine Vitest configuration to enable type-checking where appropriate, disable it for ArchUnit-style test suites, and centralize coverage settings on Istanbul.
  • Modernize tests and stories to use strongly typed Vitest mocks and Storybook args, improving type safety and compatibility with newer tooling.
  • Adjust Docusaurus sidebar exports and tests for ESM/CommonJS interoperability under the updated toolchain.
  • Tighten TypeScript project configs (e.g., ui-core) by adjusting include/exclude patterns for better build hygiene.

Build:

  • Upgrade workspace-wide Vite and Vitest versions in the pnpm catalog and align dependent packages and plugins (e.g., @vitejs/plugin-react, @amiceli/vitest-cucumber, @vitest/browser).
  • Standardize coverage tooling on @vitest/coverage-istanbul across apps and packages, replacing the previous V8 coverage provider.
  • Add Vitest configs and scripts for packages that previously lacked them, and wire them into shared config packages (config-vitest, config-typescript).

Tests:

  • Update numerous unit and integration tests to the Vitest 4 API, including explicit mock typings, constructor-safe mock implementations, and async handler behavior.
  • Extend MongoUnitOfWork integration tests to cover clearing optional fields and adjust domain tests to satisfy new type requirements.

@nnoce14 nnoce14 changed the title Vite 8.x Upgrade Uprade Vite 8.x and Vitest 4.x Mar 31, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Upgrades the monorepo to Vitest 4 and Vite 8, centralizes Vitest/Storybook/browser test configuration (including shared dirname utility and coverage settings), tightens TypeScript typings and mocking patterns in tests, fixes Mongo optional-field persistence semantics, and adjusts Storybook/Docusaurus configs to align with ESM and the new toolchain.

Sequence diagram for Storybook browser tests with Vitest 4 and Playwright provider

sequenceDiagram
  participant DevVitestConfig
  participant VitestRunner
  participant StorybookPlugin as StorybookVitestPlugin
  participant BrowserApi as VitestBrowserApi
  participant Playwright as PlaywrightProvider
  participant StorybookServer
  participant ReactComponent

  DevVitestConfig->>VitestRunner: defineConfig(createStorybookVitestConfig(pkgDirname, opts))
  VitestRunner->>StorybookPlugin: load project name storybook with browser.enabled true
  StorybookPlugin->>BrowserApi: start api host 127.0.0.1 port getBrowserApiPort(pkgDirname)
  BrowserApi->>Playwright: initialize provider playwright() with instances
  Playwright->>StorybookServer: launch headless browser and open Storybook url
  StorybookServer->>ReactComponent: render component story
  VitestRunner->>ReactComponent: execute tests against rendered story
  VitestRunner->>VitestRunner: collect coverage for src/**/*.{ts,tsx}
Loading

Class diagram for shared Vitest and Storybook configuration

classDiagram
  class ConfigVitestPackage {
    <<module>>
  }

  class baseConfig {
    <<config>>
    +test_typecheck_enabled : boolean
    +test_typecheck_checker : string
    +test_typecheck_tsconfig : string
    +test_typecheck_include : string[]
    +test_typecheck_exclude : string[]
    +test_typecheck_ignoreSourceErrors : boolean
    +test_coverage_provider : string
    +test_coverage_reporter : string[]
    +test_coverage_reportsDirectory : string
  }

  class StorybookVitestConfigOptions {
    <<type>>
    +storybookDirRelativeToPackage : string
    +setupFiles : string[]
    +browsers : object[]
    +additionalCoverageExclude : string[]
  }

  class createStorybookVitestConfig {
    <<function>>
    +createStorybookVitestConfig(pkgDirname : string, opts : StorybookVitestConfigOptions) ViteUserConfig
  }

  class getBrowserApiPort {
    <<function>>
    +getBrowserApiPort(pkgDirname : string) number
  }

  class getDirnameFromImportMetaUrl {
    <<function>>
    +getDirnameFromImportMetaUrl(importMetaUrl : string) string
  }

  class StorybookBrowserProject {
    <<config>>
    +name : string
    +configFile : string
    +setupFiles : string[]
    +browser_enabled : boolean
    +browser_api_host : string
    +browser_api_port : number
    +browser_headless : boolean
    +browser_provider : PlaywrightProvider
    +browser_instances : object[]
    +coverage_include : string[]
    +coverage_exclude : string[]
  }

  class PlaywrightProvider {
    <<external>>
    +playwright() PlaywrightProvider
  }

  ConfigVitestPackage --> baseConfig : exports
  ConfigVitestPackage --> createStorybookVitestConfig : exports
  ConfigVitestPackage --> getDirnameFromImportMetaUrl : exports
  createStorybookVitestConfig --> StorybookVitestConfigOptions : uses
  createStorybookVitestConfig --> baseConfig : merges
  createStorybookVitestConfig --> getBrowserApiPort : calls
  createStorybookVitestConfig --> StorybookBrowserProject : builds
  StorybookBrowserProject --> PlaywrightProvider : uses
Loading

Flow diagram for Storybook logged-in user stories using typed args

flowchart TD
  StoryRootDefault[RootDefault Story]
  StoryRootLoading[RootLoading Story]
  StoryRootError[RootError Story]
  StoryCommunityDefault[CommunityDefault Story]

  ArgsRoot[args satisfies LoggedInUserContainerProps]
  ArgsRootRootContainer[args.autoLogin passed to LoggedInUserRootContainer]

  ComponentLoggedInContainer[LoggedInUserContainer]
  ComponentLoggedInRootContainer[LoggedInUserRootContainer]
  RouterRoutes[React Router Routes]

  StoryRootDefault --> ArgsRoot
  StoryRootLoading --> ArgsRoot
  StoryRootError --> ArgsRoot
  StoryCommunityDefault --> ArgsRoot

  ArgsRoot --> RouterRoutes
  RouterRoutes --> ComponentLoggedInContainer
  StoryRootDefault --> RouterRoutes
  StoryRootLoading --> RouterRoutes
  StoryRootError --> RouterRoutes
  StoryCommunityDefault --> RouterRoutes

  ComponentLoggedInRootContainer --> ComponentLoggedInContainer
  ArgsRoot --> ComponentLoggedInRootContainer
Loading

File-Level Changes

Change Details Files
Enable shared Vitest base config with Istanbul coverage and optional type-checking via tsconfig.vitest.json across the workspace.
  • Extend base Vitest config with tsc-based typecheck defaults, Istanbul coverage provider, and standardized include/exclude patterns.
  • Publish tsconfig.vitest.json from @cellix/config-typescript and add it to multiple apps/packages plus archunit-style opt-out configs.
  • Wire Vitest into various packages/apps (API, docs, UI, GraphQL, domain, persistence, services) with @vitest/coverage-istanbul in devDependencies and catalog, updating workspace catalog for vitest/vite versions.
packages/cellix/config-vitest/src/configs/base.config.ts
packages/cellix/config-typescript/package.json
packages/cellix/config-typescript/tsconfig.vitest.json
apps/api/tsconfig.vitest.json
apps/docs/tsconfig.vitest.json
apps/ui-community/tsconfig.vitest.json
packages/*/*/tsconfig.vitest.json
pnpm-workspace.yaml
package.json
packages/*/*/package.json
Modernize Storybook+Vitest browser testing setup and reuse it across UI packages.
  • Refactor Storybook Vitest config helper to use @vitest/browser-playwright with deterministic per-package API ports and explicit coverage include/exclude lists.
  • Expose a shared dirname-from-import.meta.url utility and replace local path/fileURLToPath logic in Storybook-based vitest.config files.
  • Tighten Storybook stories typing by separating component type from props and moving props into typed args for logged-in-user stories.
packages/cellix/config-vitest/src/configs/storybook.config.ts
packages/cellix/config-vitest/src/utils/dirname.ts
packages/cellix/config-vitest/src/index.ts
packages/cellix/config-vitest/tsconfig.json
apps/ui-community/vitest.config.ts
packages/cellix/ui-core/vitest.config.ts
packages/ocom/ui-components/vitest.config.ts
apps/ui-community/package.json
packages/cellix/ui-core/package.json
packages/ocom/ui-components/package.json
packages/ocom/ui-components/src/components/organisms/header/logged-in-user.container.stories.tsx
packages/ocom/ui-components/src/components/organisms/header/logged-in-user-root.container.stories.tsx
packages/ocom/ui-components/src/components/organisms/header/logged-in-user-community.container.stories.tsx
packages/ocom/ui-components/src/components/organisms/header/logged-in-user-root.stories.tsx
Fix Mongo optional-field semantics and strengthen Mongo unit-of-work and adapter tests.
  • Change TestAggregate optional fields bar/baz to use explicit undefined, adjusting domain event payloads so events are only emitted when values are non-undefined and old values are optional.
  • Update TestAdapter setters to clear Mongo document fields via doc.set when values are undefined to ensure they are removed from persisted documents.
  • Add an integration test that asserts bar/baz are absent (not just undefined) in both lean() results and raw Mongo documents after being set to undefined, and restore Vitest mocks before each test.
packages/cellix/mongoose-seedwork/tests/integration/mongo-unit-of-work.integration.test.ts
Align Vitest mocking patterns, handler types, and constructor mocks with Vitest 4 expectations.
  • Introduce a reusable AsyncHandlerMock type and apply it to node and in-process event-bus tests, updating handlers to async arrow functions or explicit Promise-returning functions instead of .mockResolvedValue/.mockRejectedValue in some cases.
  • Refine domain/mongo unit-of-work tests to use typed Mock signatures for handlers, repository factories, and getIntegrationEvents return types.
  • Update various service and persistence tests to mock constructors via vi.mocked(...).mockImplementation(function NamedMock() {...}) and to strongly type mocked methods (e.g., VerifiedTokenService.getVerifiedJwt, ApolloServer constructor, MongooseSeedwork.ObjectId).
packages/cellix/event-bus-seedwork-node/src/test-handler.types.ts
packages/cellix/event-bus-seedwork-node/src/node-event-bus.test.ts
packages/cellix/event-bus-seedwork-node/src/in-proc-event-bus.test.ts
packages/cellix/mongoose-seedwork/src/mongoose-seedwork/mongo-unit-of-work.test.ts
packages/ocom/service-token-validation/src/index.test.ts
packages/ocom/persistence/src/datasources/readonly/community/member/member.read-repository.test.ts
packages/ocom/persistence/src/datasources/readonly/community/community/community.read-repository.test.ts
packages/ocom/persistence/src/datasources/readonly/community/member/index.test.ts
packages/ocom/persistence/src/datasources/readonly/user/end-user/end-user.read-repository.test.ts
packages/ocom/persistence/src/datasources/readonly/user/end-user/index.test.ts
packages/ocom/service-apollo-server/src/index.test.ts
packages/ocom/service-otel/src/otel-builder.test.ts
packages/cellix/domain-seedwork/src/domain-seedwork/handle-event.test.ts
packages/ocom/domain/tests/integration/community-management.integration.test.ts
packages/cellix/graphql-codegen/tests/schema-builder.unit.test.ts
Make docs app and Docusaurus config compatible with ESM, Vitest 4, and typed sidebars.
  • Rename docs Vitest config to .mts, add @vitejs/plugin-react and React plugin usage, simplify coverage paths, and adjust resolver aliases for test mocks.
  • Change sidebars.ts to use import(...) type-only SidebarsConfig while exporting via CommonJS module.exports, and adapt the sidebar test to import using createRequire in an ESM-friendly way.
  • Include vitest.config.mts in docs tsconfig, and ensure GraphQL-codegen and docs packages use the new coverage plugin and versions.
apps/docs/vitest.config.mts
apps/docs/vitest.config.ts (removed/renamed)
apps/docs/sidebars.ts
apps/docs/sidebars.test.mts
apps/docs/tsconfig.json
apps/docs/package.json
packages/cellix/graphql-codegen/package.json
packages/cellix/graphql-codegen/tests/schema-builder.unit.test.ts
Adjust archunit-style test suites to cooperate with the new Vitest baseline while keeping their special runtime constraints.
  • Disable Vitest typecheck for archunit test configs while keeping globals and timeouts tuned.
  • Relax explicit test timeout usage by relying on default timeouts in long-running dependency rules tests.
packages/cellix/archunit-tests/vitest.config.ts
packages/ocom/archunit-tests/vitest.config.ts
packages/cellix/archunit-tests/src/dependency-rules.test.ts
Update documentation and miscellaneous tooling to reflect the new coverage provider and clean up obsolete configs.
  • Switch README dev setup instructions from @vitest/coverage-v8 to @vitest/coverage-istanbul.
  • Remove now-unnecessary turbo.json files from certain UI packages and keep knip/pnpm-lock/turbo.json in sync with new dependencies and versions.
readme.md
apps/ui-community/turbo.json
packages/ocom/ui-components/turbo.json
knip.json
pnpm-lock.yaml
turbo.json

Assessment against linked issues

Issue Objective Addressed Explanation
#139 Upgrade all Vitest-related dependencies (Vitest core, coverage provider, browser tooling, plugins) across the monorepo to Vitest 4.x and compatible versions.
#139 Update Vitest configs, TypeScript configs, and tests in all relevant packages to be compatible with Vitest 4.x (including browser/Storybook setups and type-checking), so that the test suite can run successfully.
#139 Update documentation and configuration references (e.g., README, package/docs config) to reflect the new Vitest 4.x workflow and coverage provider.

Possibly linked issues

  • #Upgrade Vitest to 4.x across monorepo: PR performs the Vitest 4.x upgrade monorepo-wide, updates configs, coverage, and docs, satisfying the issue’s scope.
  • #(none provided): PR updates catalog to Vite 8.0.3, adjusts configs, and runs tests, satisfying the Vite 8.x upgrade issue.
  • #Upgrade vite to 8.x: PR performs the requested upgrade to Vite 8 and Vitest 4, updating configs, coverage, and related tooling accordingly.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@nnoce14 nnoce14 linked an issue Mar 31, 2026 that may be closed by this pull request
@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In apps/ui-community/package.json and packages/ocom/ui-components/package.json, the test:coverage scripts now just run pnpm run test without coverage flags, which is confusing given the script name—consider either reintroducing the --coverage options or renaming these scripts to reflect their behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `apps/ui-community/package.json` and `packages/ocom/ui-components/package.json`, the `test:coverage` scripts now just run `pnpm run test` without coverage flags, which is confusing given the script name—consider either reintroducing the `--coverage` options or renaming these scripts to reflect their behavior.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In packages/cellix/ui-core/vitest.config.ts you explicitly set test.coverage.provider = 'istanbul', but this is already defined centrally in baseConfig; consider relying on the shared config to avoid redundant per-package overrides that can drift over time.
  • Adding "types": ["vitest/globals", "@testing-library/jest-dom"] directly to packages/cellix/ui-core/tsconfig.json mixes test-only types into the library’s main TS config; it may be cleaner to move these to a dedicated test tsconfig (or tsconfig.vitest.json) that extends the base one so consumers of the library don’t implicitly inherit test globals.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `packages/cellix/ui-core/vitest.config.ts` you explicitly set `test.coverage.provider = 'istanbul'`, but this is already defined centrally in `baseConfig`; consider relying on the shared config to avoid redundant per-package overrides that can drift over time.
- Adding `"types": ["vitest/globals", "@testing-library/jest-dom"]` directly to `packages/cellix/ui-core/tsconfig.json` mixes test-only types into the library’s main TS config; it may be cleaner to move these to a dedicated test tsconfig (or `tsconfig.vitest.json`) that extends the base one so consumers of the library don’t implicitly inherit test globals.

## Individual Comments

### Comment 1
<location path="packages/cellix/ui-core/src/components/molecules/require-auth/index.test.tsx" line_range="145-154" />
<code_context>
+    expect(window.sessionStorage.getItem('redirectTo')).toBe('/private?tab=1');
+  });
+
+  it('does not auto-login when auth params are present', async () => {
+    const signinRedirect = vi.fn().mockResolvedValue(undefined);
+
+    mockHasAuthParams.mockReturnValue(true);
+    mockUseAuth.mockReturnValue({
+      isLoading: false,
+      activeNavigator: undefined,
+      isAuthenticated: false,
+      error: undefined,
+      signinRedirect,
+    });
+
+    render(
+      <MemoryRouter>
+        <RequireAuth forceLogin>
+          <div>Private content</div>
+        </RequireAuth>
+      </MemoryRouter>,
+    );
+
+    await waitFor(() => {
+      expect(signinRedirect).toHaveBeenCalledTimes(1);
+    });
+
+    expect(window.sessionStorage.getItem('redirectTo')).toBeNull();
+  });
+});
</code_context>
<issue_to_address>
**issue (testing):** Test description and expectations contradict each other regarding auto-login behavior.

The test name says it "does not auto-login" when auth params are present, yet it asserts `signinRedirect` is called once. If the behavior should skip `signinRedirect` when `hasAuthParams` is true, this assertion should expect it not to be called. If calling `signinRedirect` once is correct, please update the test name/description to reflect that behavior more clearly.
</issue_to_address>

Hi @nnoce14! 👋

Thanks for trying out Sourcery by commenting with @sourcery-ai review! 🚀

Install the sourcery-ai bot to get automatic code reviews on every pull request ✨

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In packages/cellix/ui-core/vitest.config.ts, the explicit test.coverage.provider: 'istanbul' override appears redundant now that baseConfig already sets Istanbul globally, so you could simplify by relying on the shared config unless you intend to diverge locally.
  • The header story files in packages/ocom/ui-components now type Meta and StoryObj with *Props instead of typeof Component; this drops the link to the actual component type and may reduce Storybook/TS inference (e.g. for args and controls), so consider keeping typeof Component in the meta and story types for stronger type safety.
  • In apps/ui-community/package.json, the "test:coverage" script uses different indentation than the surrounding scripts, which could be normalized to keep the JSON formatting consistent with the rest of the repo.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `packages/cellix/ui-core/vitest.config.ts`, the explicit `test.coverage.provider: 'istanbul'` override appears redundant now that `baseConfig` already sets Istanbul globally, so you could simplify by relying on the shared config unless you intend to diverge locally.
- The header story files in `packages/ocom/ui-components` now type `Meta` and `StoryObj` with `*Props` instead of `typeof Component`; this drops the link to the actual component type and may reduce Storybook/TS inference (e.g. for args and controls), so consider keeping `typeof Component` in the meta and story types for stronger type safety.
- In `apps/ui-community/package.json`, the `"test:coverage"` script uses different indentation than the surrounding scripts, which could be normalized to keep the JSON formatting consistent with the rest of the repo.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…t.config.ts and shared config, update test description in RequireAuth tests
@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

…h tests and adjust biome version in lockfile to fix pipeline
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In packages/cellix/ui-core/tsconfig.json, adding vitest/globals and @testing-library/jest-dom to the top-level types for the package will leak test-only types into the library’s public type surface; consider moving these to a dedicated test tsconfig or using tsconfig.test.json that extends the main config instead.
  • The new packages/cellix/ui-core/vitest.setup.ts file is introduced but doesn’t appear to be referenced by the ui-core Vitest configuration (which still defaults to .storybook/vitest.setup.ts); either wire this file into createStorybookVitestConfig or remove it to avoid confusion.
  • For the updated Storybook stories where Meta/StoryObj generics now use ...Props types, consider also setting the component field explicitly in the meta object to preserve strong linkage to the React component for Storybook tooling and typings.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `packages/cellix/ui-core/tsconfig.json`, adding `vitest/globals` and `@testing-library/jest-dom` to the top-level `types` for the package will leak test-only types into the library’s public type surface; consider moving these to a dedicated test tsconfig or using `tsconfig.test.json` that extends the main config instead.
- The new `packages/cellix/ui-core/vitest.setup.ts` file is introduced but doesn’t appear to be referenced by the ui-core Vitest configuration (which still defaults to `.storybook/vitest.setup.ts`); either wire this file into `createStorybookVitestConfig` or remove it to avoid confusion.
- For the updated Storybook stories where `Meta`/`StoryObj` generics now use `...Props` types, consider also setting the `component` field explicitly in the `meta` object to preserve strong linkage to the React component for Storybook tooling and typings.

## Individual Comments

### Comment 1
<location path="packages/cellix/ui-core/vitest.config.ts" line_range="8-17" />
<code_context>
+    ? path.dirname(fileURLToPath(import.meta.url))
+    : __dirname;

 export default defineConfig(
-	createStorybookVitestConfig(dirname, {
-		additionalCoverageExclude: ['eslint.config.js'],
</code_context>
<issue_to_address>
**issue (bug_risk):** Unbalanced parentheses around `defineConfig` and `createStorybookVitestConfig` make this file syntactically invalid.

In the previous version, both `createStorybookVitestConfig(` and `defineConfig(` were closed with `}),` and `);`. In the new version there are still two opening parens but only one closing `)` at the end of the file, so the file won’t parse. You need to close both calls, e.g.:

```ts
export default defineConfig(
  createStorybookVitestConfig(dirname, {
    additionalCoverageExclude: [
      'src/index.ts',
      'src/components/index.ts',
      'src/components/molecules/index.tsx',
      'src/components/organisms/index.tsx',
    ],
  }),
);
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai dismiss

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In mongo-unit-of-work.integration.test.ts you added vi.restoreAllMocks() in beforeEach, which will also clear any spies/mocks set up at describe scope—if there are (or will be) top-level mocks that should persist across scenarios, consider moving restoreAllMocks to afterEach or scoping it more narrowly to avoid unintentionally resetting shared mocks.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `mongo-unit-of-work.integration.test.ts` you added `vi.restoreAllMocks()` in `beforeEach`, which will also clear any spies/mocks set up at `describe` scope—if there are (or will be) top-level mocks that should persist across scenarios, consider moving `restoreAllMocks` to `afterEach` or scoping it more narrowly to avoid unintentionally resetting shared mocks.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14 nnoce14 marked this pull request as ready for review March 31, 2026 15:44
@nnoce14 nnoce14 requested a review from a team as a code owner March 31, 2026 15:44
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The logged-in user Storybook stories now repeat the same args: { autoLogin: false } and (args) => render pattern across multiple variants; consider setting meta.args or a shared base story to reduce duplication and make changes to default args easier.
  • The dirname fallback logic using typeof __dirname === 'undefined' ? path.dirname(fileURLToPath(import.meta.url)) : __dirname is now duplicated across several Vitest configs; you could extract this into a small shared helper to keep the configuration DRY and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logged-in user Storybook stories now repeat the same `args: { autoLogin: false }` and `(args) =>` render pattern across multiple variants; consider setting `meta.args` or a shared base story to reduce duplication and make changes to default args easier.
- The `dirname` fallback logic using `typeof __dirname === 'undefined' ? path.dirname(fileURLToPath(import.meta.url)) : __dirname` is now duplicated across several Vitest configs; you could extract this into a small shared helper to keep the configuration DRY and easier to maintain.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/tsconfig.json" line_range="3-6" />
<code_context>
 {
   "extends": "@cellix/config-typescript/node",
   "compilerOptions": {
+    "lib": ["ES2023", "DOM"],
     "outDir": "dist",
     "rootDir": "src",
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Including the DOM lib in a config package may hide type issues for non-DOM consumers.

Since this helper is used by both Node and browser projects, enabling `DOM` here encourages accidental use of browser globals in code that may run in Node. If this config is meant for Node only, consider restricting `lib` to ES libs and letting downstream browser apps add `DOM` themselves so typings match the actual runtime.

```suggestion
  "compilerOptions": {
    "lib": ["ES2023"],
    "outDir": "dist",
    "rootDir": "src",
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

… vitest type checking for test files without polluting production output with test files and dev dependencies

- Updated sidebars.ts to use ES module syntax for exporting sidebars.
- Modified vitest.config.ts files across multiple packages to disable type checking.
- Added tsconfig.vitest.json files to various packages and apps to extend base TypeScript configurations for Vitest.
- Enhanced test files to use Mock types for better type safety and clarity.
- Adjusted test implementations to ensure proper async handling and error propagation.
- Updated turbo.json to streamline build dependencies and inputs.
@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In packages/cellix/mongoose-seedwork/tests/integration/mongo-unit-of-work.integration.test.ts the imports from ../../src/... were changed to include .ts extensions; unless allowImportingTsExtensions is enabled everywhere, this can break TypeScript module resolution and bundling, so consider reverting to extension-less imports for internal TS modules.
  • The change in apps/docs/sidebars.ts from module.exports = sidebars satisfies SidebarsConfig to export = sidebars loses the satisfies constraint and mixes TS export = with the existing CommonJS expectation; consider keeping the satisfies check (e.g. via a separate typed constant) and double‑check that the emitted JS still matches what Docusaurus expects (plain module.exports = ...).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `packages/cellix/mongoose-seedwork/tests/integration/mongo-unit-of-work.integration.test.ts` the imports from `../../src/...` were changed to include `.ts` extensions; unless `allowImportingTsExtensions` is enabled everywhere, this can break TypeScript module resolution and bundling, so consider reverting to extension-less imports for internal TS modules.
- The change in `apps/docs/sidebars.ts` from `module.exports = sidebars satisfies SidebarsConfig` to `export = sidebars` loses the `satisfies` constraint and mixes TS `export =` with the existing CommonJS expectation; consider keeping the `satisfies` check (e.g. via a separate typed constant) and double‑check that the emitted JS still matches what Docusaurus expects (plain `module.exports = ...`).

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new tsconfig.vitest.json files are duplicated across many apps and packages; consider centralizing the shared config in @cellix/config-typescript and having each package extend it to reduce configuration drift.
  • In mongo-unit-of-work.integration.test.ts you switched to importing source files with explicit .ts extensions (e.g. '../../src/mongoose-seedwork/mongo-unit-of-work.ts'); it might be safer and more consistent to use extensionless imports like the rest of the codebase, depending on your moduleResolution settings.
  • Several tests now replace mockResolvedValue/mockRejectedValue with explicit Promise.resolve/Promise.reject wrappers around vi.fn; you might be able to keep the more concise mock helpers by tightening the Mock typing instead, which would make the tests shorter and easier to read.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new tsconfig.vitest.json files are duplicated across many apps and packages; consider centralizing the shared config in @cellix/config-typescript and having each package extend it to reduce configuration drift.
- In mongo-unit-of-work.integration.test.ts you switched to importing source files with explicit .ts extensions (e.g. '../../src/mongoose-seedwork/mongo-unit-of-work.ts'); it might be safer and more consistent to use extensionless imports like the rest of the codebase, depending on your moduleResolution settings.
- Several tests now replace mockResolvedValue/mockRejectedValue with explicit Promise.resolve/Promise.reject wrappers around vi.fn; you might be able to keep the more concise mock helpers by tightening the Mock<T> typing instead, which would make the tests shorter and easier to read.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • You introduce several local Mock<...> type aliases for handlers (e.g. TestEventHandler, EventAHandler, etc.); consider extracting a small shared helper/util type for async and sync handlers to avoid repeating similar alias definitions across tests and keep handler signatures consistent.
  • The dirname resolution pattern for ESM (typeof __dirname === 'undefined' ? path.dirname(fileURLToPath(import.meta.url)) : __dirname) is duplicated across multiple Vitest configs; factoring this into a small shared utility would reduce repetition and make future changes (e.g. if the pattern needs to change) easier.
  • In apps/ui-community/package.json, the test:coverage script line is indented with spaces instead of tabs like the surrounding entries, which makes the scripts block visually inconsistent; aligning the indentation would improve readability.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You introduce several local `Mock<...>` type aliases for handlers (e.g. `TestEventHandler`, `EventAHandler`, etc.); consider extracting a small shared helper/util type for async and sync handlers to avoid repeating similar alias definitions across tests and keep handler signatures consistent.
- The `dirname` resolution pattern for ESM (`typeof __dirname === 'undefined' ? path.dirname(fileURLToPath(import.meta.url)) : __dirname`) is duplicated across multiple Vitest configs; factoring this into a small shared utility would reduce repetition and make future changes (e.g. if the pattern needs to change) easier.
- In `apps/ui-community/package.json`, the `test:coverage` script line is indented with spaces instead of tabs like the surrounding entries, which makes the scripts block visually inconsistent; aligning the indentation would improve readability.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/src/configs/storybook.config.ts" line_range="35" />
<code_context>
               enabled: true,
               headless: true,
-              provider: 'playwright',
+              provider: playwright(),
               instances,
             },
</code_context>
<issue_to_address>
**issue (bug_risk):** The `browser.provider` option likely expects a string identifier (e.g. `'playwright'`) rather than `playwright()`.

In Vitest 4, `browser.provider` is typically a string identifier like `'playwright'`, while `playwright()` is meant to be used in the top-level `plugins` array. Using `playwright()` here likely violates the expected type and could break browser tests. Please keep `provider: 'playwright'` and configure `playwright()` via plugins, or confirm in the latest Vitest browser docs that passing the plugin instance here is supported before proceeding.
</issue_to_address>

### Comment 2
<location path="apps/ui-community/vitest.config.ts" line_range="12" />
<code_context>
+	export default defineConfig(
</code_context>
<issue_to_address>
**issue (bug_risk):** `createStorybookVitestConfig` is called without the `opts` argument even though the function signature requires it.

Here `createStorybookVitestConfig` is called as `createStorybookVitestConfig(dirname)` but its `opts: StorybookVitestConfigOptions` parameter is required. This will fail type checking and may break assumptions about `opts`. Please either make `opts` optional with a default (`opts: StorybookVitestConfigOptions = {}`) or pass `{}`/explicit options here.
</issue_to_address>

Hi @nnoce14! 👋

Thanks for trying out Sourcery by commenting with @sourcery-ai review! 🚀

Install the sourcery-ai bot to get automatic code reviews on every pull request ✨

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…omImportMetaUrl utility and updating related imports according to sourcery suggestions
@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai dismiss

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • Several vitest configs now import getDirnameFromImportMetaUrl from @cellix/config-vitest, but the package’s public src/index.ts does not export this helper, so consumers will currently fail to build/run; consider re-exporting it from index.ts (and the package’s exports field if needed).
  • With typecheck enabled in the shared Vitest base config and tsconfig.vitest.json wired as the tsconfig, double-check that every workspace that runs Vitest either has an appropriate tsconfig.vitest.json committed or overrides test.typecheck locally to avoid unexpected typecheck failures.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Several vitest configs now import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, but the package’s public `src/index.ts` does not export this helper, so consumers will currently fail to build/run; consider re-exporting it from `index.ts` (and the package’s exports field if needed).
- With `typecheck` enabled in the shared Vitest base config and `tsconfig.vitest.json` wired as the tsconfig, double-check that every workspace that runs Vitest either has an appropriate `tsconfig.vitest.json` committed or overrides `test.typecheck` locally to avoid unexpected typecheck failures.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/src/index.ts" line_range="1-3" />
<code_context>
 export { baseConfig } from "./configs/base.config.ts";
 export { nodeConfig } from "./configs/node.config.ts";
-export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
\ No newline at end of file
+export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
</code_context>
<issue_to_address>
**issue (bug_risk):** Re-export `getDirnameFromImportMetaUrl` so consumers can import it from `@cellix/config-vitest`.

Several configs now import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, but this symbol is only defined in `src/utils/dirname.ts` and not exported from the package entry. Those imports will fail at runtime. Please re-export it here (e.g. `export { getDirnameFromImportMetaUrl } from "./utils/dirname.ts";` or via a barrel) so it’s available to consumers.
</issue_to_address>

### Comment 2
<location path="packages/cellix/mongoose-seedwork/tests/integration/mongo-unit-of-work.integration.test.ts" line_range="123-132" />
<code_context>
 		return this.doc.bar;
 	}
 	set bar(value: string | undefined) {
+		if (value === undefined) {
+			delete this.doc.bar;
+			return;
+		}
 		this.doc.bar = value;
 	}
 	get baz(): string | undefined {
 		return this.doc.baz;
 	}
 	set baz(value: string | undefined) {
+		if (value === undefined) {
+			delete this.doc.baz;
+			return;
+		}
 		this.doc.baz = value;
 	}
 }
</code_context>
<issue_to_address>
**suggestion (testing):** Add an integration assertion that `bar`/`baz` are actually removed from the Mongo document when set to `undefined`

Since the setters now `delete` these fields when set to `undefined`, add an integration test that:

- creates a model with `bar`/`baz` set
- updates it with `bar` and/or `baz` set to `undefined`
- commits via `MongoUnitOfWork`
- asserts the persisted `TestModel` document no longer has those fields (e.g., `expect(doc.bar).toBeUndefined()` or using `"bar" in doc` checks).

This ensures we don’t regress to storing `null` or otherwise retaining the fields instead of removing them.

Suggested implementation:

```typescript
	beforeEach(async () => {
		vi.restoreAllMocks();
		await TestModel.deleteMany({});
		// biome-ignore lint:useLiteralKeys
		eventBus['eventSubscribers'] = {};
	});

	it('removes bar/baz fields from the persisted document when set to undefined', async () => {
		// Arrange: create and persist initial document with bar and baz set
		const initial = await TestModel.create({
			foo: 'foo-value',
			bar: 'bar-value',
			baz: 'baz-value',
		});

		// Act: use MongoUnitOfWork to load, update, and commit the aggregate
		const uow = new MongoUnitOfWork(connection);
		await uow.start();

		const repo = new TestModelRepository(uow);
		const aggregate = await repo.getById(initial.id);
		if (!aggregate) {
			throw new Error('Expected aggregate to be loaded');
		}

		aggregate.bar = undefined;
		aggregate.baz = undefined;

		await repo.save(aggregate);
		await uow.commit();

		// Assert: reload raw document and ensure bar/baz are removed
		const persisted = await TestModel.findById(initial.id).lean().exec();

		expect(persisted).not.toBeNull();
		expect('bar' in persisted!).toBe(false);
		expect('baz' in persisted!).toBe(false);
		expect(persisted!.bar).toBeUndefined();
		expect(persisted!.baz).toBeUndefined();
	});

```

Depending on the existing test setup in this file, you may need to:

1. Ensure `MongoUnitOfWork`, `TestModelRepository`, and `connection` are imported at the top of the file (or use the same repository/connection objects as the other tests in this file).
2. If the repository or unit-of-work instantiation is done via helpers (e.g., `makeTestRepository(uow)` or similar), adjust the `new MongoUnitOfWork(connection)` and `new TestModelRepository(uow)` lines to match the conventions already used in the other integration tests.
3. If `foo` is not a required field in your schema (or another required field exists), update the `{ foo: 'foo-value', ... }` initializer to satisfy the actual `TestModel` schema requirements.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

nnoce14 added 2 commits March 31, 2026 14:08
… for optional fields handling according to sourcery suggestion
@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

@nnoce14 nnoce14 closed this Mar 31, 2026
@nnoce14 nnoce14 reopened this Mar 31, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Consumers now import getDirnameFromImportMetaUrl from @cellix/config-vitest, but src/index.ts only re-exports baseConfig, nodeConfig, and createStorybookVitestConfig, so you should re-export getDirnameFromImportMetaUrl there to avoid runtime/TS resolution errors.
  • createStorybookVitestConfig no longer uses the additionalCoverageExclude option when building the coverage.exclude array, which is a behavior change from the previous version; if that option is still intended, merge it into the exclude list so existing per-package overrides continue to work.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consumers now import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, but `src/index.ts` only re-exports `baseConfig`, `nodeConfig`, and `createStorybookVitestConfig`, so you should re-export `getDirnameFromImportMetaUrl` there to avoid runtime/TS resolution errors.
- `createStorybookVitestConfig` no longer uses the `additionalCoverageExclude` option when building the `coverage.exclude` array, which is a behavior change from the previous version; if that option is still intended, merge it into the exclude list so existing per-package overrides continue to work.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/src/index.ts" line_range="1-3" />
<code_context>
 export { baseConfig } from "./configs/base.config.ts";
 export { nodeConfig } from "./configs/node.config.ts";
-export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
\ No newline at end of file
+export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
</code_context>
<issue_to_address>
**issue (bug_risk):** The new `getDirnameFromImportMetaUrl` helper is not exported from the package entrypoint, causing imports from `@cellix/config-vitest` to fail.

Several Vitest configs (e.g. `apps/ui-community/vitest.config.ts`, `packages/cellix/ui-core/vitest.config.ts`, `packages/ocom/ui-components/vitest.config.ts`) import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, but `src/index.ts` doesn’t re-export it, so those imports will be `undefined` at runtime.

Please add a re-export, for example:
```ts
export { getDirnameFromImportMetaUrl } from "./utils/dirname.ts";
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new getDirnameFromImportMetaUrl helper is used via import { createStorybookVitestConfig, getDirnameFromImportMetaUrl } from '@cellix/config-vitest', but it isn’t exported from packages/cellix/config-vitest/src/index.ts; add it to the index exports so consumers can import it without relying on deep paths.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new getDirnameFromImportMetaUrl helper is used via `import { createStorybookVitestConfig, getDirnameFromImportMetaUrl } from '@cellix/config-vitest'`, but it isn’t exported from `packages/cellix/config-vitest/src/index.ts`; add it to the index exports so consumers can import it without relying on deep paths.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/src/index.ts" line_range="1-3" />
<code_context>
 export { baseConfig } from "./configs/base.config.ts";
 export { nodeConfig } from "./configs/node.config.ts";
-export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
\ No newline at end of file
+export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
</code_context>
<issue_to_address>
**issue (bug_risk):** The new `getDirnameFromImportMetaUrl` helper is not exported but is used by consumers, which will cause build/runtime failures.

Several Vitest config files (e.g. `apps/ui-community/vitest.config.ts`, `packages/cellix/ui-core/vitest.config.ts`, `packages/ocom/ui-components/vitest.config.ts`) import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, but `src/index.ts` does not export it. Please re-export it here, e.g.

```ts
export { getDirnameFromImportMetaUrl } from "./utils/dirname.ts";
```

(or via a `utils` barrel) so those configs continue to work after compilation.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new getDirnameFromImportMetaUrl helper is used from @cellix/config-vitest in multiple vitest configs but isn’t exported from src/index.ts, so consumers importing it from the package entrypoint will fail to build—consider re-exporting it alongside baseConfig/nodeConfig/createStorybookVitestConfig.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `getDirnameFromImportMetaUrl` helper is used from `@cellix/config-vitest` in multiple vitest configs but isn’t exported from `src/index.ts`, so consumers importing it from the package entrypoint will fail to build—consider re-exporting it alongside `baseConfig`/`nodeConfig`/`createStorybookVitestConfig`.

## Individual Comments

### Comment 1
<location path="packages/cellix/config-vitest/src/index.ts" line_range="1-3" />
<code_context>
 export { baseConfig } from "./configs/base.config.ts";
 export { nodeConfig } from "./configs/node.config.ts";
-export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
\ No newline at end of file
+export { createStorybookVitestConfig, type StorybookVitestConfigOptions } from "./configs/storybook.config.ts";
</code_context>
<issue_to_address>
**issue (bug_risk):** The new `getDirnameFromImportMetaUrl` helper isn’t re-exported from the package entrypoint, but is imported from `@cellix/config-vitest` elsewhere.

These vitest configs (`apps/ui-community/vitest.config.ts`, `packages/cellix/ui-core/vitest.config.ts`, `packages/ocom/ui-components/vitest.config.ts`) already import `getDirnameFromImportMetaUrl` from `@cellix/config-vitest`, so without re-exporting it from `src/index.ts` those imports will fail. Please add:

```ts
export { getDirnameFromImportMetaUrl } from './utils/dirname.ts';
```

to align the public API with existing usage.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nnoce14
Copy link
Copy Markdown
Member Author

nnoce14 commented Mar 31, 2026

@sourcery-ai summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade Vitest to 4.x across monorepo

2 participants