Giter Site home page Giter Site logo

e2e test fails with "No CLS namespace defined in your app ... please call initializeTransactionalContext()" about awesome-nest-boilerplate HOT 2 OPEN

topchyalexey avatar topchyalexey commented on June 28, 2024
e2e test fails with "No CLS namespace defined in your app ... please call initializeTransactionalContext()"

from awesome-nest-boilerplate.

Comments (2)

topchyalexey avatar topchyalexey commented on June 28, 2024

Fixed by adding

**import { initializeTransactionalContext } from 'typeorm-transactional';**

import { AppModule } from '../src/app.module';

describe('AuthController (e2e)', () => {
  let app: INestApplication;
  let accessToken: string;

  beforeAll(async () => {
    **initializeTransactionalContext();**
    const moduleFixture = await Test.createTestingModule({
      imports: [AppModule],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
  });

but then I get next error

[Nest] 65272  - 12/12/2023, 12:37:56 PM   ERROR [ExceptionsHandler] You need to use @UseDto on class (UserEntity) be able to call toDto function
Error: You need to use @UseDto on class (UserEntity) be able to call toDto function
    at UserEntity.toDto (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/src/common/abstract.entity.ts:24:19)
    at AuthController.userRegister (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/src/modules/auth/auth.controller.ts:33:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
  console.log
    query: SELECT "UserEntity"."id" AS "UserEntity_id", "UserEntity"."created_at" AS "UserEntity_created_at", "UserEntity"."updated_at" AS "UserEntity_updated_at", "UserEntity"."first_name" AS "UserEntity_first_name", "UserEntity"."last_name" AS "UserEntity_last_name", "UserEntity"."role" AS "UserEntity_role", "UserEntity"."email" AS "UserEntity_email", "UserEntity"."password" AS "UserEntity_password", "UserEntity"."phone" AS "UserEntity_phone", "UserEntity"."avatar" AS "UserEntity_avatar", (SELECT CONCAT("UserEntity".first_name, ' ', "UserEntity".last_name)) AS "UserEntity_full_name" FROM "users" "UserEntity" WHERE ("UserEntity"."email" = $1) LIMIT 1 -- PARAMETERS: ["[email protected]"]

      at Function.logInfo (../src/platform/PlatformTools.ts:232:17)

from awesome-nest-boilerplate.

topchyalexey avatar topchyalexey commented on June 28, 2024

Fixed it by this issue workaround
#332

from awesome-nest-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.