Socket
Socket
Sign inDemoInstall

@adeira/fixtures-tester

Package Overview
Dependencies
3
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @adeira/fixtures-tester

Utility to ease testing with fixtures.


Version published
Weekly downloads
136
decreased by-39.56%
Maintainers
4
Created
Weekly downloads
 

Readme

Source
yarn add @adeira/fixtures-tester

generateTestsFromFixtures

This function loads all the fixtures (their file content) from your folder and it snapshots the result of your callback operation. This is handy when you have several example files, you want to perform some operation on top of them and snapshot the results.

import { generateTestsFromFixtures } from '@adeira/fixtures-tester';

function operation(input) {
  return doSomethingWithTheInput(input);
}

generateTestsFromFixtures(`${__dirname}/__fixtures__`, operation);

There are two additional modes which allow you to control the fixtures behavior more precisely. There are based on the fixture name:

  • simpleExample.graphql - fixture will snapshot as expected
  • simpleExample.only.graphql - only these snapshots will run (for debug only)
  • simpleExample.error.graphql - it's expected that fixture will throw an error (expected to fail tests)

The error file convention is required to prevent unintentional snapshots of exceptions.

FAQs

Last updated on 20 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc