Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

OverwriteModelError and Mocha watch on generated models #173

Closed
ericjeker opened this issue Jan 30, 2019 · 1 comment · Fixed by feathersjs-ecosystem/generator-feathers#455

Comments

@ericjeker
Copy link

Steps to reproduce

  • Create an app with the CLI and select Mocha + assert

feathers g app

? Project name new-test-app
? Description
? What folder should the source files live in? src
? Which package manager are you using (has to be installed globally)? npm
? What type of API are you making? (Press to select, to toggle all, to invert selection)REST, Realtime via Socket.io
? Which testing framework do you prefer? Mocha + assert

  • Create a service with Mongoose

feathers g service

? What kind of service is it? Mongoose
? What is the name of the service? test
? Which path should the service be registered on? /test
? What is the database connection string? mongodb://localhost:27017/new_test_app

  • Run mocha with -w parameter

./node_modules/.bin/mocha test/ -w

  • Do a modification in your code

OverwriteModelError: Cannot overwrite test model once compiled.

Expected behavior

We should not have an exception in that case. That is due to the way models are generated by CLI.
The error is described here: Automattic/mongoose#1251
Wrapping the model creation in a try catch solves the issue.

Actual behavior

OverwriteModelError: Cannot overwrite test model once compiled.

System configuration

Module versions (especially the part that's not working):

Feathers CLI 3.9.0

NodeJS version:

v10.14.2

Operating System:

Any

Browser Version:

N/A

React Native Version:

N/A

Module Loader:

N/A

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants