Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Install BATS
run: npm install -g bats

- name: Install shellcheck
run: sudo apt-get install -y shellcheck

- name: Install yq
run: |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq

- name: Run shell script linting
run: npm run lint:shell

- name: Run unit tests
run: npm run test:unit

- name: Run shell tests
run: npm run test:shell

- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
<img src="docs/assets/logo-light.png" alt="Dev Session Buddy Logo" width="200"/>
</p>

<div align="center">

[![Tests](https://github.com/codevalve/dev-session-buddy/actions/workflows/test.yml/badge.svg)](https://github.com/codevalve/dev-session-buddy/actions/workflows/test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node Version](https://img.shields.io/node/v/dev-session-buddy)](https://nodejs.org)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/codevalve/dev-session-buddy/blob/main/CONTRIBUTING.md)

</div>

Born from the experience of pair programming with AI assistants, Dev Session Buddy is a smart development session startup script that standardizes how project context, tooling, and development standards are communicated to both human and AI collaborators.

## Origin Story 📖
Expand Down Expand Up @@ -169,6 +178,76 @@ dev-session-buddy/

For more help, please [open an issue](https://github.com/codevalve/dev-session-buddy/issues).

## Testing 🧪

Dev Session Buddy uses a comprehensive testing approach with both JavaScript and shell script testing:

### Test Frameworks

- **Jest**: For JavaScript unit testing
- Configuration validation
- Project structure verification
- Utility function testing

- **BATS** (Bash Automated Testing System): For shell script testing
- Script functionality verification
- Environment setup testing
- Tool availability checks

### Running Tests

```bash
# Run all tests
npm test

# Run only JavaScript tests
npm run test:unit

# Run only shell script tests
npm run test:shell

# Run shell script linting
npm run lint:shell

# Run tests in watch mode (during development)
npm run test:watch

# Generate test coverage report
npm run test:coverage
```

### Test Structure

```
tests/
├── unit/ # JavaScript unit tests
│ └── config.test.js
├── integration/ # Integration tests
├── shell/ # Shell script tests
│ └── session-start.bats
└── test_helper.bash # Test helper functions
```

### Writing Tests

1. **JavaScript Tests**
- Place in `tests/unit/` or `tests/integration/`
- Use `.test.js` or `.spec.js` extension
- Follow Jest testing patterns

2. **Shell Script Tests**
- Place in `tests/shell/`
- Use `.bats` extension
- Import test helper: `load '../test_helper'`

### Coverage Reports

Test coverage reports are generated in the `coverage/` directory after running `npm run test:coverage`. The project aims for:

- Line coverage: 80%
- Branch coverage: 80%
- Function coverage: 90%

## Configuration 🔧

[Coming Soon]
Expand Down
Binary file removed docs/assets/logo.png
Binary file not shown.
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
testEnvironment: 'node',
verbose: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
testMatch: [
'**/tests/**/*.test.js',
'**/tests/**/*.spec.js'
],
moduleFileExtensions: ['js'],
transform: {},
};
Loading