/contact-ukti

Primary LanguageJavaScriptGNU General Public License v2.0GPL-2.0

UKTI Contact Form

Build Status Dependency Status (gemnasium) Dependency Status (david) devDependency Status

Dependencies

  • Redis

Quick start

Install the dependencies and build the project resources

npm install

Redis is used for session handling by the application and will need to be installed and running prior to starting the app - if you don't have it installed locally you can run from a docker container:

docker run -d -p 6379:6379 redis

Initiate the server in development mode (Express is used to serve the static resources in development).

To see some log messages set the log level with the env var LOG_LEVEL.

npm run dev

See the development documentation for a complete description of the application and how to maintain and support BRP.

Start application

Start the application in default mode (production).

npm start

Development

Start the application with Nodemon in development mode. Debug is switched on and the server restarts when the JS or Sass are recompiled.

npm run dev

Assets

Compile the Sass to CSS

npm run sass

Compile JS using Browserify

npm run browserify

Tests

To run all unit and acceptance tests and linting run:

npm run test

Unit tests

Unit tests are run using Mocha. Tests are defined in ./test/unit

npm run test:unit

Acceptance tests

Acceptance tests use webdriverio and cucumber-js to run feature tests

npm run test:acceptance

Linting and code style

Run the EcmaScript (ES) linter. Rules are defined in .eslintrc

npm run lint

Run the jscs style checker. Rules are defined in .jscsrc.json

npm run style

Code coverage

Analyse the test coverage of the codebase (for results - open ./reports/coverage/lcov-report/index.html)

npm run coverage

or using environment variable on unit tests

export npm_config_coverage=true
npm run test:unit

Code quality

Analyse the quality of the codebase (for results - open ./reports/plato/index.html)

npm run quality

Development SMTP Server

Maildev can be run as a development SMTP server to catch emails being sent and preview the results.

npm run maildev

By default, in development, a stub transport will be used for emails. To sent to maildev you will need to create the env var SMTP_USER and set it to any value:

export SMTP_USER='test';

Now start the app and it will send emails via maildev.