From 220473102ebee90a6c21325d4ff671b85d97e02c Mon Sep 17 00:00:00 2001 From: Moos Date: Thu, 22 Dec 2016 12:47:48 -0800 Subject: [PATCH] Fix DeprecationWarning for node 7.x --- README.md | 5 ++++- package.json | 2 +- src/dataFile.js | 2 +- src/piper.js | 2 +- test/wordpos_test.js | 10 +++++----- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7a8eda7..a656e86 100644 --- a/README.md +++ b/README.md @@ -289,7 +289,10 @@ See [bench/README](bench). ## Changes -1.1 - +1.1.1 + - Fix DeprecationWarning for node 7.x + +1.1.0 - added seek() method - added lexName property diff --git a/package.json b/package.json index f09aa62..3f2572a 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "verbs" ], "description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/moos/wordpos", "engines": { "node": ">=0.12" diff --git a/src/dataFile.js b/src/dataFile.js index bbf4f23..950366b 100644 --- a/src/dataFile.js +++ b/src/dataFile.js @@ -178,7 +178,7 @@ function lookup(offsets, callback) { function closeFile() { if (--self.refcount === 0) { //console.log(' ... closing', self.filePath); - fs.close(self.fd); + fs.closeSync(self.fd); self.fd = null; } return Promise.resolve(); diff --git a/src/piper.js b/src/piper.js index 4645d9e..c0985de 100644 --- a/src/piper.js +++ b/src/piper.js @@ -72,7 +72,7 @@ piper.wrapper = function(self, task /*, result...*/){ if (--self.refcount === 0) { //console.log(' ... closing', self.filePath); - fs.close(self.fd); + fs.closeSync(self.fd); self.fd = null; } }; diff --git a/test/wordpos_test.js b/test/wordpos_test.js index fa5e8f3..db63110 100644 --- a/test/wordpos_test.js +++ b/test/wordpos_test.js @@ -366,7 +366,7 @@ describe('seek()...', function() { assert(err instanceof Error); assert.equal(err.message, 'offset must be valid positive number.'); done(); - }); + }).catch(_.noop); // UnhandledPromiseRejectionWarning }); it('should handle wrong offset', function(done) { @@ -376,7 +376,7 @@ describe('seek()...', function() { assert.equal(err.message, 'Bad data at location ' + bad_offset); assert.deepEqual(result, {}); done(); - }); + }).catch(_.noop); // UnhandledPromiseRejectionWarning; }); it('should handle very large offset', function(done) { @@ -386,7 +386,7 @@ describe('seek()...', function() { assert.equal(err.message, 'no data at offset ' + bad_offset); assert.deepEqual(result, {}); done(); - }); + }).catch(_.noop); // UnhandledPromiseRejectionWarning; }); it('should handle bad pos', function(done) { @@ -394,13 +394,13 @@ describe('seek()...', function() { assert(err instanceof Error); assert(/Incorrect POS/.test(err.message)); done(); - }); + }).catch(_.noop); // UnhandledPromiseRejectionWarning; }); it('should handle wrong pos', function(done) { wordpos.seek(offset, 'v', function(err, result){ assert.equal(err.message, 'Bad data at location ' + offset); - }); + }).catch(_.noop); // UnhandledPromiseRejectionWarning; done(); });