development.md
January 13, 2022 ยท View on GitHub
Development documentation
Project build
The project is managed using npm.
For a list of available task, type
npm run
The following sections show the available options in detail.
Start
Runs a local version of Perseo-fe. Note that you should have a MongoDB instance running locally.
# Use git-bash on Windows
npm start
Testing
Mocha Test Runner + Should.js Assertion Library.
The test environment is preconfigured to run BDD testing style.
Module mocking during testing can be done with proxyquire
To run tests, type
npm test
Coding guidelines
jshint
Uses the provided .jshintrc flag file. To check source code style, type
npm run lint
Documentation guidelines
remark
Uses the provided .remarkrc.js flag file. To check consistency of the Markdown markup, type
npm run lint:md
textlint
Uses the provided .textlintrc flag file. To check for spelling and grammar errors, dead links and keyword consistency,
type
npm run lint:text
Continuous testing
Support for continuous testing by modifying a src file or a test. For continuous testing, type
npm run test:watch
If you want to continuously check also source code style, use instead:
npm run watch
Code Coverage
Istanbul
Analizes the code coverage of your tests.
To generate an HTML coverage report under site/coverage/ and to print out a summary, type
# Use git-bash on Windows
npm run test:coverage
Clean
Removes node_modules and coverage folders, and package-lock.json file so that a fresh copy of the project is
restored.
# Use git-bash on Windows
npm run clean
Prettify Code
Runs the prettier code formatter to ensure consistent code style (whitespacing, parameter placement and breakup of long lines etc.) within the codebase.
# Use git-bash on Windows
npm run prettier
To ensure consistent Markdown formatting run the following:
# Use git-bash on Windows
npm run prettier:text
Swagger
In order to run Swagger, you need to execute the Perseo FE (as explained here) and then you can access to:
<server_host>:9090/api-docs
The swagger documentation provided at /api-docs covers all the HTTP endpoint exposed by Perseo FE.