JSPM

same-story-jest-plugin

0.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q50969F
  • License ISC

same story jest plugin

Package Exports

  • same-story-jest-plugin
  • same-story-jest-plugin/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (same-story-jest-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Same Story? Jest Plugin

What is this for?

This package is Jest plugin which runs in Jest context and let users to write a test to compare their work result against figma exported images. The way it works is similar to Figma plugin for same story but for Jest.

Prerequisite

  1. Please install the package by running this command. npm i -D same-story-jest-plugin.
  2. Please install pipenv cli because this is based on Python cli (only for development). The cli will be distributed soon.
  3. Please export png file from figma that you are going to compare with a correct name. That is the value for "dataPath" in your test input data for toBeSameStory matcher.

Setup for jest.

  1. Please create a jest.setup.ts and copy the following code.
import { toBeSameStory } from 'same-story-jest-plugin/lib'

expect.extend({ toBeSameStory })
  1. Include jest.setup.ts to your jest.config.js file.
  module.exports = {
    roots: ["<rootDir>"],
    ...
    setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
  };
  1. If you are using typescript, include this to your tsconfig.json.
  ...
  "files": ["node_modules/same-story-jest-plugin/types/index.d.ts"]
  ...