Search code examples
jestjslinker-errorsnestjse2e-testingtypeorm

Jest, NestJS, TypeORM End To End Testing


In the NestJS tutorial E2E tests are set up with their single example module imported. This pattern does not seem to work in an application with more complex relations between the typeORM entities. After extensively checking that there were no inconsistencies in import statements and no missing TypeOrmModule.forFeature() in the relevant files, I gave up and simply imported my entire AppModule (root module for my application -- same as NestJS default).


Solution

  • In short if you are seeing of the form

    Error: Entity metadata for EntityA#entityB was not found. 
    Check if you specified a correct entity object and if it's connected in the connection options.
    

    You can try importing all the related modules or simply import your entire application.