diff --git a/test/integration/lib/server.js b/test/integration/lib/server.js index 0aae651157a..69c5fb6f7f7 100644 --- a/test/integration/lib/server.js +++ b/test/integration/lib/server.js @@ -7,7 +7,11 @@ const colors = require('chalk'); const fs = require('fs'); module.exports = function () { - const server = http.createServer(st({path: path.join(__dirname, '..')})); + const integrationPath = st({path: path.join(__dirname, '..'), url: '/'}); + const nodeModulesPath = st({path: path.join(__dirname, '../../../node_modules'), url: '/node_modules'}); + const server = http.createServer((req, res) => { + return nodeModulesPath(req, res, () => { return integrationPath(req, res); }); + }); function localURL(url) { return url.replace(/^local:\/\//, 'http://localhost:2900/'); @@ -84,13 +88,19 @@ module.exports = function () { // sources for (const k in styleJSON.sources) { - const sourceName = clearMapboxProtocol(styleJSON.sources[k].url); - if (styleJSON.sources[k].type === 'vector') { - styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.mvt` ]; - } else if (styleJSON.sources[k].type === 'raster') { - styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.png` ]; + if (styleJSON.sources[k].url === undefined) { + for (const t in styleJSON.sources[k].tiles) { + styleJSON.sources[k].tiles[t] = localURL(styleJSON.sources[k].tiles[t]); + } + } else { + const sourceName = clearMapboxProtocol(styleJSON.sources[k].url); + if (styleJSON.sources[k].type === 'vector') { + styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.mvt` ]; + } else if (styleJSON.sources[k].type === 'raster') { + styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.png` ]; + } + delete styleJSON.sources[k].url; } - delete styleJSON.sources[k].url; } // sprite diff --git a/test/integration/package.json b/test/integration/package.json index 41527c8c594..fbe59bd4ea0 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -5,6 +5,7 @@ "license": "BSD", "main": "index.js", "dependencies": { + "@mapbox/mvt-fixtures": "^3.2.0", "chalk": "^2.3.0", "d3-queue": "^3.0.3", "diff": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index c62c0dc306b..cbcac786a45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -141,6 +141,7 @@ "@mapbox/mapbox-gl-test-suite@file:test/integration": version "0.0.0" dependencies: + "@mapbox/mvt-fixtures" "^3.2.0" chalk "^2.3.0" d3-queue "^3.0.3" diff "^3.0.0" @@ -153,6 +154,16 @@ shuffle-seed "^1.1.6" st "^1.1.0" +"@mapbox/mvt-fixtures@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@mapbox/mvt-fixtures/-/mvt-fixtures-3.2.0.tgz#9312bfe1437f889cbc65a9d56efac02bbcb9a91d" + dependencies: + "@mapbox/sphericalmercator" "^1.0.5" + "@mapbox/vector-tile" "^1.3.0" + d3-queue "^3.0.7" + pbf "^3.0.5" + protocol-buffers-schema "^3.3.1" + "@mapbox/point-geometry@0.1.0", "@mapbox/point-geometry@^0.1.0", "@mapbox/point-geometry@~0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz#8a83f9335c7860effa2eeeca254332aa0aeed8f2" @@ -181,6 +192,10 @@ version "3.1.0" resolved "https://registry.yarnpkg.com/@mapbox/shelf-pack/-/shelf-pack-3.1.0.tgz#1edea9c0bf6715b217171ba60646c201af520f6a" +"@mapbox/sphericalmercator@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@mapbox/sphericalmercator/-/sphericalmercator-1.0.5.tgz#70237b9774095ed1cfdbcea7a8fd1fc82b2691f2" + "@mapbox/tiny-sdf@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@mapbox/tiny-sdf/-/tiny-sdf-1.1.0.tgz#b0b8f5c22005e6ddb838f421ffd257c1f74f9a20" @@ -2870,7 +2885,7 @@ d3-quadtree@1, d3-quadtree@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.3.tgz#ac7987e3e23fe805a990f28e1b50d38fcb822438" -d3-queue@3.0.7, d3-queue@^3.0.3: +d3-queue@3.0.7, d3-queue@^3.0.3, d3-queue@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618" @@ -7972,6 +7987,10 @@ protocol-buffers-schema@^2.0.2: version "2.2.0" resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-2.2.0.tgz#d29c6cd73fb655978fb6989691180db844119f61" +protocol-buffers-schema@^3.3.1: + version "3.3.2" + resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz#00434f608b4e8df54c59e070efeefc37fb4bb859" + protocols@^1.1.0, protocols@^1.4.0: version "1.4.5" resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.5.tgz#21de1f441c4ef7094408ed9f1c94f7a114b87557"