From a3bdbf6202e4330619637829030cc4c87334f458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Sat, 4 Apr 2020 17:34:22 +0200 Subject: [PATCH] In tests, stop using mapnik module exposed by windshaft and require it from development dependencies --- package.json | 1 + test/acceptance/auth/authorization-test.js | 2 +- test/acceptance/buffer-size-format-test.js | 2 +- test/acceptance/multilayer-test.js | 2 +- test/acceptance/named-layers-visibility-test.js | 2 +- test/acceptance/named-map-cache-regressions-test.js | 2 +- test/acceptance/named-maps-authentication-test.js | 2 +- test/acceptance/named-maps-cache-test.js | 2 +- test/acceptance/named-maps-static-view-test.js | 2 +- test/acceptance/named-maps-stats-test.js | 2 +- test/acceptance/ported/multilayer-test.js | 2 +- test/acceptance/ported/retina-test.js | 2 +- test/acceptance/ported/server-gettile-test.js | 2 +- test/acceptance/ported/support/ported-server-options.js | 2 +- test/acceptance/ported/support/test-client.js | 2 +- test/acceptance/turbo-carto/named-maps-test.js | 2 +- test/support/assert.js | 4 +--- test/support/test-client.js | 4 +--- 18 files changed, 18 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index c9db1c93..cc1750fc 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "yargs": "11.1.0" }, "devDependencies": { + "@carto/mapnik": "^3.6.2-carto.16", "eslint": "^6.5.1", "eslint-config-standard": "^14.1.0", "eslint-plugin-import": "^2.18.2", diff --git a/test/acceptance/auth/authorization-test.js b/test/acceptance/auth/authorization-test.js index cd277153..7b53a9e5 100644 --- a/test/acceptance/auth/authorization-test.js +++ b/test/acceptance/auth/authorization-test.js @@ -4,7 +4,7 @@ require('../../support/test-helper'); const assert = require('../../support/assert'); const TestClient = require('../../support/test-client'); -const mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); const PERMISSION_DENIED_RESPONSE = { status: 403, diff --git a/test/acceptance/buffer-size-format-test.js b/test/acceptance/buffer-size-format-test.js index 1a5e653a..7e2efbe5 100644 --- a/test/acceptance/buffer-size-format-test.js +++ b/test/acceptance/buffer-size-format-test.js @@ -6,7 +6,7 @@ var fs = require('fs'); var assert = require('../support/assert'); var TestClient = require('../support/test-client'); var serverOptions = require('../../lib/server-options'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var IMAGE_TOLERANCE_PER_MIL = 5; var CARTOCSS_LABELS = [ diff --git a/test/acceptance/multilayer-test.js b/test/acceptance/multilayer-test.js index a91d5e99..91868751 100644 --- a/test/acceptance/multilayer-test.js +++ b/test/acceptance/multilayer-test.js @@ -8,7 +8,7 @@ var step = require('step'); var strftime = require('strftime'); var redisStatsDb = 5; -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var semver = require('semver'); var helper = require('../support/test-helper'); diff --git a/test/acceptance/named-layers-visibility-test.js b/test/acceptance/named-layers-visibility-test.js index 1a717cf8..a9b0624c 100644 --- a/test/acceptance/named-layers-visibility-test.js +++ b/test/acceptance/named-layers-visibility-test.js @@ -9,7 +9,7 @@ var serverOptions = require('../../lib/server-options'); var RedisPool = require('redis-mpool'); var TemplateMaps = require('../../lib/backends/template-maps'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var IMAGE_TOLERANCE = 20; diff --git a/test/acceptance/named-map-cache-regressions-test.js b/test/acceptance/named-map-cache-regressions-test.js index 8d6c72d5..1c3423fb 100644 --- a/test/acceptance/named-map-cache-regressions-test.js +++ b/test/acceptance/named-map-cache-regressions-test.js @@ -6,7 +6,7 @@ const request = require('request'); const assert = require('assert'); const Server = require('../../lib/server'); const serverOptions = require('../../lib/server-options'); -const { mapnik } = require('windshaft'); +const mapnik = require('@carto/mapnik'); const helper = require('../support/test-helper'); const namedTileUrlTemplate = (ctx) => { diff --git a/test/acceptance/named-maps-authentication-test.js b/test/acceptance/named-maps-authentication-test.js index 848983b2..cd1e20eb 100644 --- a/test/acceptance/named-maps-authentication-test.js +++ b/test/acceptance/named-maps-authentication-test.js @@ -5,7 +5,7 @@ var RedisPool = require('redis-mpool'); var querystring = require('querystring'); var assert = require('../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var CartodbWindshaft = require('../../lib/server'); var serverOptions = require('../../lib/server-options'); var TemplateMaps = require('../../lib/backends/template-maps'); diff --git a/test/acceptance/named-maps-cache-test.js b/test/acceptance/named-maps-cache-test.js index 1c662991..4c036858 100644 --- a/test/acceptance/named-maps-cache-test.js +++ b/test/acceptance/named-maps-cache-test.js @@ -4,7 +4,7 @@ require('../support/test-helper'); const helper = require('../support/test-helper'); var assert = require('../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var CartodbWindshaft = require('../../lib/server'); var serverOptions = require('../../lib/server-options'); diff --git a/test/acceptance/named-maps-static-view-test.js b/test/acceptance/named-maps-static-view-test.js index 370f9034..08d5ac82 100644 --- a/test/acceptance/named-maps-static-view-test.js +++ b/test/acceptance/named-maps-static-view-test.js @@ -5,7 +5,7 @@ var testHelper = require('../support/test-helper'); var RedisPool = require('redis-mpool'); var assert = require('../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var CartodbWindshaft = require('../../lib/server'); var serverOptions = require('../../lib/server-options'); var TemplateMaps = require('../../lib/backends/template-maps'); diff --git a/test/acceptance/named-maps-stats-test.js b/test/acceptance/named-maps-stats-test.js index 6ccf112e..c7a1ded7 100644 --- a/test/acceptance/named-maps-stats-test.js +++ b/test/acceptance/named-maps-stats-test.js @@ -5,7 +5,7 @@ var RedisPool = require('redis-mpool'); var querystring = require('querystring'); var assert = require('../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var CartodbWindshaft = require('../../lib/server'); var serverOptions = require('../../lib/server-options'); var TemplateMaps = require('../../lib/backends/template-maps'); diff --git a/test/acceptance/ported/multilayer-test.js b/test/acceptance/ported/multilayer-test.js index db629f9a..8edb4fa9 100644 --- a/test/acceptance/ported/multilayer-test.js +++ b/test/acceptance/ported/multilayer-test.js @@ -6,7 +6,7 @@ var assert = require('../../support/assert'); var _ = require('underscore'); var querystring = require('querystring'); var step = require('step'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var cartodbServer = require('../../../lib/server'); var ServerOptions = require('./support/ported-server-options'); var LayergroupToken = require('../../../lib/models/layergroup-token'); diff --git a/test/acceptance/ported/retina-test.js b/test/acceptance/ported/retina-test.js index ac78b85b..5a54c664 100644 --- a/test/acceptance/ported/retina-test.js +++ b/test/acceptance/ported/retina-test.js @@ -3,7 +3,7 @@ var testHelper = require('../../support/test-helper'); var assert = require('../../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var cartodbServer = require('../../../lib/server'); var ServerOptions = require('./support/ported-server-options'); diff --git a/test/acceptance/ported/server-gettile-test.js b/test/acceptance/ported/server-gettile-test.js index 52135197..2c7be80c 100644 --- a/test/acceptance/ported/server-gettile-test.js +++ b/test/acceptance/ported/server-gettile-test.js @@ -3,7 +3,7 @@ var testHelper = require('../../support/test-helper'); var assert = require('../../support/assert'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var semver = require('semver'); var cartodbServer = require('../../../lib/server'); var ServerOptions = require('./support/ported-server-options'); diff --git a/test/acceptance/ported/support/ported-server-options.js b/test/acceptance/ported/support/ported-server-options.js index 57f85d28..cbaef299 100644 --- a/test/acceptance/ported/support/ported-server-options.js +++ b/test/acceptance/ported/support/ported-server-options.js @@ -2,7 +2,7 @@ var _ = require('underscore'); var serverOptions = require('../../../../lib/server-options'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var OverviewsQueryRewriter = require('../../../../lib/utils/overviews-query-rewriter'); var overviewsQueryRewriter = new OverviewsQueryRewriter({ zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)' diff --git a/test/acceptance/ported/support/test-client.js b/test/acceptance/ported/support/test-client.js index 48a773cf..fce97eba 100644 --- a/test/acceptance/ported/support/test-client.js +++ b/test/acceptance/ported/support/test-client.js @@ -7,7 +7,7 @@ var step = require('step'); var assert = require('../../../support/assert'); var _ = require('underscore'); var querystring = require('querystring'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var CartodbServer = require('../../../../lib/server'); var PortedServerOptions = require('./ported-server-options'); diff --git a/test/acceptance/turbo-carto/named-maps-test.js b/test/acceptance/turbo-carto/named-maps-test.js index f8d05532..5076b66f 100644 --- a/test/acceptance/turbo-carto/named-maps-test.js +++ b/test/acceptance/turbo-carto/named-maps-test.js @@ -6,7 +6,7 @@ var LayergroupToken = require('../../../lib/models/layergroup-token'); var testHelper = require('../../support/test-helper'); var CartodbWindshaft = require('../../../lib/server'); var serverOptions = require('../../../lib/server-options'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var IMAGE_TOLERANCE_PER_MIL = 10; describe('turbo-carto for named maps', function () { diff --git a/test/support/assert.js b/test/support/assert.js index a088a967..6bcee699 100644 --- a/test/support/assert.js +++ b/test/support/assert.js @@ -7,7 +7,7 @@ var fs = require('fs'); var path = require('path'); var util = require('util'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var request = require('request'); @@ -95,7 +95,6 @@ assert.response = function (server, req, res, callback) { var listener = server.listen(port, host); listener.on('error', callback); listener.on('listening', function onServerListening () { - // jshint maxcomplexity:9 const { address: host, port } = listener.address(); const address = `${host}:${port}`; @@ -186,7 +185,6 @@ function validateResponse (response, expected) { // @param tolerance number of tolerated grid cell differences assert.utfgridEqualsFile = function (buffer, fileB, tolerance, callback) { - // jshint maxcomplexity:9 fs.writeFileSync('/tmp/grid.json', buffer, 'binary'); // <-- to debug/update var expectedJson = JSON.parse(fs.readFileSync(fileB, 'utf8')); diff --git a/test/support/test-client.js b/test/support/test-client.js index 4d482786..f0798dad 100644 --- a/test/support/test-client.js +++ b/test/support/test-client.js @@ -5,7 +5,7 @@ var step = require('step'); const { URL } = require('url'); var PSQL = require('cartodb-psql'); var _ = require('underscore'); -var mapnik = require('windshaft').mapnik; +const mapnik = require('@carto/mapnik'); var LayergroupToken = require('../../lib/models/layergroup-token'); @@ -821,7 +821,6 @@ TestClient.prototype.getTile = function (z, x, y, params, callback) { ); }, function getTileResult (err, layergroupId) { - // jshint maxcomplexity:13 assert.ifError(err); self.keysToDelete['map_cfg|' + LayergroupToken.parse(layergroupId).token] = 0; @@ -931,7 +930,6 @@ TestClient.prototype.getTile = function (z, x, y, params, callback) { }; TestClient.prototype.getLayergroup = function (params, callback) { - // jshint maxcomplexity: 7 var self = this; if (!callback) {