The Dashboard project uses a robust testing suite to ensure code quality and prevent regressions. We use the BATS (Bash Automated Testing System) to test our shell scripts.
To run the full test suite, you need to have Node.js and npm installed. The test runner is defined as a development dependency in package.json
.
Install the development dependencies:
npm install
Run the tests:
npm test
The npm test
command will execute all the .bats
files found in the test/
directory.
Our testing strategy is divided into two main categories:
Each module has its own corresponding test file in the test/
directory (e.g., test/hackernews.bats
). These tests are responsible for verifying the correctness of a single module.
Module tests should:
The test/dashboard.bats
file contains integration tests for the main dashboard.sh
script. These tests are responsible for verifying that the script correctly orchestrates the execution of the modules and assembles the final report.
Integration tests should:
json
, xml
, html
) is well-formed.When contributing new code, please ensure you add corresponding tests. For a new module, you should create a new test/your-module.bats
file. For changes to the main script, you should add new tests to test/dashboard.bats
.