To run tests for the Screenly/Playground project, follow the steps outlined below. Ensure that your environment is set up with the necessary dependencies and that you are familiar with the project structure.
Prerequisites
Make sure you have the following installed:
- Node.js
- Python 3
- Docker (if you intend to use containers)
- npm (Node Package Manager)
Step 1: Clone the Repository
Start by cloning the repository to your local machine:
git clone https://github.com/screenly/playground.git
cd playground
Step 2: Install Node.js Dependencies
Navigate to the project directory and install the Node.js dependencies required for testing:
npm install
Step 3: Run Tests
Execute the test scripts defined in the package.json
file. The most common testing framework used is Jest, but verify based on the project’s configuration. Run tests with:
npm test
This command will execute all test files that are specified according to the configuration in your project.
Step 4: Running Individual Test Files
If you want to run a specific test file, you can do so by specifying the path to the test file directly in the command:
npm test -- path/to/your/testfile.test.js
Replace path/to/your/testfile.test.js
with the actual path of the test file you want to execute.
Step 5: Running Tests with Coverage
To generate a test coverage report, you can use the following command:
npm test -- --coverage
This will provide you with a detailed report on which parts of your code are covered by the tests.
Step 6: Python Tests
If the application contains Python components with associated tests, navigate to the relevant directory and run:
python -m unittest discover
Ensure that you have the necessary dependencies installed, which may be specified in a requirements.txt
file. You can install them with:
pip install -r requirements.txt
Step 7: Dockerized Tests
If you prefer to run the tests inside a Docker container, ensure that your Docker environment is correctly set up and then use:
docker-compose run --rm app npm test
This will start a container from the provided Docker environment and run the tests within it.
Step 8: CI/CD Integration
For continuous integration and deployment setups, ensure that your configuration (like GitHub Actions, Travis CI, etc.) can execute the test commands as defined above. Ensure you manage the testing environments properly to mimic local conditions as closely as possible.
Conclusion
Following these steps will ensure that you run the tests scrupulously for the Screenly/Playground project. Ensure you refer to any specific project guidelines or configurations related to testing within the repository.
Source of the information provided: Official Screenly/Playground repository documentation.