pfw-macro-testing

Snapshot test Swift macros using the MacroTesting library.

16|2|Updated Mar 29, 2018
One-click install
npx skills add https://github.com/khoi/dotfiles --skill pfw-macro-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pfw-macro-testing
Source: https://github.com/khoi/dotfiles/tree/main/chezmoi/dot_pfw/skills/macro-testing
Command: npx skills add https://github.com/khoi/dotfiles --skill pfw-macro-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Snapshot test Swift macros using the MacroTesting library to verify macro behavior and guard against regressions.

Core Features & Use Cases

  • Isolated macro tests in a dedicated test target
  • Snapshot comparisons to validate macro expansions across versions
  • Quick integration with Package.swift and MacroTesting

Quick Start

Add the swift-macro-testing dependency, hook MacroTesting to your test target, and import MacroTesting to begin snapshot testing macros.

Frequently Asked Questions about pfw-macro-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I snapshot test Swift macros to prevent regressions?

You can snapshot test Swift macros by adding the MacroTesting library to your test target and importing it to compare macro expansions against saved snapshots, verifying behavior and guarding against regressions.

What is the best way to verify Swift macro expansions across versions?

The best way to verify Swift macro expansions across versions is using snapshot testing with MacroTesting, which compares expanded macro outputs against reference snapshots to detect unintended changes in your Swift packages.

How do I integrate MacroTesting into a Swift package test target?

To integrate MacroTesting into a Swift package test target, add the swift-macro-testing dependency to your Package.swift, hook MacroTesting to your test target, and import the library to begin snapshot testing.

Does MacroTesting require an isolated test target for Swift packages?

Yes, MacroTesting is designed for isolated macro tests in a dedicated test target within your Swift packages, ensuring dependency management and documented usage are properly separated from your main code.

Why do my Swift macros keep breaking when I update dependencies?

Swift macros can break during dependency updates because macro expansions change silently, but adding snapshot testing with MacroTesting validates expansions across versions and catches regressions before they reach production.