test-fixture
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -24,2 +24,6 @@ const path = require('path') | ||
get root () { | ||
return this._root | ||
} | ||
resolve (...args) { | ||
@@ -81,1 +85,2 @@ return args.length === 0 | ||
module.exports = (...args) => new Fixtures(...args) | ||
module.exports.Fixtures = Fixtures |
{ | ||
"name": "test-fixture", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Copy test-fixtures to temp dir and get resolved file paths.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ [![Build Status](https://travis-ci.org/kaelzhang/node-test-fixture.svg?branch=master)](https://travis-ci.org/kaelzhang/node-test-fixture) | ||
### fixtures(...paths): {resolve, copy, install} | ||
### fixtures(...paths): {resolve, copy, install, root} | ||
@@ -67,2 +67,19 @@ - **paths** `Array<path>` to define the root paths of the fixtures, which is similar as | ||
#### Without copying | ||
```js | ||
const {resolve} = fixtures(base) | ||
resolve('a.js') // -> /path/to/<base>/a.js | ||
``` | ||
#### Using `.copy()` | ||
```js | ||
const {copy, resolve} = fixtures(base) | ||
await copy('/path/to') | ||
resolve('a.js') // -> /path/to/a.js | ||
``` | ||
### await copy(options?) | ||
@@ -109,21 +126,8 @@ ### await copy(to?) | ||
#### Without copying | ||
### getter: root `string` | ||
```js | ||
const {resolve} = fixtures(base) | ||
resolve('a.js') // -> /path/to/<base>/a.js | ||
``` | ||
The fixture root `/<project-root>/test/fixtures` | ||
#### Using `.copy()` | ||
```js | ||
const {copy, resolve} = fixtures(base) | ||
await copy('/path/to') | ||
resolve('a.js') // -> /path/to/a.js | ||
``` | ||
## License | ||
[MIT](LICENSE) |
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
7114
71
131