-
-
Notifications
You must be signed in to change notification settings - Fork 724
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
After upgrading from 6.2.1 to 7.5.1 all vitest test that test classes with injectables are broken
I use this pattern to save the original container, rebind with mocks and restore original for each test
beforeEach(() => {
container.snapshot();
categoryDatasource = mock<CategoryRemoteDatasource>();
container
.rebindSync(CategoryRemoteDatasource)
.toConstantValue(categoryDatasource);
categoryRepository = container.get<CategoryRepository>(
spaTypes.repositories.CategoryRepository,
);
});
afterEach(() => {
container.restore();
});Since the update is like snapshot or restore doesn't work, the container "remains" and "leaks" between test, they are not isolated anymore.
Steps to reproduce
No response
Expected behavior
Each test should get a "fresh" container base of the steps inside beforeEach
Possible solution
No response
Package version
7.5.1
Node.js version
22.15.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Stack trace
No response
Other
No response
Metadata
Metadata
Assignees
Labels
No labels