Socket
Socket
Sign inDemoInstall

fixturify

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fixturify

Convert objects into directory structures and back again


Version published
Weekly downloads
410K
decreased by-20.79%
Maintainers
2
Weekly downloads
 
Created

What is fixturify?

Fixturify is an npm package that allows you to create and manipulate file system fixtures programmatically. It is particularly useful for testing purposes, where you need to set up a specific file system state before running tests.

What are fixturify's main functionalities?

Create File System Fixtures

This feature allows you to create a directory structure with files and content programmatically. The `writeSync` method writes the specified files and directories to the file system.

const fixturify = require('fixturify');

const files = {
  'index.js': 'console.log("Hello, world!");',
  'lib': {
    'module.js': 'module.exports = {};'
  }
};

fixturify.writeSync('my-fixture', files);

Read File System Fixtures

This feature allows you to read a directory structure and its contents into a JavaScript object. The `readSync` method reads the specified directory and returns an object representing the file system structure.

const fixturify = require('fixturify');

const files = fixturify.readSync('my-fixture');
console.log(files);

Update File System Fixtures

This feature allows you to update an existing directory structure with new files or changes to existing files. The `writeSync` method can be used to overwrite or add new files to the specified directory.

const fixturify = require('fixturify');

const updates = {
  'index.js': 'console.log("Updated content");',
  'lib': {
    'newModule.js': 'module.exports = { new: true };'
  }
};

fixturify.writeSync('my-fixture', updates);

Other packages similar to fixturify

FAQs

Package last updated on 22 Feb 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc