node-pre-gyp-github
Advanced tools
Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "node-pre-gyp-github", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "A node-pre-gyp module which provides the ability to publish to GitHub releases.", | ||
@@ -8,4 +8,4 @@ "bin": "./bin/node-pre-gyp-github.js", | ||
"scripts": { | ||
"test": "mocha test", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report text-lcov -- -R spec | node ./node_modules/coveralls/bin/coveralls.js" | ||
"test": "nyc --reporter=html --reporter=text mocha", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -30,3 +30,3 @@ "repository": { | ||
"@octokit/rest": "^15.9.5", | ||
"commander": "^2.9.0", | ||
"commander": "^2.17.0", | ||
"mime-types": "^2.1.19", | ||
@@ -37,5 +37,5 @@ "sinon": "^6.1.4" | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.9", | ||
"istanbul": "^0.4.3", | ||
"mocha": "^2.5.3" | ||
"coveralls": "^3.0.2", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2" | ||
}, | ||
@@ -42,0 +42,0 @@ "author": "Bill Christo", |
@@ -19,3 +19,3 @@ "use strict"; | ||
var reset_mocks = function() { | ||
sandbox.restore(); | ||
sandbox.restore(); | ||
process.env.NODE_PRE_GYP_GITHUB_TOKEN = "secret"; | ||
@@ -25,3 +25,3 @@ fs = reset_index('fs'); | ||
index.stage_dir = stage_dir; | ||
Index.prototype.octokit = function() {return octokit;}; | ||
Index.prototype.octokit = function() {return octokit;}; | ||
sandbox.stub(octokit, 'authenticate'); | ||
@@ -44,4 +44,4 @@ sandbox.stub(octokit.repos, 'getReleases').callsFake(function(options, cb){ | ||
it("should publish a non-draft release without an error", function() { | ||
var options = {'draft': false, 'verbose': false}; | ||
it("should publish without error in all scenarios", function() { | ||
var log = console.log; | ||
reset_mocks(); | ||
@@ -51,14 +51,30 @@ fs.readdir = function(filename, cb) { | ||
}; | ||
fs.statSync = function() {return 0;} | ||
index.publish(options) | ||
expect(function(){ index.publish(options); }).to.not.throw(); | ||
}); | ||
it("should publish a draft release without an error", function() { | ||
var options = {'draft': true, 'verbose': false}; | ||
reset_mocks(); | ||
fs.readdir = function(filename, cb) { | ||
cb(null,["filename"]); | ||
fs.statSync = function() {return 0;} | ||
console.log = function() {}; | ||
// testing scenario when a release already exists | ||
expect(function(){ index.publish(); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': false, 'verbose': false}); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': false, 'verbose': true}); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': true, 'verbose': false}); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': true, 'verbose': true}); }).to.not.throw(); | ||
// testing scenario when a release does not already exist | ||
octokit.repos.getReleases = function(options, cb){ | ||
cb(null,{data: []}); | ||
}; | ||
expect(function(){ index.publish(options); }).to.not.throw(); | ||
octokit.repos.createRelease = function(options, cb){ | ||
cb(null, { data: { draft: false} }); | ||
}; | ||
expect(function(){ index.publish(); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': false, 'verbose': false}); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': false, 'verbose': true}); }).to.not.throw(); | ||
octokit.repos.createRelease = function(options, cb){ | ||
cb(null, { data: { draft: true} }); | ||
}; | ||
expect(function(){ index.publish({'draft': true, 'verbose': false}); }).to.not.throw(); | ||
expect(function(){ index.publish({'draft': true, 'verbose': true}); }).to.not.throw(); | ||
fs.readFileSync = function(){return '{"version":"0.0.1","repository": {"url":"git+https://github.com/test/test.git"},"binary":{"host":"https://github.com/test/test/releases/download/","remote_path":"{version}"}}';}; | ||
expect(function(){ index.publish(); }).to.not.throw(); | ||
console.log = log; | ||
}); | ||
@@ -110,3 +126,3 @@ | ||
octokit.repos.getReleases.restore(); | ||
sandbox.stub(octokit.repos, 'getReleases').callsFake(function(options, cb){ | ||
sandbox.stub(octokit.repos, 'getReleases').callsFake(function(options, cb){ | ||
cb(new Error('getReleases error')); | ||
@@ -117,3 +133,3 @@ }); | ||
it("should throw an error when github.releases.createRelease returns an error", function() { | ||
it("should throw an error when octokit.repos.createRelease returns an error", function() { | ||
var options = {'draft': true, 'verbose': false}; | ||
@@ -183,3 +199,3 @@ reset_mocks(); | ||
}; | ||
fs.statSync = function() {return 0;} | ||
fs.statSync = function() {return 0;} | ||
octokit.reposcreateRelease = function(options, cb){ | ||
@@ -186,0 +202,0 @@ cb(null,{data: {"tag_name":"0.0.1","draft":false,"assets":[{}]}}); |
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
20565
352
Updatedcommander@^2.17.0