You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2018/08/14 13:35:19 UTC
[couchdb-nano] branch master updated: feat: remove endswith
dependency in favour of ES6 String.endsWith (#106)
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
The following commit(s) were added to refs/heads/master by this push:
new 2263f3c feat: remove endswith dependency in favour of ES6 String.endsWith (#106)
2263f3c is described below
commit 2263f3c7d7227aed77d6834fda6f2c50ae51ec90
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Tue Aug 14 15:35:17 2018 +0200
feat: remove endswith dependency in favour of ES6 String.endsWith (#106)
* wip: stop depending on tape-it
tape-it should have moved over with nano, it’s a tape harness config,
but binds us to an old version of tape. I tried a simple copy and paste,
while keeping the tape version, but getting npm t issues. This is a
three-step process:
1. copy `dscape/tape-it/index.js` to `test/helpers/harness.js`
2. update the `require` in `test/helpers/integration.js`
3. make tests work
It leads us to the fun situation where our integration tests are run with
tape version ^3.0.1 and the rest with 4.6.2.
* feat: remove endswith dependency in favour of ES6 String.endsWith
---
package.json | 3 +--
tests/helpers/integration.js | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index beb36f5..7981af2 100644
--- a/package.json
+++ b/package.json
@@ -30,8 +30,7 @@
"istanbul": "^0.4.5",
"jshint": "^2.9.4",
"jscs": "^3.0.7",
- "nock": "^9.0.0",
- "endswith": "^0.0.0"
+ "nock": "^9.0.0"
},
"scripts": {
"test": "bash scripts/run_couchdb_on_travis.sh; npm run mocha; bash scripts/stop_couchdb_on_travis.sh",
diff --git a/tests/helpers/integration.js b/tests/helpers/integration.js
index a4bfadd..6f4a1a5 100644
--- a/tests/helpers/integration.js
+++ b/tests/helpers/integration.js
@@ -16,7 +16,6 @@ const async = require('async');
const debug = require('debug');
const path = require('path');
const harness = require('./harness');
-const endsWith = require('endswith');
const cfg = require('../fixtures/cfg');
const nano = require('../../lib/nano');
const helpers = require('./');
@@ -87,13 +86,13 @@ helpers.nock = function helpersNock(url, fixture, log) {
nockDefs.forEach(function(n) {
let headers = n.headers || {};
- const response = n.buffer ? endsWith(n.buffer, '.png') ?
+ const response = n.buffer ? n.buffer.endsWith('.png') ?
helpers.loadFixture(n.buffer) : new Buffer(n.buffer, 'base64') :
n.response || '';
const body = n.base64 ? new Buffer(n.base64, 'base64').toString() :
n.body || '';
- if (typeof headers === 'string' && endsWith(headers, '.json')) {
+ if (typeof headers === 'string' && headers.endsWith('.json')) {
headers = require(path.join(fixture, headers));
}