All skills
lexler avatar

/approval-tests

@83aee6a
by Lada Kesselerlexler/skill-factory238 stars
61

Writes approval tests (snapshot/golden master testing) for Python, JavaScript/TypeScript, or Java. Use when verifying complex output, characterization testing legacy code, testing combinations, or working with .approved/.received files.

Use this Skill: https://skilld.dev/gh/lexler/skill-factory/approval-tests

This session only. Nothing lands on disk.

links.md

≈544 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Source References

Official Repositories

Key Source Files

Python

  • approvaltests/approvals.py - Core verify functions
  • approvaltests/scrubbers/ - Scrubber implementations
  • approvaltests/namer/namer_factory.py - NamerFactory for parametrized tests
  • approvaltests/utilities/simple_logger.py - SimpleLogger for log verification

Java

  • approvaltests/src/main/java/org/approvaltests/Approvals.java - Core API
  • approvaltests/src/main/java/org/approvaltests/scrubbers/DateScrubber.java - Date scrubbing
  • approvaltests/src/main/java/org/approvaltests/namer/NamerFactory.java - Multiple approvals
  • approvaltests/src/main/java/org/approvaltests/utils/ConsoleOutput.java - Console capture

Node.js

  • lib/Providers/Jest/JestApprovals.ts - Jest integration
  • lib/Scrubbers/Scrubbers.ts - Scrubber utilities
  • lib/Scrubbers/DateScrubber.ts - Date scrubbing
  • lib/Core/Options.ts - Options class

Important Patterns

Scrubbers

  • GUIDs → guid_1, guid_2 (consistent replacement)
  • Dates → [Date1], [Date2] (auto-detect format from example)
  • Regex → custom pattern with static or indexed replacement
  • Combining → chain multiple scrubbers

Multiple Approvals Per Test

  • Python: NamerFactory.with_parameters()
  • Java: NamerFactory.withParameters(), NamerFactory.useMultipleFiles()
  • Node.js: Not supported

Inline Approvals

  • Python: Docstrings with verify() options
  • Java: Text blocks (""") with Options().inline(expected)
  • Node.js: Not supported (use Jest's toMatchInlineSnapshot() instead)

Feature Availability

All Languages

  • verify, verifyAsJson, verifyAll
  • Scrubbers (GUID, date, regex, custom)
  • Options (scrubber, reporter, file extension)
  • Combination testing

Python + Java Only

  • Multiple approvals per test (NamerFactory)
  • Inline approvals
  • Console/log output capture

Java Only

  • @UseReporter annotation
  • PackageSettings configuration
  • OS/machine-specific test naming

Source: SKILL.md on GitHub

1 warning6d4 checks · Risk SAFE
  • Gen Agent Trust Hub6d

    The skill provides instructions and patterns for implementing approval testing (snapshot testing) across multiple programming languages. It includes capabilities for file system operations, command execution for testing CLI tools, and launching external diff reporters, which are consistent with the skill's purpose. The analysis identified an indirect prompt injection surface when verifying external or untrusted data.

  • Socket6d

    No alerts

  • Snyk6d

    Risk: LOW · No issues

  • Runlayer7mo

    25/25 files flagged

Signed by skilld at 83aee6a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 8 months ago

README badge

README badge for lexler/skill-factory/approval-tests