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
33 changes: 33 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,39 @@ In production the root folder will be used.

As of v1.9.0 this repository uses [conventional commit messages](https://conventionalcommits.org).

### Testing

The project uses [Vitest](https://vitest.dev/) as its test framework. Tests are colocated with their source files in the `src/` directory. Each test file is named `<module>.spec.ts` and placed next to the module it tests.

#### Running tests

```sh
# Run all tests once
$ npm run test

# Run tests with coverage report
$ npm run test:coverage
```

#### Writing tests

Test files should be placed next to the source file they test, within the `src/` directory. Each test file should be named `<module>.spec.ts`.

The path aliases from `tsconfig.node.json` (e.g. `@ts/`, `@utils/`) are available in test files via `vitest.config.ts`.

Example (`src/utils/myModule.spec.ts`):

```ts
import { describe, expect, it } from 'vitest';
import { myFunction } from '@utils/myModule';

describe('myFunction', () => {
it('should return the expected result', () => {
expect(myFunction('input')).toBe('expected output');
});
});
```

### Publishing

1. Switch to master branch
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ jobs:
name: build
path: dist

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.14.0

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test

generate:
name: Generate SDK
runs-on: ubuntu-latest
Expand Down
Loading
Loading