fixturify-project
Advanced tools
Comparing version 1.3.0 to 1.4.0
12
index.js
@@ -24,7 +24,7 @@ 'use strict'; | ||
this.isDependency = true; | ||
this._root = tmp.dirSync({ unsafeCleanup: true }).name; | ||
this._tmp = tmp.dirSync({ unsafeCleanup: true }); | ||
} | ||
get root() { | ||
return this._root; | ||
return this._tmp.name; | ||
} | ||
@@ -84,7 +84,7 @@ | ||
writeSync(root = this._root) { | ||
writeSync(root = this.root) { | ||
fixturify.writeSync(root, this.toJSON()); | ||
} | ||
readSync(root = this._root) { | ||
readSync(root = this.root) { | ||
let files = fixturify.readSync(root)[this.name]; | ||
@@ -204,2 +204,6 @@ | ||
} | ||
dispose() { | ||
this._tmp.removeCallback(); | ||
} | ||
} | ||
@@ -206,0 +210,0 @@ |
{ | ||
"name": "fixturify-project", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:stefanpenner/node-fixturify-project", |
@@ -95,1 +95,2 @@ # node-fixturify-project | ||
* `Project.prototype.addDevDependency(name, version)` add a devDependency to the given project | ||
* `Project.prototype.dispose()` immediately delete the given projects tmp directories. If left not invoked, these files will be deleted when the process exists. |
10
test.js
@@ -258,2 +258,12 @@ 'use strict'; | ||
}); | ||
it('has a working dispose to allow early cleanup', function() { | ||
let project = new Project('foo', '123'); | ||
project.addDependency('rsvp', '1.2.3'); | ||
project.addDevDependency('q', '1.2.4'); | ||
project.writeSync(); | ||
expect(fs.readdirSync(project.root)).to.eql(["foo"]); | ||
project.dispose(); | ||
expect(fs.existsSync(project.root)).to.eql(false); | ||
}); | ||
}); |
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
25898
400
96