# Development documentation ## Install dependencies and run tests ```bash npm ci # Necessary to setup skia-canvas. npm run allow-scipts npm test ``` ## Writing unit tests ### Tests that compare with OpenCV [OpenCV](https://opencv.org/) is a popular image processing library for C++ and Python. We use it as a reference for some of the functions implemented in ImageJS. All images used for comparison with OpenCV are generated by the Python script [`test/img/opencv/generate.py`](./test/img/opencv/generate.py). To add a new test reference file: - Update [`generate.py`](./test/img/opencv/generate.py) with the OpenCV code that creates the file. - Run `generate.py` (see following paragraph). - Add the new filename to the [`TestImagePath`](./test/TestImagePath.ts) type (alphabetical order). To run the generation script, use the following steps: - Install Python 3.x - Run `python3 -m venv .venv` to create a virtual environment for the project - Activate the venv or run the local `pip` and `python` commands. - `source .venv/bin/activate` (UNIX) - `.venv/Scripts/Activate.ps1` (Windows) - Run `pip install opencv-python` - Run `python test/img/opencv/generate.py`