WebbyLab / webbylab-starter-app-for-nodejs

WebbyLab's production ready Starter App for NodeJS projects
189 stars 29 forks source link

npm test generates error during execution #4

Open VladyslavKurmaz opened 4 years ago

VladyslavKurmaz commented 4 years ago

Observed behavior

'npm test' run doesn't finish successfully

Expected behavior

No errors during tests executions

Steps to reproduce

A couple of output lines from the log's tail

ERROR: Coverage for lines (52.52%) does not meet global threshold (80%)
ERROR: Coverage for functions (30.63%) does not meet global threshold (80%)
ERROR: Coverage for statements (52.52%) does not meet global threshold (80%)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! modern-node-be@0.1.0 test:coverage: `c8 npm run test:ava`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the modern-node-be@0.1.0 test:coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-20T21_03_37_542Z-debug.log
npm ERR! Test failed.  See above for more details.
vira-khdr commented 4 years ago

Hi! Seems like, you haven't started docker-compose and/or haven't run migrations for test database.

Here is checklist with steps: https://github.com/WebbyLab/webbylab-starter-app-for-nodejs#run-development-version

VladyslavKurmaz commented 4 years ago

Ok, thanks for the response, I will check it. I'm working on Jenkins integration and need to have clear understanding how build process is configured to implement correct PR/PUSH builds. I will create separated PR with clarifications ... Here is my 5 cents that can be considered to review as an improvement. In my simple world, unit tests should be executed in isolated environment, when all other related components are mocked and have predefined behavior. As far as I understood, current implementation uses "real db", so it looks like integration tests when two or more "real" components are involved.