#I got error when try e2e test
80 messages · Page 1 of 1 (latest)
Relative paths, or update jest's moduleNameMapper option to support the absolute paths.
I feel that this should be in our FAQ page :/
it's so common and isn't related with nestjs itself but since the CLI generates jest files, I guess it would make sense
anyway what mean of this
this my tsconfig
this my jest config
Shouldn't it be something like "^src/(.*)$": "<rootDir>/src/$1"? It's regex, so you have to have a capture group () to use the group reference $1
let me try
still failed
Failed how? Same way or something new?
same way
And Backend\test\src\models would be the correct path? Or should you be doing <rootDir>/../src/$1?
oh wrong, should be <rootDir>/../src/$1
yeah, it depends on which directory your jest-e2e.json is located at since it will be the <rootDir>
i got different error anyway
Progress! What's under your src/connection/Connection.ts class?
Why?
Okay? But you don't need to add Connection to the imports array
ohh wait
how with this
There's probably some DI resolution error being reported above
It looks fine
app is showing up as undefined because Nest can't create the application
Why? Dunno, would need logs where the error is reported 🙂
anyway i use "@nestjs/core": "^7.6.15"
What does that have to do with your test not starting?
this my first time i use test
Okay?
its okay right?
Why would it not be?
You didn't change anything from when the project was created, right?
At least in terms of the test command
any suggest for me maybe?
I already told you, to know why your test is failing, you need to look at the logs during the test. Most likely Nest is reporting something failing in the DI and you're blatantly ignoring it and fishing for help
how to look log during test?
It should be in the terminal
Right there. "Nest cannot resolve dependency Connection". Where do you have TypeormModule.forRoot()?
in app.module
Well, that's where Connection comes from. How would you expect to inject something that doesn't exist?
so you can see here that there's no AppModule
that's why
Either add only AppModule to the imports array of your test and import everything or add just TypeOrmModule.forRoot()
you right i got progress with my test
i dont understand why i got http status 400, i check my swagger and found my data
how the controller looks like?
looks fine to me 🤔
different error right now
That usually means the server didn't start up for some reason
should i run also server?
i mean local
200 status code
You run await app.init(( that should be enough for supertest
should i change something in my tsconfig maybe
Your tsconfig is probably fine
Do you have a @Get() route in the controller?
i had
Where's the module import in your test?
no repository akad found
So what do you think the issue there is?
SOLVED