Skip to content

mackoj/swift-snapshot-testing-plugin-webp

Repository files navigation

Important

  • This is a prototype implementation to test the ImagePluginAPI of swift-snapshot-testing.

swift-snapshot-testing-plugin-webp

This repo is an experimental use of this branch(pointfreeco/swift-snapshot-testing#904) that contains a PluginAPI for swift-snapshot-testing.

The goal of this is to show how easy it is to build a plugin.

Usage

To utilize the WEBP image serializer in your tests, follow these steps:

  1. Add the Dependency: Include this project as a dependency in your Package.swift file:

    .package(url: "https://github.com/mackoj/swift-snapshot-testing-plugin-webp.git", revision: "0.0.1"),
  2. Link to Your Test Target: Add the WEBPImageSerializer to your test target's dependencies:

    .product(name: "WEBPImageSerializer", package: "swift-snapshot-testing-plugin-webp"),
  3. Import and Set Up: In your test file, import the serializer and set the image format in the setUp() method:

    import WEBPImageSerializer

    override class func setUp() {
        SnapshotTesting.imageFormat = WEBPImageSerializer.imageFormat
    }

Important

On non Apple platform use this instead.

    import HEICImageSerializer

    override class func setUp() {
        SnapshotTesting.imageFormat = WEBPImageSerializer.imageFormat
        PluginRegistry.registerPlugin(WEBPImageSerializer.init())
    }

TODO

  • use webp directly
  • make the API ready for Swift 6 and async/throwing functions
  • create a tests suite
  • add documentations
  • add tutorials

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages