Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4969573
chore: remove data source dependencies
k0stik Jun 25, 2025
8951296
chore: add AdeFactory
k0stik Jun 25, 2025
e4f1bb5
chore: lint
k0stik Jun 25, 2025
17e3357
chore: cleanups
k0stik Jun 25, 2025
8725115
chore: rename AdeFactory methods
k0stik Jun 25, 2025
8362680
chore: remove comments
k0stik Jun 25, 2025
e2c0f15
update: move application-flavors dependency to AdeFactory
k0stik Jun 26, 2025
a2dc381
chore: simplify AdeFactory
k0stik Jun 27, 2025
5c4dbcc
chore: simplify AdeFactory
k0stik Jun 27, 2025
138009c
chore: simplify AdeFactory
k0stik Jun 27, 2025
f5623a2
chore: simplify AdeFactory
k0stik Jun 27, 2025
0960bf6
chore: add applicationId property to executableMixin
k0stik Jun 27, 2025
9b3a2db
chore: AdeFactory clenaup
k0stik Jun 27, 2025
81bc325
chore: AdeFactory clenaup
k0stik Jun 27, 2025
c79a061
chore: typescript
k0stik Jun 27, 2025
02beaf4
chore: typescript
k0stik Jun 27, 2025
8f70467
chore: typescript
k0stik Jun 27, 2025
3fee8f3
chore: typescript
k0stik Jun 27, 2025
3084769
update: add supportedApplicationVersions to flavorMixin
k0stik Jul 1, 2025
5186436
update: add supportedApplicationVersions to flavorMixin
k0stik Jul 1, 2025
1af9eff
chore: add tests
k0stik Jul 2, 2025
95ece31
chore: remove executable from Flavor constructor
k0stik Jul 4, 2025
e4b134c
chore: improve tests
k0stik Jul 14, 2025
07cd372
chore: cleanups
k0stik Jul 14, 2025
d8ce102
chore: add coverage actions
k0stik Jul 14, 2025
0220794
Trigger coverage workflow
k0stik Jul 14, 2025
8eb0ee0
chore: add coverage actions
k0stik Jul 14, 2025
86b2161
chore: add coverage actions
k0stik Jul 14, 2025
1259e1c
chore: cleanup dist
k0stik Jul 15, 2025
efdeec4
chore: resolve conflicts
k0stik Jul 15, 2025
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
41 changes: 41 additions & 0 deletions .github/workflows/coverage-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Coverage to GitHub Pages

on:
push:
branches: [ main ]

jobs:
deploy-coverage:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Generate coverage report
run: npm run test:coverage:html

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload coverage to Pages
uses: actions/upload-pages-artifact@v3
with:
path: coverage/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
49 changes: 49 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Code Coverage

on:
pull_request:
push:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ github.sha }}
path: coverage/
retention-days: 30

- name: Upload coverage to Codecov (optional)
uses: codecov/codecov-action@v4
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
37 changes: 37 additions & 0 deletions .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR Coverage Report

on:
pull_request:

jobs:
coverage-comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage

- name: Comment PR with coverage report
uses: romeovs/lcov-reporter-action@v0.3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./coverage/lcov.info
delete-old-comments: true

- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report-pr-${{ github.event.number }}
path: coverage/
retention-days: 7
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ build/
node_modules/
.eslintcache
.nyc_output/
coverage/
.idea/
.DS_Store
24 changes: 23 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@
"all": true,
"include": [
"src/**/*.js",
"src/**/*.jsx"
"src/**/*.jsx",
"src/**/*.ts"
],
"exclude": [
"tests/**/*",
"**/*.test.ts",
"**/*.spec.ts",
"**/*.d.ts"
],
"reporter": [
"text",
"html",
"lcov"
],
"check-coverage": true,
"branches": 80,
"lines": 85,
"functions": 80,
"statements": 85,
"sourceMap": true,
"instrument": true,
"require": [
"ts-node/register"
]
}

124 changes: 124 additions & 0 deletions COVERAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Code Coverage Guide

This document explains how to generate and view code coverage reports for the ade.js project.

## Quick Start

### Local Development
```bash
# Generate and view coverage report
npm run test:coverage:html
npm run test:coverage:view
```

### Check Coverage Thresholds
```bash
# Run tests and verify coverage meets minimum thresholds
npm run test:coverage:check
```

