Testing mocker issues
Eldad7 opened this issue · comments
Did you read the migration guide?
- I have read the whole migration guide
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Potential Commit/PR that introduced the regression
No response
Versions
9.0.0
Describe the regression
After upgrading, I can't create a testing module with an import to an existing module that has a Typeorm dependency. I am seeing the below error:
TypeError: dataSource.entityMetadatas.find is not a function
The error comes from this line:
const enitityMetadata = dataSource.entityMetadatas.find((meta) => meta.target === entity);
in typeorm.provider.js
I have an app with a MySql DB and there's no option to do a "mock" connection. I've tried but Typeorm keeps trying to connect. Maybe I am missing something?
Minimum reproduction code
const moduleRef = await Test.createTestingModule({
imports: [ModuleIWantToTest],
controllers: [MockController],
})
.useMocker(() => createMock())
.compile();
Expected behavior
Testing module is created and I can use the internal services with the mocker
Other
Tested on both 9.0.0 and 9.0.1
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.