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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ jobs:
node-version: ${{ matrix.node }}
- run: corepack yarn
- run: corepack yarn vitest run --coverage ./test/unit
- name: Upload coverage reports artifact
if: matrix.node == 22 # Only upload coverage from the latest Node.js version
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: coverage/

coverage:
needs: vitest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage-reports
path: coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
flags: unittests
name: node-sdk
fail_ci_if_error: true

release:
runs-on: ubuntu-latest
Expand All @@ -75,6 +99,7 @@ jobs:
- prettier
- typescript
- vitest
- coverage
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,39 @@ Thanks to [Ian Hansen](https://github.com/supershabam) for donating the `translo
## License

[MIT](LICENSE) © [Transloadit](https://transloadit.com)

## Development

### Testing

This project uses [Vitest](https://vitest.dev) for testing. There are two types of tests:

#### Unit Tests

Run unit tests with:

```bash
yarn test-unit
```

This will also generate a coverage report in the `coverage` directory.

#### Integration Tests

Run integration tests with:

```bash
yarn test-integration
```

Note: Integration tests require valid Transloadit credentials.

### Code Coverage

Coverage reports are:

- Generated locally in the `coverage` directory
- Uploaded to Codecov for tracking
- Enforced in CI (builds will fail if coverage drops below thresholds)

View the coverage report locally by opening `coverage/index.html` in your browser.
14 changes: 12 additions & 2 deletions vitest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
include: 'src',
reporter: ['json', 'lcov', 'text', 'clover', 'json-summary'],
include: ['src/**/*.ts'],
exclude: ['**/*.d.ts', '**/*.test.ts', '**/test/**'],
reporter: ['json', 'lcov', 'text', 'clover', 'json-summary', 'html'],
provider: 'v8',
thresholds: {
// We want to boost this to 80%, but that should happen in a separate PR
statements: 2,
branches: 2,
functions: 0,
lines: 2,
perFile: true,
},
},
globals: true,
},
Expand Down
Loading