parent-package-json
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,2 +12,3 @@ var fs = require('fs'), | ||
fileFound = true; | ||
break; | ||
} catch (e) {} | ||
@@ -14,0 +15,0 @@ |
{ | ||
"name": "parent-package-json", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Find, read and parse the package.json of the parent module", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,10 +9,10 @@ var assert = require('assert'), | ||
'test': { | ||
'package.json': '{"version":"1.0.0"}', | ||
'second_folder': { | ||
'package.json': '{"version":"2.0.0"}' | ||
}, | ||
'third_folder': { | ||
'fourth_folder': { | ||
'fifth_folder': { | ||
'package.json': '{"version":"3.0.0"}' | ||
'first_folder': { | ||
'package.json': '{"version":"2.0.0"}', | ||
'second_folder': { | ||
'third_folder': { | ||
'package.json': '{"version":"1.0.0"}', | ||
'fourth_folder': { | ||
'package.json': '{"version":"3.0.0"}' | ||
} | ||
} | ||
@@ -28,12 +28,12 @@ } | ||
it('should find a package.json in the parent directory', function() { | ||
expect(parent('test/second_folder').path).to.equal('test/package.json'); | ||
expect(parent('test/first_folder/second_folderthird_folder').path).to.equal('test/first_folder/package.json'); | ||
}); | ||
it('should find the parent package.json and ignore its own', function() { | ||
expect(parent('test/second_folder').path).to.equal('test/package.json'); | ||
expect(parent('test/first_folder/second_folder/third_folder/fourth_folder').path).to.equal('test/first_folder/second_folder/third_folder/package.json'); | ||
}); | ||
it('should continue until a package.json is found', function() { | ||
expect(parent('test/third_folder/fourth_folder/fifth_folder').path).to.equal('test/package.json'); | ||
expect(parent('test/first_folder/second_folder/third_folder').path).to.equal('test/first_folder/package.json'); | ||
}); | ||
it('should equal to false if no package.json can be found', function() { | ||
expect(parent('test')).to.equal(false); | ||
expect(parent('test/first_folder')).to.equal(false); | ||
}); | ||
@@ -49,4 +49,4 @@ it('should find its own package.json', function() { | ||
it('should be able to read a package.json', function() { | ||
expect(parent('test/second_folder').path).to.equal('test/package.json'); | ||
expect(parent('test/second_folder').read()).to.equal('{"version":"1.0.0"}'); | ||
expect(parent('test/first_folder/second_folder/third_folder').path).to.equal('test/first_folder/package.json'); | ||
expect(parent('test/first_folder/second_folder/third_folder').read()).to.equal('{"version":"2.0.0"}'); | ||
}); | ||
@@ -57,5 +57,5 @@ }); | ||
it('should be able to read and parse a package.json', function() { | ||
expect(parent('test/second_folder').path).to.equal('test/package.json'); | ||
expect(parent('test/second_folder').parse()).to.eql({'version': '1.0.0'}); | ||
expect(parent('test/second_folder').parse().version).to.equal('1.0.0'); | ||
expect(parent('test/first_folder/second_folder/third_folder').path).to.equal('test/first_folder/package.json'); | ||
expect(parent('test/first_folder/second_folder/third_folder').parse()).to.eql({'version': '2.0.0'}); | ||
expect(parent('test/first_folder/second_folder/third_folder').parse().version).to.equal('2.0.0'); | ||
}); | ||
@@ -62,0 +62,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
7581
86