Skip to content

Commit

Permalink
Merge pull request #119 from salesforce/inline-version
Browse files Browse the repository at this point in the history
Inline version
  • Loading branch information
wtfismyip committed Aug 6, 2018
2 parents 4cbd182 + 3d8570c commit b897b49
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var pubsuffix = require('./pubsuffix-psl');
var Store = require('./store').Store;
var MemoryCookieStore = require('./memstore').MemoryCookieStore;
var pathMatch = require('./pathMatch').pathMatch;
var VERSION = require('../package.json').version;
var VERSION = require('./version');

var punycode;
try {
Expand Down Expand Up @@ -1420,6 +1420,7 @@ CAN_BE_SYNC.forEach(function(method) {
CookieJar.prototype[method+'Sync'] = syncWrap(method);
});

exports.version = VERSION;
exports.CookieJar = CookieJar;
exports.Cookie = Cookie;
exports.Store = Store;
Expand Down
2 changes: 2 additions & 0 deletions lib/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// generated by genversion
module.exports = '2.4.4-1'
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"RFC6265",
"RFC2965"
],
"version": "2.4.3",
"version": "2.4.4-1",
"homepage": "https://github.com/salesforce/tough-cookie",
"repository": {
"type": "git",
Expand All @@ -57,6 +57,7 @@
"lib"
],
"scripts": {
"version": "genversion lib/version.js && git add lib/version.js",
"test": "vows test/*_test.js",
"cover": "nyc --reporter=lcov --reporter=html vows test/*_test.js"
},
Expand All @@ -65,6 +66,7 @@
},
"devDependencies": {
"async": "^1.4.2",
"genversion": "^2.1.0",
"nyc": "^11.6.0",
"string.prototype.repeat": "^0.2.0",
"vows": "^0.8.2"
Expand Down
5 changes: 5 additions & 0 deletions test/api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ vows
assert.ok(CookieJar);
}
})
.addBatch({
"Version": function () {
assert.equal(tough.version, require('../package.json').version);
}
})
.addBatch({
"Constructor": {
topic: function () {
Expand Down
5 changes: 2 additions & 3 deletions test/jar_serialization_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var Cookie = tough.Cookie;
var CookieJar = tough.CookieJar;
var Store = tough.Store;
var MemoryCookieStore = tough.MemoryCookieStore;
var VERSION = require('../package.json').version;

var domains = ['example.com','www.example.com','example.net'];
var paths = ['/','/foo','/foo/bar'];
Expand Down Expand Up @@ -102,7 +101,7 @@ function setUp(context) {
function checkMetadata(serialized) {
assert.notEqual(serialized, null);
assert.isObject(serialized);
assert.equal(serialized.version, 'tough-cookie@'+VERSION);
assert.equal(serialized.version, 'tough-cookie@'+tough.version);
assert.equal(serialized.storeType, 'MemoryCookieStore');
assert.typeOf(serialized.rejectPublicSuffixes, 'boolean');
assert.isArray(serialized.cookies);
Expand Down Expand Up @@ -332,7 +331,7 @@ vows
},
"has expected metadata": function(err,jsonObj) {
assert.isNull(err);
assert.equal(jsonObj.version, 'tough-cookie@'+VERSION);
assert.equal(jsonObj.version, 'tough-cookie@'+tough.version);
assert.isTrue(jsonObj.rejectPublicSuffixes);
assert.equal(jsonObj.storeType, 'MemoryCookieStore');
},
Expand Down

0 comments on commit b897b49

Please sign in to comment.