测试时报错
Nest can't resolve dependencies of the UserService (HttpService, ?). Please make sure that the argument "UserInfoRepository" at index [1] is available in the RootTestModule context
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From user/user.service.spec.ts.
通常是因为你的提供者
还有imports
没有写对
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [xxModule, TypeOrmModule.forFeature([User])],
providers: [UserService],
}).compile();
一定要写
特别是
imports的TypeOrmModule.forFeature([User])
你的实体类
上下文要连接