Developer Notes

Setup development environment

Install Visual Studio Code and following extensions:

  • Prettier
  • ESLint
  • Vetur
  • Code Spell Checker
  • Debugger for Chrome

Multiple run configs have been created to facilitate debugging server, client, test and docs.

Client certificate authentication doesn't work in client debugger

Because Vue cli webpack dev server cannot proxy passthrough HTTPS connections, client certificate authentication doesn't work in client debugger. If testing client certificate authentication in web console is needed, run npm run build to generate prod client distribution and launch server debugger on https://localhost:3000

Automated Testing

NotifyBC uses Jestopen in new window test framework bundled in NestJS. To launch test, run npm run test:e2e. A Test launch config is provided to debug in VS Code.

Github Actions runs tests as part of the build. All test scripts should be able to run unattended, headless, quickly and depend only on local resources.

Writing Test Specs

Thanks to supertestopen in new window and MongoDB In-Memory Serveropen in new window, test specs can be written to cover nearly end-to-end request processing workflow (only sendMail and sendSMS need to be mocked). This allows test specs to anchor onto business requirements rather than program units such as functions or files, resulting in regression tests that are more resilient to code refactoring. Whenever possible, a test spec should be written to

  • start at a processing phase as early as possible. For example, to test a REST end point, start with the HTTP user request.
  • assert outcome of a processing phase as late and down below as possible - the HTTP response body/code, the database record created, for example.
  • avoid asserting middleware function input/output to facilitate code refactoring.
  • mock email/sms sending function (implemented by default). Inspect the input of the function, or at least assert the function has been called.

Install Docs Website

If you want to contribute to NotifyBC docs beyond simple fix ups, run

cd docs && npm install && npm run dev

If everything goes well, the last line of the output will be

> VuePress dev server listening at http://localhost:8080/NotifyBC/

You can now browse to the local docs site http://localhost:8080/NotifyBCopen in new window

Publish Version Checklist

  1. update version in package.json
  2. update version appVersion in helm/Chart.yaml (major/minor only)
  3. update What's new (major/minor only)
  4. create a new Github release