Welcome to your Node.js learning project!
This repository is designed to help you practice writing clean code, unit testing, and collaborative development using GitHub Actions.
You’ll work as a team and progressively complete different levels (Level 1, Level 2, Level 3) — each with its own logic challenges and unit tests.
Each student has their own folder inside students/ with this structure:
students/
s-yourname/
src/
level1.js
level2.js
level3.js
tests/
level1.test.js
level2.test.js
level3.test.js
Each level increases in complexity, but the focus remains on clear logic and good testing.
Simple functions with arrays, numbers, or strings.
Examples:
- Check if a word is a palindrome.
- Sum all numbers in an array.
- Count vowels in a sentence.
- Find the largest number.
🧠 Goal: Practice pure functions, validation, and basic testing.
Slightly more complex logic that requires combining multiple programming concepts.
Examples:
- Convert text to Title Case.
- Create a FizzBuzz function.
- Detect if a word is an isogram.
- Find unique words in a paragraph.
- Validate if a string is a simple email.
🧠 Goal: Work with loops, arrays, and conditionals while maintaining clean, testable code.
Introduce small algorithms or scenarios that can be measured (complexity, performance).
Examples:
- Implement a mini calculator with multiple operations.
- Build a function to validate a password strength.
- Create a function to calculate factorial recursively.
- Build a function to detect duplicates or compute statistics.
🧠 Goal: Write optimized, maintainable code and analyze complexity (e.g., cyclomatic complexity).
All unit tests are written using Jest.
Run them locally with:
npm testOr run with coverage metrics:
npm run test:ciThis will display:
- ✅ Tests passed/failed
- 📊 Code coverage
- 🔍 Percentage of tested lines
The pipeline is configured to collect coverage reports.
It helps visualize how much of your code is actually tested.
You should aim for:
- Minimum 80% coverage per file.
- Focus on covering branches and functions, not just lines.
Example output:
Statements : 90%
Branches : 80%
Functions : 85%
Lines : 89%
We use ESLint to ensure code consistency and detect potential bugs early.
npm run lintnpm run lint:fixThe pipeline also measures cyclomatic complexity —
how many decision points your code has (if, for, while, etc.).
- Low complexity (1–5): ✅ Easy to read.
- Medium (6–10):
⚠️ Acceptable but could be simplified. - High (>10): 🚨 Needs refactoring.
This helps you understand how complex your code is and motivates cleaner logic.
This project uses GitHub Actions for automation.
Every Pull Request (PR) triggers the workflow:
- Linting: checks syntax and style.
- Unit tests: runs Jest for all tests.
- Coverage check: ensures 80% minimum.
- Ready message: prints “Project ready for production” when merged into
main.
⚠️ Attention all students:
You must configure and demonstrate the following tools by yourselves as part of your project delivery.
Each team or student is responsible for:
- ✅ Adding ESLint (code style and syntax rules)
- ✅ Enabling Code Coverage reports (e.g., via Jest or another tool)
- ✅ Measuring Cyclomatic Complexity (to analyze the complexity of your functions)
💬 During your final submission, you must explain and show evidence of:
- How each of these tools was configured.
- What results or metrics were obtained.
- How those metrics help improve software quality.
These configurations are not pre-installed in the repository.
You are expected to investigate, implement, and document them as part of your learning process.
| Stage | Trigger | Description |
|---|---|---|
| PR checks | When a pull request is opened | Runs tests and lint |
| Main branch merge | When PR is merged to main |
Shows message “Ready for Production 🚀” |
You can add these steps in the pipeline later:
- 🧾 SonarCloud / CodeQL: security and code smell detection.
- 📦 npm audit: dependency vulnerability checks.
- 🔢 Complexity thresholds: fail the build if functions are too complex.
- 🧹 Prettier format check: ensure consistent code style.
- Each student must work only inside their own folder under
/students/s-yourname/. - Everyone must add at least one new function and its tests per level.
- You may review and suggest improvements in other students’ PRs (peer review encouraged).
- Every PR must:
- Include meaningful commit messages.
- Pass all CI checks.
- Be reviewed and approved before merging.
The main branch is protected to ensure code quality and teamwork.
| Rule | Description |
|---|---|
| Require Pull Request | No direct commits to main. |
| Require at least 2 reviewers | Each PR must be approved by two peers. |
| Require passing CI checks | Lint and test workflows must succeed before merging. |
| Require conversation resolution | All review comments must be addressed. |
| Restrict who can merge | Only instructors or designated reviewers can merge. |
| Include Copilot as reviewer (optional) | Copilot can suggest improvements automatically. |
This is a collaborative project — everyone in the group must:
- Contribute meaningful code.
- Add tests for their functions.
- Review at least one teammate’s PR.
- Respect the branch protection and coding standards.
| Command | Purpose |
|---|---|
npm install |
Install all dependencies |
npm test |
Run all tests |
npm run test:ci |
Run tests + coverage report |
npm run lint |
Check syntax and code quality |
npm run lint:fix |
Auto-fix lint issues |
- Keep functions small and focused.
- Use descriptive test names.
- Don’t copy logic between students; collaborate, don’t duplicate.
- Use comments only when necessary — clean code speaks for itself.
- Celebrate every PR that turns ✅ green!
When all students have completed Level 3:
- Each student should have written and tested at least 3–5 functions.
- The repository should have:
- 80%+ coverage,
- Passing CI pipeline,
- Protected main branch,
- Team reviews completed.
💬 “Clean code and collaboration are the foundation of professional software development.”
- Fork this repository or clone it into a Codespace.
- Run
npm install. - Open your
students/s-yourname/folder. - Start coding your Level 1 challenge!
- Push your changes and open a Pull Request.
🧩 Instructor’s note:
This repository simulates a real-world development workflow.
You’ll learn how modern teams work with CI/CD, testing, quality gates, and branch protection — essential skills for any DevOps or Cloud Engineer.