Comparing version 0.2.1 to 0.3.0
15
index.js
@@ -35,7 +35,6 @@ var npm = require('npm'), | ||
} | ||
} else { | ||
for (var remoteVersion in message) break; | ||
callback(null, remoteVersion); | ||
} | ||
for (var remoteVersion in message) break; | ||
callback(null, remoteVersion); | ||
}); | ||
@@ -68,6 +67,6 @@ } | ||
callback(err); | ||
} else { | ||
log.info('published ok'); | ||
callback(); | ||
} | ||
log.info('published ok'); | ||
callback(); | ||
}); | ||
@@ -78,2 +77,4 @@ | ||
function shouldPublish(options, localVersion, remoteVersion) { | ||
options = options || {}; | ||
log.info('Local version: ' + localVersion); | ||
@@ -80,0 +81,0 @@ log.info('Published version: ' + remoteVersion); |
{ | ||
"name": "publish", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "npm auto publishing of your modules", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "expresso test/*.js" | ||
"test": "mocha --globals name" | ||
}, | ||
@@ -31,3 +31,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"expresso": "0.9.2" | ||
"mocha": "1.3.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "author": "Carlos Manzanares <carlos.manzanares@gmail.com>", |
@@ -1,9 +0,62 @@ | ||
// TODO: | ||
var assert = require('assert'), | ||
pkg = require('../package.json'), | ||
figaro = require('../index'); | ||
module.exports = { | ||
'TODO':function () { | ||
} | ||
}; | ||
log.level = 'silent'; | ||
describe('publish', function () { | ||
describe('#shouldPublish', function () { | ||
it('should publish because local version is higher than remote version', function () { | ||
assert.ok(figaro.shouldPublish(null, '1.3.5', '1.3.4')); | ||
}); | ||
it('should not publish because local version is equal to remote version', function () { | ||
assert.ok(!figaro.shouldPublish(null, '1.3.5', '1.3.5')); | ||
}); | ||
it('should not publish because local version is lower than remote version', function () { | ||
assert.ok(!figaro.shouldPublish(null, '1.3.3', '1.3.5')); | ||
}); | ||
it('should not publish because on-minor does not trigger on major changes', function () { | ||
assert.ok(!figaro.shouldPublish({'on-minor':true}, '2.3.3', '1.3.3')); | ||
}); | ||
it('should not publish because on-minor does not on trigger major and patch changes', function () { | ||
assert.ok(!figaro.shouldPublish({'on-minor':true}, '2.3.5', '1.3.3')); | ||
}); | ||
it('should publish because on-minor triggers on minor changes', function () { | ||
assert.ok(figaro.shouldPublish({'on-minor':true}, '2.3.3', '2.2.3')); | ||
}); | ||
it('should publish because on-minor and on-patch triggers on minor changes', function () { | ||
assert.ok(figaro.shouldPublish({'on-minor':true, 'on-patch': true}, '2.3.3', '2.2.3')); | ||
}); | ||
}); | ||
describe('#localPackage', function() { | ||
it('should report an error because it cannot find package.json', function(done) { | ||
figaro.localPackage(function(err) { | ||
assert.ok(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('#remoteVersion', function() { | ||
it('should provide the remote version of this module', function(done) { | ||
figaro.start(function(e) { | ||
assert.ok(!e); | ||
figaro.remoteVersion(pkg, function(err, remoteVersion) { | ||
assert.ok(!err); | ||
assert.ok(remoteVersion); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('should report an error because module not found', function (done) { | ||
figaro.start(function (e) { | ||
assert.ok(!e); | ||
figaro.remoteVersion({'name':'mysuperbogusnamethatcannotbefoundpublishedanywhere'}, function (err, remoteVersion) { | ||
assert.ok(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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
11498
195