Mockgoose E2E : TypeError: mongoose.Schema is not a constructor
I'm submitting a...
[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When trying to implement E2E Testing following these instructions I got the following error :
FAIL test/users.e2e-spec.ts
● Test suite failed to run
TypeError: mongoose.Schema is not a constructor
at Object.<anonymous> (../src/users/schemas/users.schema.ts:2:43)
at Object.<anonymous> (../src/users/users.providers.ts:1:255)
at Object.<anonymous> (../src/users/users.module.ts:10:15)
at Object.<anonymous> (users.e2e-spec.ts:13:14)
at Generator.next (<anonymous>)
at new Promise (<anonymous>)
at Generator.next (<anonymous>)
at <anonymous>
at process._tickCallback (../internal/process/next_tick.js:188:7)
I use the same code except for the naming (Cats > Users)
yarn start works fine,
yarn test:e2e fails,
Expected behavior
The docs on mongoose & mockgoose should work as described in the doc
Minimal reproduction of the problem with instructions
Implementing the code in this doc should reproduce the issue.
What is the motivation / use case for changing the behavior?
This issue was already reported here : https://github.com/nestjs/nest/issues/363#issuecomment-380729085
Environment
Nest version: ^5.0.0
For Tooling issues:
- Node version: 8.9.4
- Platform: macOS 10.13.4
Others:
- Mongo: 3.6.3
- Mongoose: 5.1.2
- Mockgoose-fix: 7.3.6
Hi @Loriot-n, This chapter is outdated and hidden from the main navigation since mongoose has released new major version. I'd suggest looking into updated library documentation to verify what has changed and how to transit your existing solution.
did you solve the issue?
Could this possibly fix your issue? https://github.com/nestjs/nest/issues/363#issuecomment-409908090
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.