Use Node.js LTS and Yarn (recommended) to install and run tests.
Node setup (optional, via nvm):
nvm install --lts
nvm use --lts
node -vInstall dependencies and run tests (Yarn):
cd <root>
yarn
yarn testIf Yarn is not available:
# Option A: use Corepack to activate the repo-pinned Yarn 1.x
corepack enable
corepack prepare [email protected] --activate
# Option B: install globally (classic Yarn)
npm i -g yarnUsing npm instead of Yarn:
npm ci
npm testHandy commands:
- Run a specific Jest test file:
yarn test code-challenges/challenges-01.test.js - Lint JavaScript:
yarn lint
Set up a local Python environment and run tests:
cd /Users/tomm/repos/data-structures-and-algorithms
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip pytest
pytest --versionRun tests:
- All Python challenges:
pytest -q code-challenges - Single file:
pytest -q code-challenges/challenges_01_test.py
Pytest test discovery:
- Default patterns:
test_*.pyor*_test.py - If you prefer “.test.py” names, add a
pytest.iniat the repo root:[pytest] python_files = *.test.py test_*.py *_test.py
Object.keys, Object.values, and Object.entries