Closed HEYGUL closed 4 years ago
We'll need a bit more information about your project in order to be able to help, can you please answer the following:
1) We're assuming that your tests run outside of wallaby (e.g. from the CLI), is that correct? If so, what test runner are you using, can you please share your config/scripts? 2) When running your tests, are you doing anything special to set up your database for your database tests? If so, you'll need to do a similar thing for Wallaby, the setup function in your Wallaby configuration may be the right place to initialize your database.
Is it possible for you to provide us with a cut-down repo that has a single database test failing in Wallaby but passing from the CLI for us to look at for you (you should be able to strip out all of your application code so it's just a sample instead of any proprietary code)? This will allow us to see how your database is being initialized outside of wallaby and provide a Wallaby configuration for you that does the same.
We'll need a bit more information about your project in order to be able to help, can you please answer the following:
- We're assuming that your tests run outside of wallaby (e.g. from the CLI), is that correct? If so, what test runner are you using, can you please share your config/scripts?
We use mocha. I confirm tests are ok from the CLI.
- When running your tests, are you doing anything special to set up your database for your database tests? If so, you'll need to do a similar thing for Wallaby, the setup function in your Wallaby configuration may be the right place to initialize your database.
I will have a closer look to this part.
Is it possible for you to provide us with a cut-down repo that has a single database test failing in Wallaby but passing from the CLI for us to look at for you (you should be able to strip out all of your application code so it's just a sample instead of any proprietary code)? This will allow us to see how your database is being initialized outside of wallaby and provide a Wallaby configuration for you that does the same.
The code base is open source : github.com/1024pix/pix I am working on the api subdir for the moment.
Thank you for the quick reply.
Thanks for sharing your repo. We've taken a look at your project and can see that you have database set up and initialization logic that needs to be reflected in your wallaby configuration.
Unfortunately we can't get your repo working on our PCs (we're using Windows and expect that is most of the reason why it's not working) so we can't provide specific instructions as to what you'll need to do.
When you run your tests using npm run test
on the api
project, it is running other scripts (node
, and kflex
that drop, create, and migrate your database). You'll need to replicate this logic in Wallaby's setup function. If you keep the worker settings that you already have (workers: { initial: 1, regular: 1, restart: true }
) then that is all you should need to do. If some of this logic is asynchronous then you will need to use the delayStart()
and start()
methods described in the setup
function docs.
If you get stuck or have problems, let us know. I'll close the issue for now but will re-open it if you run into problems or have further related issues.
Issue description or question
I am evaluating wallaby and it seems really a great tool to explore and improve an existing codebase. Unfortunately, I have a project based on hapi.js where all tests using database failed as the client is unable to get a pool connection.
I constantly get this error
I am using knex, node and hapi.js. Any idea what I am missing ?
Wallaby diagnostics report
To get a shorter report, I focused on a single test file.