Skip to content

Testing

npm ci --ignore-scripts installs the development tooling only; the plugin has no runtime dependencies. npm test runs the unit tests with Node 24's own test runner.

The gate

npm run check is the whole gate, in the order CI runs it:

Step What it proves
npm run typecheck the sources and tests typecheck under strict settings
npm run bundle dist/index.js is built from src/index.ts with esbuild; commit the result
npm test the unit tests pass
npm run test:pack the tarball carries the files whitelist, installs with no runtime dependencies, and starts in the embedded 2.4.1 host
npm run test:host the real 2.4.1 host registers every shipped skill and the /slack command
npm run actionlint every workflow parses as a workflow, in CI
plugin-kit check conformance T0 and T1, the doc file set, the forbidden patterns and no bundled kit
plugin-kit docs --check every generated doc section matches the manifest

The CI check job also runs npm run bundle && git diff --exit-code dist/, so a stale committed bundle fails before a tag can carry it.

The test files

File What it proves
test/unit/accounts.test.ts the Slack-app client ID, one server per alias, the sign-in choice's scopes and no server without a client ID
test/unit/channel-invite.test.ts the channel_invite declaration, public and private invites, the single already-there case and the refused mixed list, the other refusals and the read-only denial
test/unit/dependencies.test.ts the lockfile resolves every cross-spawn at 7.1.0 or later, and the manifest's override holds it there
test/unit/dist.test.ts the committed bundle is the server entry, and a fresh bundle leaves it unchanged
test/unit/handlers.test.ts every handler, over two synthetic workspaces, with status shortfalls for both sign-in choices and a scope the app does not offer
test/unit/notice.test.ts every package inlined in the bundle has its licence in NOTICE
test/unit/provider.test.ts Slack's two answer shapes, auth.test, the Web API refusals and the per-alias credential
test/unit/reply.test.ts the slack.reply declaration, a preview that calls Slack not at all and keeps the act door's checks, and the commit's one post
test/unit/send.test.ts the slack.send declaration, a person's direct message resolved from their user id, a D… id refused at every door, and a commit that posts only the plan, once
test/unit/delete.test.ts the slack.delete declaration, another person's message refused at the preview and the commit, and the one delete
test/unit/raw-writes.test.ts Slack's raw write tools denied at every access level and for every alias
test/unit/scopes.test.ts the read and write scope sets, both sign-in choices, and the sign-in, settings and provider-admin shortfalls
test/unit/release.test.ts the release publishes the package, the conformance report and the checksums
test/unit/fixture.test.ts the committed conformance recording is what the handlers answer now
test/unit/repository-style.test.ts the README's sections, the docs site, the workflows, every relative link and the standard's legacy words
test/pack/pack.test.ts the packed tarball's file set and its start in the real embedded host
test/host/skills.test.ts the skills and the /slack command on the real 2.4.1 host

The conformance fixture

fixtures/conformance.json is recorded from the plugin's own handlers over the two synthetic workspaces. It carries the personal account's Read-only shortfalls and a recorded SCOPE_MISSING refusal with its provider-admin shortfall. After a handler change, record it again and commit the result:

SLACK_RECORD=1 node --test test/unit/fixture.test.ts

npx plugin-kit record --account <alias> records from a real account and redacts personal data, which would replace the invented names here, so it is not run on this fixture.

The action grants in fixtures/conformance.json are fixed test data: a public key and five tokens, recorded once so the kit can replay them without a signing key. The recorder keeps the committed section as it is, because the kit's redaction would replace every token and its secret scan exempts only the fixture. A recorded grant is never regenerated; a change to the action's id or commit method needs new cases, signed by a host.

The docs site

python3 -m venv .cache/docs-venv
.cache/docs-venv/bin/pip install -r docs/requirements.txt
.cache/docs-venv/bin/mkdocs build --strict
.cache/docs-venv/bin/mkdocs serve

The virtual environment lives in .cache, which Git ignores and plugin-kit check skips.

mkdocs build --strict fails on a page that is not in the nav, a broken relative link or a missing file. CI runs it in the docs job, which the ci check needs.