Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

nestjs test fails

barisx answered on January 30, 2023 Popularity 9/10 Helpfulness 1/10

Contents


More Related Answers

  • nestjs Built-in HTTP exceptions
  • nestjs return error response
  • nestjs return status code
  • nestjs version
  • validator nest js
  • nestjs cli
  • js Validating nested objects
  • validate nested dto nestjs
  • nestjs CASL
  • class validator nestjs
  • nestjs return error response
  • nest js http exceptions
  • nestjs custom error class validator
  • nestjs error exception
  • jest config nestjs
  • Entity in nestjs
  • validate nested dto nestjs
  • nestjs validate files
  • nestjs test db
  • nestjs code example
  • validator nest js
  • validator nest js
  • nestjs test db
  • nestjs test db
  • js Validating nested promises
  • nest js env validation
  • nestjs run tests
  • nestjs run tests
  • nest js test dto

  • nestjs test fails

    0

    Nestjs testing module not found


    If you're coming from google then this can also happen if VSCode autocompletes your imports as src/xyz/abc/service.ts instead of ../xyz/abc/service.ts.

    When running tests the test code won't be able to locate the correct service(s) at run-time. It needs fully relative paths without an absolute 'src/' at the beginning.


    As you are using typescript's path mapping, you need to also update your jest config with the mapped paths as well. Your jest config needs to have the following added:Assuming that your is set to be . and not ./src. You can find more info on it here. https://kulshekhar.github.io/ts-jest/user/config/#paths-mapping

    Popularity 9/10 Helpfulness 1/10 Language javascript
    Link to this answer
    Share Copy Link
    Contributed on Jan 30 2023
    barisx
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.