-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing makeMockModels yields error that .sequelizerc can not be found #91
Comments
…found-handling-and-update-deps [Optimisation, #91] improve sequelize not found handling and update deps
Hi @dschuessler — a few questions to help me debug this: I've never known Node to have issues with a require from an absolute path, but it might be something to do with whatever pre-processor you are using to convert typescript to javascript.
I have made some minor updates to how it handles the error if it can't find the |
Your commit has the same effect on my test as my workaround. The test now runs through and fails with the following error.
The content of const path = require('path');
module.exports = {
'config': path.resolve('config', 'sequelize-cli.js')
'models-path': path.resolve('models')
} So Regarding your other questions:
Also Typescript is transpiled by means of |
@dschuessler Okay so your models are in My guess is that this is come sort of typescript weirdness as this library works just fine if you just use javascript. Are you able to share your repo, or make a small demo repo that exhibits this bug that I could take a look at? I'm not a typescript person but I don't see any reason why basic things like |
@dschuessler I have pushed version 1.1.1 to npm — it probably doesn't fix your issue but it does include the improvement to how I detect the missing |
I quickly assembled a small demo repo reproducing the error: https://github.com/dschuessler/sequelize-test-helpers-bug-example Do |
Thanks I'll aim to take a look over the weekend. |
Hey @dschuessler please see dschuessler/sequelize-test-helpers-bug-example#1 where I have fixed your tests and example code. |
I've released version 1.1.2 which improves the documentation of custom models folder path and adds the ability to supply custom file suffixes as well |
I am importing
makeMockModels
as follows:Running my Mocha test yields the following error originating from
src/mockModels.js
, line 11: https://gist.github.com/dschuessler/0e1c075837c4d7207151753313950d42When I copy the exact path from the error and output it with
cat /api/backend/.sequelizerc
the file is present.The error disappears when I change line 11 from:
to
I am not entirely sure about the nature of the problem, but I guess it has something to do with Node having problems to require from absolute paths. I would greatly appreciate it, if you could have a closer look. Thanks in advance!
The text was updated successfully, but these errors were encountered: