In tests, stop using mapnik module exposed by windshaft and require it from development dependencies

This commit is contained in:
Daniel García Aubert 2020-04-04 17:34:22 +02:00
parent f583a4240a
commit a3bdbf6202
18 changed files with 18 additions and 21 deletions

View File

@ -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",

View File

@ -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,

View File

@ -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 = [

View File

@ -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');

View File

@ -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;

View File

@ -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) => {

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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!)'

View File

@ -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');

View File

@ -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 () {

View File

@ -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'));

View File

@ -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) {