macalbert/envilder/typescript-testing
Claude Code and agent skill by macalbert/envilder
- community
Checking that the SKILL.md file is still in the repository.
Mandatory testing conventions for TypeScript stacks (Vitest for CLI/SDK/Website/CDK). Use for unit, integration, or E2E tests with Vitest or Playwright.
Install
npx vskill@latest install macalbert/envilder/typescript-testingSKILL.md
Testing Conventions (TypeScript)
This skill defines the MANDATORY testing conventions for TypeScript projects. These are rules, not guidelines.
Documentation Rules
NO Comments Except AAA Markers
- Do NOT write explanatory comments: code must be self-explanatory
- Only `// Arrange`, `// Act`, `// Assert` comments are allowed in tests
- The test name
Should_X_When_Yalready documents the intent
Exception: SDK public API: Code under src/sdks/*/ consumed by external developers (facade classes, public entry points) SHOULD have JSDoc with usage examples. This exception does not apply to tests or internal helpers.
Stacks Overview
| Stack | Test Runner | Location | |
|---|---|---|---|
| CLI / Core | Vitest | tests/envilder/ | |
| Node.js SDK | Vitest | tests/sdks/nodejs/ | |
| Website | Vitest | tests/website/ | |
| CDK (IaC) | Vitest | tests/iac/ | |
| E2E | Vitest + TestContainers | e2e/ |
Core Principles
1. AAA Pattern (Arrange – Act – Assert)
ALL tests MUST follow the AAA pattern, separated by inline comments.
Rules
- Each phase MUST be separated with comments
- Never mix phases
- **Each comment (
// Arrange,// Act,// Assert) appears AT MOST ONCE
per test**: if you need two actions or two asserts, write two tests
- Act = one single invocation on the SUT. Multiple statements in Act only
if they are genuinely part of the same logical action (rare and exceptional). Two independent operations = two tests.
- All assertions belong in Assert only. No
expect()in Arrange or Act.
If you feel tempted to assert in Arrange (precondition check), extract it to a separate test or use a guard clause that throws: not an assertion.
- AAA markers are mandatory in ALL tests: including structural guards,
static completeness checks, and data validation tests. No exceptions.
- No `if`, `switch`, or conditional logic inside Arrange, Act, or Assert
- No `try/catch/finally` inside tests: use
beforeEach/afterEachfor
teardown
- No `// Act & Assert` combined blocks: Act and Assert are ALWAYS separate
- For exceptions:
expect(() => action()).toThrow()or
await expect(asyncAction()).rejects.toThrow()
- Omit comment if section is empty
- If a test needs branching, split it into separate tests (one per scenario)
Vitest Example
2. Test Naming Convention
Test names MUST follow exactly:
Rules
- PascalCase for both parts
- NO natural language sentences in
it()descriptions - NO vague names (
Should_Work,TestHandler) - NO missing
Whenclause
Good Examples
| Test Name | Scenario | |
|---|---|---|
Should_ThrowError_When_SSMParameterIsNotFound | Error path | |
Should_ReturnMaskedValue_When_SecretIsLoaded | Success path | |
Should_ReturnEmptyMap_When_NoMappingsExist | Edge case |
Variable Naming (MANDATORY)
| Purpose | Name | |
|---|---|---|
| Subject under test | sut | |
| Expected value | expected | |
| Actual result | actual |
No creativity allowed here.
Mocking (Vitest)
Port Test Doubles
Controlling Behavior
Verifying Interactions
Exception Testing
Act and Assert MUST be separate. Wrap the action in Act, assert in Assert.
✅ CORRECT: separate Act and Assert
✅ CORRECT: async exceptions
❌ FORBIDDEN: combined Act & Assert
Test Class Structure
CLI / Core (Vitest + InversifyJS handlers)
Node.js SDK (Vitest, no DI)
CDK / IaC (Vitest)
Structural Guards
Tests that validate static data (i18n completeness, schema conformance, version consistency) still MUST use AAA markers. Arrange can be omitted if data is set up at the describe level:
Verification Commands
| Context | Command | |
|---|---|---|
| CLI / Core / Website | pnpm test | |
| Node.js SDK | cd tests/sdks/nodejs && pnpm vitest run --reporter=verbose | |
| CDK | cd tests/iac && pnpm test | |
| CI parity | pnpm test:ci | |
| Lint | pnpm lint | |
| Format | pnpm format |
Decision Points
- Pure domain logic → unit test at domain layer
- Handler orchestrating ports → mock ports with
vi.fn() - AWS integration semantics → E2E with LocalStack/TestContainers
- Static data consistency → structural guard
- CDK infrastructure → snapshot + fine-grained assertions
Completion Criteria
- Test names follow
Should_<Expected>_When_<Condition> - AAA markers present, each at most once
sut,actual,expectedused consistently- Positive and negative paths covered
- Tests run green:
pnpm test - No lint regressions:
pnpm lint
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/typescript-testing/SKILL.md
Popularity
- Repository stars
- 135
- Repository forks
- 4
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/macalbert/envilder/typescript-testing)