Testing the SDK — Weavetab Docs — Weavetab Docs

Running the test suite, adding unit tests, and verifying preflight rules. Official documentation and technical reference for Testing the SDK from Weavet...

Testing the SDK — Weavetab Docs

Running the test suite, adding unit tests, and verifying preflight rules. Official documentation and technical reference for Testing the SDK from Weavet...

# Testing the SDK

The `@weavetab/sdk` test suite uses Node's native test runner (`node:test`) and runs completely offline.

---

## 1. Running Tests

Run the entire test suite from the `sdk/` directory:

```bash
npm test
```

Or run a specific test file:

```bash
node --test test/cli.test.mjs
node --test test/ecosystem.test.mjs
node --test test/schema.test.mjs
```

---

## 2. Test Coverage Areas

1. **`test/cli.test.mjs`**:
   - Verifies SDK CLI commands (`init`, `build`, `validate`, `preflight`, `doctor`), template permission consistency, and manifest capability gates.
2. **`test/ecosystem.test.mjs`**:
   - Verifies plugin context, testing harness (`simulateToolCall`, `simulateCommandCall`, `createMockContext`), preflight instructions limits (`20` to `3,200` chars / `80` lines), and extension bridge contracts.
3. **`test/schema.test.mjs`**:
   - Verifies JSON Schema Draft-07 export (`schema/plugin.json`, `schema/tool.json`), Zod-to-JSON-Schema conversion, and manifest generation (`exportManifest`).