Socket
Book a DemoInstallSign in
Socket

jest-transform-yaml

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-transform-yaml

Transforms for YAML within Jest

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
7.2K
-9.84%
Maintainers
1
Weekly downloads
 
Created
Source

jest-transform-yaml

A Jest transformer that allows the import of YAML files

Description

When you store your data in YAML format for your application, you might want to import that data within your Jest tests. By default, Jest does not know how to import YAML files, so you will need to provide a transformer

Installation

NOTE: I generally recommend saving exact dependencies to avoid accidental/unintentional updates, hence the added flags below.

# NPM
npm install jest-transform-yaml --save-dev

# Yarn
yarn add jest-transform-yaml --dev --exact

# PNPM
pnpm add jest-transform-yaml --save-dev --save-exact

Usage

In your jest.config.js (or jest.config.ts) file, add the following:

{
    // ... config
    transform: {
        // ... other transforms
        "\\.yaml$": "jest-transform-yaml",
    },
    "moduleFileExtensions": [/* ... other file extensions ... */, "yaml"],
}

Keywords

jest

FAQs

Package last updated on 29 Jul 2021

Did you know?

Socket

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