Skip to content
4 changes: 4 additions & 0 deletions .githooks/pre-commit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️‍🗨️ question: Would moving this to the paths following be better for organization or is ".githooks" standard for discovering these scripts?

scripts/hooks/...

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation is very complex - is there a way we could simplify this?

cd "$(git rev-parse --show-toplevel)" || exit 1
npm run lint
22 changes: 22 additions & 0 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ Maintaining this project requires installing [Node.js](https://nodejs.org). All

## ✅ Tasks

### 🔧 Git hooks (optional)

#### Pre-commit lint hook
We provide an opt-in Git hook that runs `npm run lint` from the repository root before a commit is created.

Enable it once per clone:

```sh
git config core.hooksPath .githooks
```

Disable it:

```sh
git config --unset core.hooksPath
```

Notes:
- The hook runs `npm run lint` from the repository root.
- You can skip it with `git commit --no-verify` if needed.

### ⚗️ Testing and Linting

The Node SDK is made up of multiple, individual packages, each with their own tests. As such, tests are run on a per-package basis. However, the top-level directory contains some development dependencies applicable to all packages. As a result, to run tests for any package, first run `npm install` from the top-level directory. Then run `npm test --workspace packages/<package-name>` to run that package's tests. To run linting across all packages, run `npm run lint` from the root directory.
Expand All @@ -21,6 +42,7 @@ npm test --workspace packages/web-api

This project has tests for individual packages as `*.test.ts` (or `*.test.js`) files inside of each package's `src` directory. Tests use `node:test` as the test runner and `node:assert/strict` for assertions. Also, for verifying the behavior with the real Slack server-side and developer experience with installed packages, you can run the tests and scripts under `prod-server-integration-tests`. Refer to the README file in the directory for details. These tests are supposed to be run in the project maintainers' manual execution. They are not part of CI builds for now.


Upon opening a PR, tests are executed by GitHub Actions, our continuous integration system. GitHub Actions runs several, more granular builds in order to report on success and failure in a more targeted way.

- There is one build for each package on each supported version of Node, as well as one for the integration tests on each supported version of Node.
Expand Down