directory-fixture-provider
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -56,3 +56,3 @@ 'use strict'; | ||
if (permanentParam === 'overwrite') { | ||
if (permanentParam === 'cleanFirst') { | ||
fsExtra.emptyDirSync(dir); | ||
@@ -59,0 +59,0 @@ } |
{ | ||
"name": "directory-fixture-provider", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Provides directories for testing.", | ||
@@ -50,3 +50,3 @@ "main": "dist/src/index.js", | ||
"recursive-readdir-sync": "^1.0.6", | ||
"unlimited-curry": "^1.2.2" | ||
"unlimited-curry": "^1.2.3" | ||
}, | ||
@@ -53,0 +53,0 @@ "devDependencies": { |
@@ -6,3 +6,3 @@ iti<!--- destination qa rewrite begin --> | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/d3fce811aecbe5c73ffb/maintainability)](https://codeclimate.com/github/vidaxl-com/cowlog/maintainability) | ||
<!--- | ||
<!--- | ||
[![Known Vulnerabilities](https://snyk.io/test/github/vidaxl-com/cowlog/badge.svg?targetFile=package.json)](https://snyk.io/test/github/vidaxl-com/cowlog?targetFile=package.json) | ||
@@ -21,8 +21,7 @@ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fvidaxl-com%2Fcowlog.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fvidaxl-com%2Fcowlog?ref=badge_shield) | ||
..comes to write something like this, when your library that work with files and directories and you want to test the | ||
..comes to write something like this, when your library that work with files and directories and you want to test the | ||
results. | ||
# Usage | ||
Directory-fixture-provider has its own limited DSL that gives you a few options for now, but can be handy to know about. | ||
## Basics | ||
@@ -41,4 +40,5 @@ | ||
*/ | ||
const fixtureDirectoryProvider = require('directory-fixture-provider')(fixturesRoot) | ||
const fixtureData = fixtureDirectoryProvider.get('directory2') | ||
const dfp = require('directory-fixture-provider') | ||
const fixtureDirectoryProvider = dfp(fixturesRoot)() | ||
const fixtureData = fixtureDirectoryProvider.get('directory2') | ||
@@ -58,3 +58,3 @@ // fixtureData contains an object where | ||
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 | ||
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. | ||
@@ -65,6 +65,21 @@ | ||
### Sometimes you need it play more deterministic | ||
Imagine a situation, when you are testing a small application that uses your | ||
framework, and you want to test your frameworks behaviour in the wild. | ||
In this case, you have your sample application, and you want to have installed | ||
its the dependencies, | ||
but the package.json does not change too often. In this case, it was nice | ||
overwriting the files, so you don't need that random part in the deployed directory. | ||
`const fixtureDirectoryProvider = dfp(fixturesRoot)('permanent')()` | ||
If you like the concept that your temporary files are in a fixed place, but rather you | ||
would empty the destination directory first you type: | ||
`const fixtureDirectoryProvider = dfp(fixturesRoot)('permanent','cleanFirst')()` | ||
## Check if your data has changed | ||
```javascript 1.6 | ||
const fixtureDirectoryProvider = require('directory-fixture-provider')(fixturesRoot) | ||
const fixtureDirectoryProvider = dfp(fixturesRoot)() | ||
const fixtureData = fixtureDirectoryProvider.get('./') | ||
@@ -86,3 +101,3 @@ const fixtureDir = fixtureData.dir | ||
If a new file is added, deleted or an existing changed each count as a change | ||
If a new file is added, deleted or an existing changed each count as a change | ||
here. | ||
@@ -89,0 +104,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13308
124
Updatedunlimited-curry@^1.2.3