Skip to content

Container.getAll ignores binding when condition #1670

@sebastien-comeau

Description

@sebastien-comeau

Current behavior

The container.getAll method appears to ignore the when binding conditions. As demonstrated in the unit tests, when the storage-config value is set to a specific configuration (e.g., 'disk' or 'redis') and container.getAll<Storage>('storage') is called, it returns all bindings for the storage service (e.g., ['disk-storage', 'redis-storage']), regardless of the specified storage-config value.

Steps to reproduce

Unit tests reproducing the current behavior.
https://stackblitz.com/edit/vitest-dev-vitest-pw5pnz?file=test%2Fbasic.test.ts

Expected behavior

When the storage-config value is set to a specific configuration ('disk' or 'redis') and container.getAll<Storage>('storage') is called:

  • For 'disk', only the 'disk-storage' binding should be resolved.
  • For 'redis', only the 'redis-storage' binding should be resolved.

Package version

6.1.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions