Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-git-info

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-git-info - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

19

index.js

@@ -17,5 +17,22 @@ var proto = {

info.abbreviatedSha = package.gitHead && package.gitHead.slice(0, 10);
info.ref = (package._from || '').split('#')[1];
var requested = package._requested;
var type = requested && requested.type;
switch (type) {
case 'version':
info.ref = requested.spec;
break;
case 'tag':
info.ref = package.version;
break;
default:
info.ref = (package._from || '').split('#')[1];
break;
}
return info;
};

2

package.json
{
"name": "npm-git-info",
"version": "1.0.0",
"version": "1.0.1",
"description": "Retrieves git information from package that installed as NPM package.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -68,2 +68,34 @@ var expect = require('expect.js');

});
it('should detect info from NPM installed package with version', function() {
// this tests the result of: npm install ember-data@2.4.0
var subject = info(fixture('npm-version.json'));
expect(subject).to.eql({
name: 'ember-data',
version: '2.4.0',
sha: '9f8c40927a5e8a7966c251d99eb26c3f1fb0606e',
abbreviatedSha: '9f8c40927a',
ref: '2.4.0'
});
expect(subject.isInstalledAsNpmPackage()).to.be(true);
expect(subject.hasVersionInRef()).to.be(true);
});
it('should detect info from NPM installed package without a version', function() {
// this tests the result of: npm install ember-data
var subject = info(fixture('npm-without-version.json'));
expect(subject).to.eql({
name: 'ember-data',
version: '2.4.0',
sha: '9f8c40927a5e8a7966c251d99eb26c3f1fb0606e',
abbreviatedSha: '9f8c40927a',
ref: '2.4.0'
});
expect(subject.isInstalledAsNpmPackage()).to.be(true);
expect(subject.hasVersionInRef()).to.be(true);
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc