
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Easily create and maintain test fixtures in the file system
yarn add --dev fixturez
/path/to/project/
/src/
/fixtures/
samples.txt
examples/...
/nested/
/fixtures/
data.json
test.js
// src/nested/test.js
const test = require('ava');
const fixtures = require('fixturez');
const f = fixtures(__dirname);
test('finding a fixture', t => {
let filePath = f.find('samples.txt'); // "/path/to/project/src/fixtures/samples.txt"
// ...
});
test('copying a file', t => {
let tmpPath = f.copy('data.json'); //
// "/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018/data.json"
// (from /path/to/project/src/nested/fixtures/samples.txt)
});
test('copying a directory', t => {
let tmpPath = f.copy('examples');
// "/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd/examples"
// (from /path/to/project/src/fixtures/examples)
});
const fixtures = require('fixturez');
fixtures(dirname, opts)Create fixture functions for the current file.
const f = fixtures(__dirname);
f.find(basename)Find and return the path to a fixture by its basename (directory or filename
including file extension).
let dirname = f.find('directory');
let filename = f.find('file.txt');
f.find('file'); // Error, not found!
f.copy(basename)Copy a fixture into a temporary directory by its basename.
let tempDir = f.copy('directory');
let tempFile = f.copy('file.txt');
f.temp()Create an empty temporary directory.
let tempDir = f.temp();
f.cleanup()Deletes any temporary files you created. This will automatically be called when the Node process closes.
opts.globWhich files to match against when searching up the file system.
Default: {fixtures,__fixtures__}/*
const f = fixtures(__dirname, { glob: 'mocks/*.json' });
opts.cleanupAutomatically cleanup temporary files created
Default: true
const f = fixtures(__dirname, { cleanup: false });
opts.rootSet the parent directory to stop searching for fixtures.
Default: "/"
const f = fixtures(__dirname, { root: 'path/to/project' });
FAQs
Easily create and maintain test fixtures in the file system
The npm package fixturez receives a total of 2,451 weekly downloads. As such, fixturez popularity was classified as popular.
We found that fixturez demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.