Skip to content

refactor(adapters.injectionjs,unit): add injection-js dependency injection adapter support#934

Open
omermorad wants to merge 68 commits intonextfrom
feat/iss-931/support-injectionjs-adapter
Open

refactor(adapters.injectionjs,unit): add injection-js dependency injection adapter support#934
omermorad wants to merge 68 commits intonextfrom
feat/iss-931/support-injectionjs-adapter

Conversation

@omermorad
Copy link
Copy Markdown
Collaborator

Relates #931

Update .gitignore to properly handle TypeScript declaration files,
allowing user-created global.d.ts files to be committed when needed
for type augmentation configuration.
Change from 'lerna version prerelease' to 'lerna version --conventional-commits
--conventional-prerelease' to properly respect breaking changes and conventional
commit types when creating prerelease versions.

The old command ignored conventional commits and just bumped the patch version,
resulting in incorrect versions like 3.0.2-dev.0 instead of 4.0.0-dev.0 when
there are breaking changes.

This aligns with the fix we made in the e2e workflow and ensures version
numbers correctly reflect the semantic changes in commits.
Add JSDoc style guide documenting standards for the Suites project.
Includes templates for classes, interfaces, methods, types, and errors
with real examples from the codebase and guidelines for consistent
documentation across all packages.
Add global.d.ts files and update tsconfig in all e2e test projects to
adopt the new explicit type augmentation pattern.

Each test project now explicitly declares which doubles adapter to use
via triple-slash reference directives.
Add comprehensive type safety tests to verify that module augmentation
works correctly for both NestJS and Inversify DI adapters.

NestJS tests verify:
- IdentifierMetadata is restricted to 'never'
- Metadata parameters are not allowed (using @ts-expect-error)
- Mocking without metadata works correctly

Inversify tests verify:
- IdentifierMetadata allows metadata objects
- Metadata parameters are accepted for string and symbol tokens
- Complex metadata objects are supported
- Metadata is optional (backward compatibility)

These tests ensure the abstraction/augmentation pattern maintains proper
type safety across all test runners (Jest, Vitest, Sinon).
Upgrade ts-mocha from 10.0.0 to 11.1.0 and add explicit ts-node 10.9.2
with proper configuration to improve TypeScript transpilation on Node 22/24.

Changes:
- Upgrade ts-mocha: 10.0.0 → 11.1.0
- Add ts-node: ^10.9.2
- Configure ts-node in tsconfig.json:
  - transpileOnly: true (faster)
  - module: commonjs (explicit CJS)
  - esModuleInterop: true

Note: MODULE_TYPELESS_PACKAGE_JSON warnings may still appear on Node 22/24
when running ts-mocha. This is a known limitation of ts-mocha's module
handling with Node's stricter module detection. The warning is harmless -
tests execute correctly with a minor performance overhead during module
type detection. Users can safely ignore this warning.

Alternative: Use Jest or Vitest which handle TypeScript/ESM better.

Relates to #811
- Remove @suites/types.doubles dependency from core (not in v3.0.0)
- Revert reflect-metadata version constraint in di.inversify
- Remove Node >= 20 engine requirement from types.doubles
- Remove @suites/types.common dependency from types.doubles

These changes were inadvertently included during conflict resolution.
Infrastructure changes (workspace: protocol, pnpm scripts) are retained.
pnpm 10.14.0 requires Node >= 18.12, which breaks v3.x Node 16 support.
Using pnpm 8.15.9 (last stable 8.x) which supports Node 16.14+.

Changes:
- Update all workflow files to use pnpm 8.15.9
- Update packageManager field in all package.json files
- Regenerate pnpm-lock.yaml with pnpm 8.x
- Use 'pnpm exec manypkg check' instead of 'pnpm manypkg check'
- Use lerna's '--ignore' flag instead of pnpm's '--filter' for Node 16 build
…g check

- Restore @suites/types.common dependency in types.doubles (required by index.ts)
- Remove manypkg validation step (package not available in pnpm 8.x setup)
- Regenerate lockfile
Node 16 doesn't support os.availableParallelism() which Jest 29 requires.
E2E testing on Node 18+ is sufficient for v3 maintenance.
chore: backport infrastructure improvements from next
Export Mocked<T> and Stub types from @suites/unit to establish the
abstraction layer of the abstraction/augmentation pattern.

These base types provide graceful fallback when adapter packages are
not configured, and serve as the foundation that adapter packages will
augment with library-specific implementations.
@omermorad omermorad self-assigned this Nov 20, 2025
@omermorad omermorad marked this pull request as draft November 20, 2025 17:29
@omermorad omermorad force-pushed the feat/iss-931/support-injectionjs-adapter branch from c6390f6 to 8df7a81 Compare November 27, 2025 17:21
@omermorad omermorad changed the base branch from master to next November 27, 2025 23:00
@iddan iddan force-pushed the next branch 2 times, most recently from 3120956 to 32bec03 Compare December 7, 2025 19:03
@omermorad omermorad force-pushed the next branch 3 times, most recently from 96a04d1 to 4b8854e Compare May 4, 2026 19:25
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.

2 participants