Closed jasonprado closed 2 years ago
Can you try to use just a normal console.log
and as a side note it appears that guide needs some updating as it should be a database.js
not database.json
A console.log
appears with the jest boilerplate around it:
● Console
console.log
<the message appears here>
I'll ping @alexandrebodin about this to see if he has any suggestions on it, as the tests run outside the normal Strapi application I'm not sure we should be using strapi.log
Thanks for looking. I'm using a custom JestEnvironment
to set up the Strapi
object, so there's space to set up the logger if it needs to be configured.
Hi, It might be swallowed somehow but your custom jest environement. Can you try without your custom env ?
Hello,
I will mark this issue as closed for now, as there has been no reply in a while. Also, we are no longer maintaining the Strapi v3 documentation, except for security-related issues, as the EOL (end of life) for Strapi v3 is due to end of 2022 (see Security file for more information).
We would suggest v3 users to use the various migration resources below to upgrade projects from Strapi v3 to Strapi v4:
Thank you!
Describe the bug I’m following the unit testing guide and I hit an error because I didn’t have sqlite3 installed. No error was printed at the command line and I had to
console.log
from inside the framework to see what was wrong.Steps to reproduce the behavior
database.json
for thetest
env that references the sqlite client.yarn run test
Expected behavior These lines in the framework are executing, thus an error should be printed:
Actual behavior A callstack referencing
knex.js
is printed but the log messages are not visible.Code snippets The line in strapi code that I expect an error from: https://github.com/strapi/strapi/blob/master/packages/strapi-connector-bookshelf/lib/knex.js#L79.
System
Additional context I don't know if jest is swallowing the error or if
strapi.log.error
isn't emitting it. I followed the guide so I'd expect it to work. Also the guide should probably mention installing sqlite3. Thanks!