Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
directory-fixture-provider
Advanced tools
npm install directory-fixture-provider --save-dev
When your library work with files and directories and you want to test it
const fixturesRoot = '/paht/to/your/fixture/directories/files'
/*
contains files and direcories for examnple:
- file-a.js
- file-b.js
- directory1/file-c.js
- directory2/contains-a-lot-of-files.js
- directory2/directory3/contains-a-lot-of-files-as-well.js
*/
const fixtureDirectoryProvider = require('directory-fixture-provider')(fixturesRoot)
const fixtureData = fixtureDirectoryProvider.get('directory2')
// fixtureData contains an object where
/*
{ dir: '/tmp/directory-fixture-provider-destination/KzXwBFDdtAmh/',
fixturePath: '/home/it/dev/misc/cowlog/packages/directory-fixture-provider/tests/directory-fixtures/',
getFixtureFiles: [Function: getFixtureFiles],
getDestinationFiles: [Function: getDestinationFiles],
getStatus: [Function: getStatus],
getFixtureContent: [Function] }
}
*/
This is how you start working with the tool, but the real fun starts. So you receive all files and subdirectories of the fixtures that subset what you were requesting too so in the example above the directory2 will be given back.
We have a random part of the path that is unique per fixture provider, so if you need clean data, create another directory-fixture-provider.
const fixtureDirectoryProvider = require('directory-fixture-provider')(fixturesRoot)
const fixtureData = fixtureDirectoryProvider.get('./')
const fixtureDir = fixtureData.dir
// Work with the files
// add/remove/modify files, and you will get relevant info about them
fixtureData.getStatus().changed
// true if something is changed.
fixtureData.getStatus().changeTotals
// gives you the number of files changed
If a new file is added, deleted or an existing changed each count as a change here.
fixtureData.getStatus().changeNumbers
/*
Returns an object like this:
{
deleted: 0
changed: 0
new: 0
}
*/
Where it tells you how many files changed, deleted or new
If a file is deleted it will increase the changed data tag too.
Create an excellent diff module for the getStatus resulting object.
This library helps you find changes modifications between your working and original fixture files. More examples are coming for more information; please check the tests
FAQs
Provides directories for testing.
The npm package directory-fixture-provider receives a total of 0 weekly downloads. As such, directory-fixture-provider popularity was classified as not popular.
We found that directory-fixture-provider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.