## Coverage Options

### 1. Local HTML Report
- **Command**: `npm run test:coverage:html`
- **Output**: `coverage/index.html`
- **View**: `npm run test:coverage:view` (opens in browser automatically)

### 2. GitHub Actions Coverage

#### PR Coverage Comments
- **Trigger**: Every pull request
- **What it does**:
- Runs tests with coverage
- Posts a detailed coverage report as a PR comment
- Shows coverage changes compared to base branch
- Uploads coverage artifacts for download

#### Coverage Artifacts
- **Location**: GitHub Actions → Artifacts tab
- **Retention**: 30 days for main branch, 7 days for PRs
- **Download**: Click on artifact to download and view locally

#### GitHub Pages (Optional)
- **URL**: `https://exabyte-io.github.io/ade.js/`
- **Trigger**: Every push to main branch
- **Features**:
- Always up-to-date coverage report
- No authentication required
- Easy sharing with team

### 3. External Services

#### Codecov Integration
- **Service**: [Codecov](https://codecov.io)
- **Features**:
- Historical coverage tracking
- Coverage trends and graphs
- PR coverage comparison
- Coverage badges
- **Setup**: Automatic via GitHub Actions

## Coverage Thresholds

The project enforces these minimum coverage levels:

| Metric | Threshold |
|--------|-----------|
| Statements | 85% |
| Branches | 80% |
| Functions | 80% |
| Lines | 85% |

## Workflow Files

- `.github/workflows/coverage.yml` - Basic coverage with artifacts
- `.github/workflows/coverage-pages.yml` - GitHub Pages publishing
- `.github/workflows/pr-coverage.yml` - PR coverage comments

## Configuration

### nyc Configuration (`.nycrc`)
```json
{
"reporter": ["text", "html", "lcov"],
"check-coverage": true,
"branches": 80,
"lines": 85,
"functions": 80,
"statements": 85
}
```

### Coverage Files
- `coverage/lcov.info` - LCOV format for external services
- `coverage/index.html` - HTML report for browser viewing
- `coverage/` - Complete coverage report directory

## Troubleshooting

### Coverage Report Not Found
```bash
# Generate coverage first
npm run test:coverage:html

# Then view it
npm run test:coverage:view
```

### GitHub Pages Not Working
1. Check repository settings → Pages
2. Ensure GitHub Actions has Pages write permissions
3. Verify workflow is running on main branch pushes

### Coverage Thresholds Failing
1. Run `npm run test:coverage:check` to see specific failures
2. Add tests for uncovered code paths
3. Consider adjusting thresholds if appropriate

## Best Practices

1. **Always check coverage locally** before pushing
2. **Review PR coverage comments** to understand impact
3. **Use coverage artifacts** for detailed analysis
4. **Monitor coverage trends** over time
5. **Aim for meaningful coverage** rather than just hitting thresholds
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,51 @@ npm run transpile

# run tests
npm run test

# run tests with coverage
npm run test:coverage

# run tests with coverage and check thresholds
npm run test:coverage:check

# generate HTML coverage report
npm run test:coverage:html
```

## Code Coverage

This project includes comprehensive code coverage reporting with multiple viewing options:

### Local Coverage
- Run `npm run test:coverage:html` to generate an HTML coverage report locally
- Open `coverage/index.html` in your browser to view the report

### GitHub Integration
The project uses GitHub Actions to automatically generate and display coverage reports:

1. **PR Coverage Comments**: Every pull request automatically gets a coverage report comment showing:
- Overall coverage percentages
- Coverage changes compared to the base branch
- Detailed file-by-file coverage breakdown

2. **Coverage Artifacts**: Coverage reports are uploaded as GitHub artifacts for each PR and commit
- Download from the Actions tab in GitHub
- Available for 30 days for main branch, 7 days for PRs

3. **GitHub Pages** (Optional): Coverage reports are published to GitHub Pages for easy browser viewing
- Available at: `https://exabyte-io.github.io/ade.js/`
- Updated on every push to main branch

### Coverage Thresholds
The project enforces minimum coverage thresholds:
- **Statements**: 85%
- **Branches**: 80%
- **Functions**: 80%
- **Lines**: 85%

### External Coverage Services
- **Codecov**: Coverage data is automatically uploaded to Codecov for historical tracking and trend analysis

ADe
===

Expand Down
Loading