From e53d6f5877443ad5c4b85a9887bd280edf74b5a0 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Wed, 22 Dec 2021 15:59:46 -0500 Subject: [PATCH] build: Upgrade sinon package. This also removes PhantomJS as a test environment. This is part of #1132. --- docs/developers.rst | 8 +- karma-base.js | 2 +- karma-cov.conf.js | 4 +- package-lock.json | 569 +++++++-------------------------- package.json | 11 +- src/transform.js | 2 +- tests/.eslintrc | 3 +- tests/cases/annotation.js | 8 +- tests/cases/annotationLayer.js | 2 +- tests/cases/feature.js | 2 +- tests/cases/featureLayer.js | 12 +- tests/cases/fileReader.js | 2 +- tests/cases/geojsonReader.js | 2 +- tests/cases/heatmap.js | 2 +- tests/cases/isolineFeature.js | 8 +- tests/cases/layer.js | 16 +- tests/cases/map.js | 149 ++++----- tests/cases/object.js | 4 +- tests/cases/renderers.js | 2 +- tests/cases/scaleWidget.js | 4 +- tests/cases/tileLayer.js | 10 +- tests/cases/trackFeature.js | 4 +- tests/headed-cases/examples.js | 2 +- tests/test-utils.js | 9 - tests/tutorials.js | 2 +- 25 files changed, 234 insertions(+), 605 deletions(-) diff --git a/docs/developers.rst b/docs/developers.rst index 0a1fefb5e1..538faaec3d 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -35,10 +35,10 @@ information is submitted to `codecov `_ for headless browser -testing of core utilities. Unfortunately because PhantomJS does not -support webgl at this time, so code paths requiring webgl must be either -mocked or run in an environment such as xvfb. +Geojs uses headless Chrome and Firefox for headless browser testing of core +utilities. If the headless mode does not support webgl at this time, code +paths requiring webgl must be either mocked or run in an environment such as +xvfb. The headless unit tests should be placed in the ``tests/cases/`` directory. All javascript files in this directory will be detected diff --git a/karma-base.js b/karma-base.js index 5f52616f29..05e85d0965 100644 --- a/karma-base.js +++ b/karma-base.js @@ -262,7 +262,7 @@ module.exports = function (config) { '/built/': '/base/dist/built/' }, browsers: [ - 'PhantomJS' + 'ChromeHeadlessTouch' ], customLaunchers: { ChromeHeadlessTouch: { diff --git a/karma-cov.conf.js b/karma-cov.conf.js index 8117504c9b..198aef347f 100644 --- a/karma-cov.conf.js +++ b/karma-cov.conf.js @@ -5,8 +5,8 @@ * Return URL friendly browser string */ function browser(b) { - /* The browser string starts with the basic browser name (Firefox, PhantomJS, - * etc. Split on the first space or dash to isolate this name. */ + /* The browser string starts with the basic browser name (Firefox, Chrome, + * etc.). Split on the first space or dash to isolate this name. */ return b.toLowerCase().split(/[ /-]/)[0]; } diff --git a/package-lock.json b/package-lock.json index 876d2dd222..15e0d8a998 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1000,6 +1000,41 @@ "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", "dev": true }, + "@sinonjs/commons": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "@sinonjs/samsam": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz", + "integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "@sinonjs/text-encoding": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", + "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", + "dev": true + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -1621,15 +1656,6 @@ "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", "dev": true }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, "asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -1683,12 +1709,6 @@ "integrity": "sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==", "dev": true }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -1713,12 +1733,6 @@ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", "dev": true }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1760,18 +1774,6 @@ "array-filter": "^1.0.0" } }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", - "dev": true - }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -2554,15 +2556,6 @@ "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "before-after-hook": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", @@ -3159,12 +3152,6 @@ "redeyed": "~2.1.0" } }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, "catharsis": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", @@ -3519,15 +3506,6 @@ "lodash": "^4.5.0" } }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", @@ -4625,15 +4603,6 @@ "integrity": "sha1-vEZ0gAQ3iyGjYMn8fPUjF5B2L7g=", "optional": true }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "date-format": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", @@ -4961,12 +4930,6 @@ } } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -5024,6 +4987,12 @@ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -5256,16 +5225,6 @@ "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==" }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -5649,12 +5608,6 @@ "event-emitter": "~0.3.5" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, "es6-set": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", @@ -6711,24 +6664,6 @@ "is-extglob": "^1.0.0" } }, - "extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, - "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, "eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", @@ -7169,12 +7104,6 @@ } } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, "forever-monitor": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/forever-monitor/-/forever-monitor-1.7.2.tgz", @@ -7222,26 +7151,6 @@ } } }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true, - "requires": { - "samsam": "~1.1" - } - }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -7463,15 +7372,6 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "git-log-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.0.tgz", @@ -7703,22 +7603,6 @@ } } }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -7923,16 +7807,6 @@ "minimalistic-assert": "^1.0.1" } }, - "hasha": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", - "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", - "dev": true, - "requires": { - "is-stream": "^1.0.1", - "pinkie-promise": "^2.0.0" - } - }, "highlight.js": { "version": "11.3.1", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.3.1.tgz", @@ -8044,17 +7918,6 @@ } } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", @@ -8526,12 +8389,6 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, - "is-generator-function": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", - "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==", - "dev": true - }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", @@ -8717,12 +8574,6 @@ "has-symbols": "^1.0.1" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -9047,12 +8898,6 @@ "xmlcreate": "^2.0.4" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, "jsdoc": { "version": "3.6.7", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.7.tgz", @@ -9149,12 +8994,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -9248,18 +9087,6 @@ "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, "jstransformer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", @@ -9320,6 +9147,12 @@ } } }, + "just-extend": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", + "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", + "dev": true + }, "karma": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/karma/-/karma-3.1.4.tgz", @@ -9869,22 +9702,6 @@ "integrity": "sha512-pzum1TL7j90DTE86eFt48/s12hqwQuiD+e5aXx2Dc9wDEn2LfGq6RoAxEZZjFiN0RDSCOnosEKRZWxbQ+iMpQQ==", "dev": true }, - "karma-phantomjs-launcher": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz", - "integrity": "sha1-0jyjSAG9qYY60xjju0vUBisTrNI=", - "dev": true, - "requires": { - "lodash": "^4.0.1", - "phantomjs-prebuilt": "^2.1.7" - } - }, - "karma-phantomjs-shim": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/karma-phantomjs-shim/-/karma-phantomjs-shim-1.5.0.tgz", - "integrity": "sha512-t0h1x7btXROaGElv36TLpuoWqTnVZ/f+GJHH/qVerjbX6AENoM5brQoB9ISO3hQ6zO1k9rDSRLrY5ZZb83ANdg==", - "dev": true - }, "karma-sinon": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/karma-sinon/-/karma-sinon-1.0.5.tgz", @@ -9939,12 +9756,6 @@ "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==" }, - "kew": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", - "dev": true - }, "keyv": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", @@ -10116,6 +9927,12 @@ "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", @@ -10244,12 +10061,6 @@ "object.assign": "^4.1.0" } }, - "lolex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", - "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", - "dev": true - }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -10940,6 +10751,45 @@ } } }, + "nise": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.0.tgz", + "integrity": "sha512-W5WlHu+wvo3PaKLsJJkgPup2LrsXCcm7AWwyNZkUnn5rwPkuPBi3Iwk5SQtN0mv+K65k7nKKjwNQ30wg3wLAQQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^7.0.4", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "path-to-regexp": "^1.7.0" + }, + "dependencies": { + "@sinonjs/fake-timers": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz", + "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + } + } + }, "node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -13212,12 +13062,6 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -13789,66 +13633,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "phantomjs-prebuilt": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", - "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3", - "extract-zip": "^1.6.5", - "fs-extra": "^1.0.0", - "hasha": "^2.2.0", - "kew": "^0.7.0", - "progress": "^1.1.8", - "request": "^2.81.0", - "request-progress": "^2.0.1", - "which": "^1.2.10" - }, - "dependencies": { - "fs-extra": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", - "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true - } - } - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -14630,12 +14414,6 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -15679,51 +15457,6 @@ "is-finite": "^1.0.0" } }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - } - } - }, - "request-progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", - "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", - "dev": true, - "requires": { - "throttleit": "^1.0.0" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -15894,12 +15627,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "samsam": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", - "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", - "dev": true - }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -16652,15 +16379,34 @@ } }, "sinon": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", - "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-12.0.1.tgz", + "integrity": "sha512-iGu29Xhym33ydkAT+aNQFBINakjq69kKO6ByPvTsm3yyIACfyQttRTP03aBP/I8GfhFmLzrnKwNNkr0ORb1udg==", "dev": true, "requires": { - "formatio": "1.1.1", - "lolex": "1.3.2", - "samsam": "1.1.2", - "util": ">=0.10.3 <1" + "@sinonjs/commons": "^1.8.3", + "@sinonjs/fake-timers": "^8.1.0", + "@sinonjs/samsam": "^6.0.2", + "diff": "^5.0.0", + "nise": "^5.1.0", + "supports-color": "^7.2.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "slash": { @@ -17023,23 +16769,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "ssri": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", @@ -17641,12 +17370,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", - "dev": true - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -17777,16 +17500,6 @@ "integrity": "sha1-jLmInzlp4JZqZeoKcV8g7IiNFO0=", "dev": true }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -17855,21 +17568,6 @@ "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -17885,6 +17583,12 @@ "prelude-ls": "~1.1.2" } }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "type-fest": { "version": "0.18.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", @@ -18287,20 +17991,6 @@ "tmp": "0.0.x" } }, - "util": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", - "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -18360,17 +18050,6 @@ "integrity": "sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==", "dev": true }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "vgl": { "version": "0.3.11", "resolved": "https://registry.npmjs.org/vgl/-/vgl-0.3.11.tgz", diff --git a/package.json b/package.json index 0cc5f4aedc..dd55fc6119 100644 --- a/package.json +++ b/package.json @@ -72,15 +72,12 @@ "karma-firefox-launcher": "^1.3.0", "karma-jasmine": "^2.0.0", "karma-jasmine-html-reporter": "^1.7.0", - "karma-phantomjs-launcher": "^1.0.0", - "karma-phantomjs-shim": "^1.5.0", - "karma-sinon": "^1.0.4", + "karma-sinon": "^1.0.5", "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "^0.0.32", "karma-webpack": "^3.0.5", "nib": "^1.1.2", "pako": "^2.0.4", - "phantomjs-prebuilt": "^2.1.5", "pug": "^3.0.2", "pug-lint": "^2.6.0", "pug-load": "^3.0.0", @@ -89,7 +86,7 @@ "semantic-release": "^17.4.7", "serve-index": "^1.9.1", "shader-loader": "^1.3.1", - "sinon": "^1.17.7", + "sinon": "^12.0.1", "string-replace-webpack-plugin": "^0.1.3", "style-loader": "^0.23.1", "stylus": "^0.56.0", @@ -140,8 +137,8 @@ "lint": "eslint --cache . --max-warnings=0", "puglint": "pug-lint src examples", "glsllint": "find . \\( -name '*.frag' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S frag || exit 1; done' sh {} \\+ && find . \\( -name '*.vert' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S vert || exit 1; done' sh {} \\+", - "test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS", - "test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS", + "test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch", + "test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch", "test-headed": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull", "tets-headed-all": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull,FirefoxWithProxy", "test-headed-xvfb": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeFull", diff --git a/src/transform.js b/src/transform.js index 14f9d857ef..29475afa6b 100644 --- a/src/transform.js +++ b/src/transform.js @@ -582,7 +582,7 @@ transform.transformCoordinatesFlatArray3 = function (srcPrj, tgtPrj, coordinates var src = proj4.Proj(srcPrj), tgt = proj4.Proj(tgtPrj), projPoint, initPoint = {}; - let trans = new proj4(src, tgt); + const trans = new proj4(src, tgt); for (i = coordinates.length - 3; i >= 0; i -= 3) { initPoint.x = +coordinates[i]; initPoint.y = +coordinates[i + 1]; diff --git a/tests/.eslintrc b/tests/.eslintrc index 23b9c5365d..e1b68eb4eb 100644 --- a/tests/.eslintrc +++ b/tests/.eslintrc @@ -2,7 +2,6 @@ "extends": "../.eslintrc", "env": { "browser": false, - "jasmine": true, - "phantomjs": true + "jasmine": true } } diff --git a/tests/cases/annotation.js b/tests/cases/annotation.js index 91c243f00e..5eb7cc3777 100644 --- a/tests/cases/annotation.js +++ b/tests/cases/annotation.js @@ -103,7 +103,7 @@ describe('geo.annotation', function () { expect(ann.coordinates()).toEqual([]); // check that reusing an annotationId throws a warning - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); params.annotationId = 10; ann = geo.annotation.annotation('test2', params); layer.addAnnotation(ann); @@ -1458,7 +1458,7 @@ describe('geo.annotation', function () { }); it('registerAnnotation', function () { var func = function () { newshapeCount += 1; return 'newshape return'; }; - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); expect($.inArray('newshape', geo.listAnnotations()) >= 0).toBe(false); expect(geo.registerAnnotation('newshape', func)).toBe(undefined); expect($.inArray('newshape', geo.listAnnotations()) >= 0).toBe(true); @@ -1469,7 +1469,7 @@ describe('geo.annotation', function () { console.warn.restore(); }); it('createAnnotation', function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); expect(geo.createAnnotation('unknown')).toBe(undefined); expect(console.warn.calledOnce).toBe(true); console.warn.restore(); @@ -1504,7 +1504,7 @@ describe('geo.annotation', function () { expect($.inArray('point', features) >= 0).toBe(false); }); it('rendererForAnnotations', function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); expect(geo.rendererForAnnotations(['polygon'])).toBe('webgl'); expect(console.warn.calledOnce).toBe(false); expect(geo.rendererForAnnotations(['point'])).toBe('webgl'); diff --git a/tests/cases/annotationLayer.js b/tests/cases/annotationLayer.js index 9439675848..6c611b436f 100644 --- a/tests/cases/annotationLayer.js +++ b/tests/cases/annotationLayer.js @@ -345,7 +345,7 @@ describe('geo.annotationLayer', function () { var map, layer, point, rect, rect2, editActionEvent = 0; beforeAll(function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); }); afterAll(function () { console.warn.restore(); diff --git a/tests/cases/feature.js b/tests/cases/feature.js index 99a55f433b..149b47cf82 100644 --- a/tests/cases/feature.js +++ b/tests/cases/feature.js @@ -7,7 +7,7 @@ describe('geo.feature', function () { 'use strict'; beforeEach(function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); }); afterEach(function () { console.warn.restore(); diff --git a/tests/cases/featureLayer.js b/tests/cases/featureLayer.js index 8add360b25..ee196f13e2 100644 --- a/tests/cases/featureLayer.js +++ b/tests/cases/featureLayer.js @@ -7,7 +7,7 @@ describe('geo.featureLayer', function () { 'use strict'; beforeEach(function () { - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); }); afterEach(function () { console.log.restore(); @@ -51,7 +51,7 @@ describe('geo.featureLayer', function () { layer = map.createLayer('feature', {renderer: 'svg'}); expect(layer._update()).toBe(layer); var feat = layer.createFeature('point'); - sinon.stub(feat, '_update', function () {}); + sinon.stub(feat, '_update').callsFake(function () {}); expect(layer._update()).toBe(layer); expect(feat._update.calledOnce).toBe(true); }); @@ -86,15 +86,15 @@ describe('geo.featureLayer', function () { expect(layer.features().length).toBe(2); layer.removeFeature(feat3); expect(layer.features().length).toBe(2); - sinon.stub(feat2, '_exit', function () {}); + sinon.stub(feat2, '_exit').callsFake(function () {}); layer.removeFeature(feat2); expect(layer.features().length).toBe(1); expect(feat2._exit.calledOnce).toBe(false); feat2._exit.restore(); }); it('deleteFeature', function () { - sinon.stub(feat1, '_exit', function () {}); - sinon.stub(feat2, '_exit', function () {}); + sinon.stub(feat1, '_exit').callsFake(function () {}); + sinon.stub(feat2, '_exit').callsFake(function () {}); layer.deleteFeature(feat2); expect(layer.features().length).toBe(1); expect(feat2._exit.calledOnce).toBe(false); @@ -165,7 +165,7 @@ describe('geo.featureLayer', function () { expect(layer.node().hasClass('active')).toBe(true); }); it('draw', function () { - sinon.stub(feat1, 'draw', function () {}); + sinon.stub(feat1, 'draw').callsFake(function () {}); expect(layer.draw()).toBe(layer); expect(feat1.draw.calledOnce).toBe(true); }); diff --git a/tests/cases/fileReader.js b/tests/cases/fileReader.js index de9fe9dc46..508351fc53 100644 --- a/tests/cases/fileReader.js +++ b/tests/cases/fileReader.js @@ -56,7 +56,7 @@ describe('geo.fileReader', function () { map = createMap(); layer = map.createLayer('feature'); reader = geo.fileReader({layer: layer}); - // The PhantomJS browser doesn't support `new File`, so use `new Blob` + // This could be changed to `new File` file = new Blob(['This is ', 'a test'], {type: 'text/plain'}); file.lastModifiedDate = new Date(); file.name = 'test.txt'; diff --git a/tests/cases/geojsonReader.js b/tests/cases/geojsonReader.js index c89bbf066d..cfbd5bb060 100644 --- a/tests/cases/geojsonReader.js +++ b/tests/cases/geojsonReader.js @@ -111,7 +111,7 @@ describe('geo.geojsonReader', function () { expect(reader.canRead('')).toBe(false); expect(reader.canRead(['not a geojson object'])).toBe(false); expect(reader.canRead(obj)).toBe(true); - // The PhantomJS browser don't support `new File`, so use `new Blob` + // This could be changed to `new File` file = new Blob([JSON.stringify(obj)], {type: 'text/plain'}); file.lastModifiedDate = new Date(); file.name = 'test.txt'; diff --git a/tests/cases/heatmap.js b/tests/cases/heatmap.js index 9658331efb..41c0674e0b 100644 --- a/tests/cases/heatmap.js +++ b/tests/cases/heatmap.js @@ -16,7 +16,7 @@ describe('canvas heatmap', function () { [0.2, 42.2776, -83.7409]]; var clock; beforeEach(function () { - clock = sinon.useFakeTimers(); + clock = sinon.useFakeTimers({now: Date.now(), toFake: ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']}); }); afterEach(function () { clock.restore(); diff --git a/tests/cases/isolineFeature.js b/tests/cases/isolineFeature.js index e74f708d7f..0885ca2aa3 100644 --- a/tests/cases/isolineFeature.js +++ b/tests/cases/isolineFeature.js @@ -439,8 +439,8 @@ describe('Isoline Feature', function () { var isoline = layer.createFeature('isoline', { isoline: {elements: squareElements}}).data(vertexList); isoline._build(); - sinon.stub(layer.features()[1], 'draw', function () {}); - sinon.stub(layer.children()[2].features()[0], 'draw', function () {}); + sinon.stub(layer.features()[1], 'draw').callsFake(function () {}); + sinon.stub(layer.children()[2].features()[0], 'draw').callsFake(function () {}); isoline.draw(); expect(layer.features()[1].draw.calledOnce).toBe(true); expect(layer.children()[2].features()[0].draw.calledOnce).toBe(true); @@ -483,8 +483,8 @@ describe('Isoline Feature', function () { var isoline = layer.createFeature('isoline', { isoline: {elements: squareElements}}).data(vertexList); isoline._build(); - sinon.stub(layer.features()[1], 'modified', function () {}); - sinon.stub(layer.children()[2].features()[0], 'modified', function () {}); + sinon.stub(layer.features()[1], 'modified').callsFake(function () {}); + sinon.stub(layer.children()[2].features()[0], 'modified').callsFake(function () {}); isoline.modified(); expect(layer.features()[1].modified.calledOnce).toBe(true); expect(layer.children()[2].features()[0].modified.calledOnce).toBe(true); diff --git a/tests/cases/layer.js b/tests/cases/layer.js index fde126b634..ab0a698565 100644 --- a/tests/cases/layer.js +++ b/tests/cases/layer.js @@ -11,7 +11,7 @@ describe('geo.layer', function () { 'use strict'; beforeEach(function () { - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); }); afterEach(function () { console.log.restore(); @@ -44,12 +44,12 @@ describe('geo.layer', function () { expect(layer.initialized()).toBe(true); expect(layer.children().length).toBe(1); - warn = sinon.stub(console, 'warn', function () {}); + warn = sinon.stub(console, 'warn').callsFake(function () {}); layer = geo.layer.create(map, {renderer: 'notarenderer'}); expect(warn.calledOnce).toBe(true); console.warn.restore(); - warn = sinon.stub(console, 'warn', function () {}); + warn = sinon.stub(console, 'warn').callsFake(function () {}); layer = geo.layer.create(map, {type: 'notalayertype', renderer: 'canvas'}); expect(warn.calledOnce).toBe(true); console.warn.restore(); @@ -278,7 +278,7 @@ describe('geo.webgl.layer', function () { var map, layer1, layer2, layer3; it('_init', function (done) { mockWebglRenderer(); - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); map = createMap(); layer1 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/white.jpg', autoshareRenderer: false}); layer2 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/weather.png', keepLower: false, autoshareRenderer: false}); @@ -327,7 +327,7 @@ describe('geo.webgl.layer', function () { var map, layer1, layer2, layer3; it('_init', function (done) { mockWebglRenderer(); - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); map = createMap(); layer1 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/white.jpg'}); layer2 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/weather.png', keepLower: false}); @@ -388,7 +388,7 @@ describe('geo.webgl.layer', function () { var map, layer1, layer2, layer3; it('_init', function (done) { mockWebglRenderer(); - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); map = createMap(); map.autoshareRenderer('more'); layer1 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/white.jpg'}); @@ -450,7 +450,7 @@ describe('geo.webgl.layer', function () { var map, layer1, layer2, layer3; it('_init', function (done) { mockWebglRenderer(); - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); map = createMap(); layer1 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/white.jpg', autoshareRenderer: 'more'}); layer2 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/weather.png', keepLower: false, autoshareRenderer: false}); @@ -491,7 +491,7 @@ describe('geo.webgl.layer', function () { var map, layer1, layer2, layer3; it('_init', function (done) { mockWebglRenderer(); - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); map = createMap(); layer1 = map.createLayer('osm', {renderer: 'webgl', url: '/testdata/white.jpg', autoshareRenderer: false}); layer2 = map.createLayer('osm', {url: '/testdata/weather.png', keepLower: false, autoshareRenderer: false, renderer: layer1.renderer()}); diff --git a/tests/cases/map.js b/tests/cases/map.js index 217d8618f2..16ae6b8b38 100644 --- a/tests/cases/map.js +++ b/tests/cases/map.js @@ -6,7 +6,6 @@ describe('geo.core.map', function () { var $ = require('jquery'); var geo = require('../test-utils').geo; var createMap = require('../test-utils').createMap; - var isPhantomJS = require('../test-utils').isPhantomJS; var closeToEqual = require('../test-utils').closeToEqual; var mockAnimationFrame = require('../test-utils').mockAnimationFrame; var stepAnimationFrame = require('../test-utils').stepAnimationFrame; @@ -225,7 +224,7 @@ describe('geo.core.map', function () { }); it('animationQueue with bad callback', function () { mockAnimationFrame(); - var error = sinon.stub(console, 'error', function () {}), + var error = sinon.stub(console, 'error').callsFake(function () {}), m = createMap(), called = 0, start = Date.now(); @@ -849,98 +848,64 @@ describe('geo.core.map', function () { done(); }); }); - // These tests won't work in PhantomJS. See - // https://bugs.webkit.org/show_bug.cgi?id=17352, also 29305 and 129172. - if (!isPhantomJS()) { - it('mix-blend-mode multiply', function (done) { - layer2.node().css('mix-blend-mode', 'multiply'); - m.screenshot().then(function (result) { - expect(result).not.toEqual(ss.basic); - expect(result).not.toEqual(ss.onelayer); - layer2.node().css('mix-blend-mode', 'initial'); - done(); - }); + it('mix-blend-mode multiply', function (done) { + layer2.node().css('mix-blend-mode', 'multiply'); + m.screenshot().then(function (result) { + expect(result).not.toEqual(ss.basic); + expect(result).not.toEqual(ss.onelayer); + layer2.node().css('mix-blend-mode', 'initial'); + done(); }); - it('mix-blend-mode normal', function (done) { - layer2.node().css('mix-blend-mode', 'normal'); - m.screenshot().then(function (result) { - expect(result).toEqual(ss.basic); - layer2.node().css('mix-blend-mode', 'initial'); - done(); - }); + }); + it('mix-blend-mode normal', function (done) { + layer2.node().css('mix-blend-mode', 'normal'); + m.screenshot().then(function (result) { + expect(result).toEqual(ss.basic); + layer2.node().css('mix-blend-mode', 'initial'); + done(); }); - it('layer background', function (done) { - var layer3 = m.createLayer('ui'); - layer3.node().css('background-image', 'url(/data/tilefancy.png)'); - m.screenshot().then(function (result) { - expect(result).not.toEqual(ss.basic); - expect(result).not.toEqual(ss.nobackground); - m.deleteLayer(layer3); - done(); - }); - }, 10000); - it('layer css background', function (done) { - geo.jQuery('head').append(''); - var layer3 = m.createLayer('ui'); - layer3.node().addClass('image-background'); - layer3.opacity(0.5); - m.screenshot().then(function (result) { - expect(result).not.toEqual(ss.basic); - expect(result).not.toEqual(ss.nobackground); - m.deleteLayer(layer3); - done(); - }); - }, 10000); - it('layer missing css background', function (done) { - geo.jQuery('head').append(''); - var layer3 = m.createLayer('ui'); - layer3.node().addClass('image-background'); - layer3.opacity(0.5); - m.screenshot().then(function (result) { - expect(result).not.toEqual(ss.basic); - expect(result).not.toEqual(ss.nobackground); - m.deleteLayer(layer3); - done(); - }); - }, 10000); - /* Extra html */ - it('screenshot with extra html', function (done) { - m.screenshot(null, undefined, undefined, {html: ['body']}).then(function (result) { - expect(result.substr(0, 22)).toBe('data:image/png;base64,'); - done(); - }); + }); + it('layer background', function (done) { + var layer3 = m.createLayer('ui'); + layer3.node().css('background-image', 'url(/data/tilefancy.png)'); + m.screenshot().then(function (result) { + expect(result).not.toEqual(ss.basic); + expect(result).not.toEqual(ss.nobackground); + m.deleteLayer(layer3); + done(); }); - } - // end of non-PhantomJS tests - if (isPhantomJS()) { - it('no html to image warning', function (done) { - var layer3 = m.createLayer('ui'); - layer3.node().css('background-image', 'url(/data/tilefancy.png)'); - var warn = sinon.stub(console, 'warn', function () {}); - m.screenshot().then(function (result) { - expect(warn.calledOnce).toBe(true); - expect(result).toEqual(ss.basic); - m.deleteLayer(layer3); - console.warn.restore(); - done(); - }); - }, 10000); - it('warnings on html to image failures', function (done) { - var layer3 = m.createLayer('ui'); - layer3.node().css('background-image', 'url(/data/tilefancy.png)'); - var warn = sinon.stub(console, 'warn', function () {}); - sinon.stub(geo.util, 'htmlToImageSupported', function () { return true; }); - m.screenshot().fail(function () { - expect(warn.calledOnce).toBe(true); - expect(warn.calledWith('Failed to convert screenshot to output')).toBe(true); - m.deleteLayer(layer3); - geo.util.htmlToImageSupported.restore(); - console.warn.restore(); - done(); - }); - }, 10000); - } - // end of PhantomJS tests + }, 10000); + it('layer css background', function (done) { + geo.jQuery('head').append(''); + var layer3 = m.createLayer('ui'); + layer3.node().addClass('image-background'); + layer3.opacity(0.5); + m.screenshot().then(function (result) { + expect(result).not.toEqual(ss.basic); + expect(result).not.toEqual(ss.nobackground); + m.deleteLayer(layer3); + done(); + }); + }, 10000); + it('layer missing css background', function (done) { + geo.jQuery('head').append(''); + var layer3 = m.createLayer('ui'); + layer3.node().addClass('image-background'); + layer3.opacity(0.5); + m.screenshot().then(function (result) { + expect(result).not.toEqual(ss.basic); + expect(result).not.toEqual(ss.nobackground); + m.deleteLayer(layer3); + done(); + }); + }, 10000); + /* Extra html */ + it('screenshot with extra html', function (done) { + m.screenshot(null, undefined, undefined, {html: ['body']}).then(function (result) { + expect(result.substr(0, 22)).toBe('data:image/png;base64,'); + done(); + }); + }); it('layers in a different order', function (done) { m.screenshot([layer2, layer1]).then(function (result) { // the order doesn't matter @@ -1000,7 +965,7 @@ describe('geo.core.map', function () { m.exit(); node.remove(); - var warn = sinon.stub(console, 'warn', function () {}); + var warn = sinon.stub(console, 'warn').callsFake(function () {}); expect(geo.map.create({})).toBe(null); expect(warn.calledTwice).toBe(true); expect(warn.calledWith('map creation requires a node')).toBe(true); diff --git a/tests/cases/object.js b/tests/cases/object.js index bc4b12836f..3d7bfe05cd 100644 --- a/tests/cases/object.js +++ b/tests/cases/object.js @@ -234,7 +234,7 @@ describe('geo.object', function () { }); it('Test a non-function handler', function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); var obj = new geo.object(), evtData = {}, handler = new CallCounter(evtData); @@ -248,7 +248,7 @@ describe('geo.object', function () { }); it('Test a handler that has an error', function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); var obj = new geo.object(), evtData = {}, handler = new CallCounter(evtData); diff --git a/tests/cases/renderers.js b/tests/cases/renderers.js index 0476fd015d..bfa3c09e5c 100644 --- a/tests/cases/renderers.js +++ b/tests/cases/renderers.js @@ -33,7 +33,7 @@ describe('renderers', function () { describe('basic functions', function () { beforeEach(function () { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); }); afterEach(function () { console.warn.restore(); diff --git a/tests/cases/scaleWidget.js b/tests/cases/scaleWidget.js index 5e36cca742..0416e073dd 100644 --- a/tests/cases/scaleWidget.js +++ b/tests/cases/scaleWidget.js @@ -92,7 +92,7 @@ describe('geo.gui.scaleWidget', function () { map.gcs('EPSG:3857').ingcs('EPSG:4326'); widget.options('scale', 1); // Test with bad distance - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); widget.options('distance', function () { return NaN; }); expect(console.warn.calledOnce).toBe(true); console.warn.restore(); @@ -107,7 +107,7 @@ describe('geo.gui.scaleWidget', function () { map = createMap(); layer = map.createLayer('ui'); widget = layer.createWidget('scale'); - sinon.stub(widget, '_render', function () {}); + sinon.stub(widget, '_render').callsFake(function () {}); map.pan({x: 5, y: 0}); expect(widget._render.calledOnce).toBe(true); }); diff --git a/tests/cases/tileLayer.js b/tests/cases/tileLayer.js index 1e0f82c47f..e1dc9c5b1e 100644 --- a/tests/cases/tileLayer.js +++ b/tests/cases/tileLayer.js @@ -8,10 +8,8 @@ describe('geo.tileLayer', function () { var closeToEqual = require('../test-utils').closeToEqual; var _tileLayer = geo.tileLayer; - /* - * Use html rendering for all of these tests. That is what is occurring - * in phantomjs in any case. This also reduces the console pollution. - * Renderer specific tests currently are handled in osmLayer.js. + /* Use html rendering for all of these tests. Renderer specific tests + * currently are handled in osmLayer.js. */ beforeEach(function () { geo.tileLayer = function (opts) { @@ -657,7 +655,7 @@ describe('geo.tileLayer', function () { }); describe('cacheSize', function () { beforeEach(function () { - sinon.stub(console, 'log', function () {}); + sinon.stub(console, 'log').callsFake(function () {}); }); afterEach(function () { console.log.restore(); @@ -1529,7 +1527,7 @@ describe('geo.tileLayer', function () { it('invalid tile url', function (done) { var server = sinon.fakeServer.create(); var spy = sinon.spy(); - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); var l = layer_html({url: function () { return 'not a valid url'; }}), t; t = l._getTileCached({x: 0, y: 0, level: 0}); diff --git a/tests/cases/trackFeature.js b/tests/cases/trackFeature.js index 5271c9aabc..f264b90065 100644 --- a/tests/cases/trackFeature.js +++ b/tests/cases/trackFeature.js @@ -138,13 +138,13 @@ describe('geo.trackFeature', function () { .time(function (d, i, t, j) { return d; }) .style('text', function (d, i) { return i % 2 ? testTracks[i].id : undefined; }); track._build(); - sinon.stub(layer.features()[1], 'modified', function () {}); + sinon.stub(layer.features()[1], 'modified').callsFake(function () {}); track.modified(); expect(layer.features()[1].modified.calledOnce).toBe(true); layer.features()[1].modified.restore(); }); it('draw', function () { - sinon.stub(layer.features()[1], 'draw', function () {}); + sinon.stub(layer.features()[1], 'draw').callsFake(function () {}); track.draw(); expect(layer.features()[1].draw.calledOnce).toBe(true); layer.features()[1].draw.restore(); diff --git a/tests/headed-cases/examples.js b/tests/headed-cases/examples.js index 08209eabeb..823d12aa6a 100644 --- a/tests/headed-cases/examples.js +++ b/tests/headed-cases/examples.js @@ -51,7 +51,7 @@ describe('examples', function () { describe('Test ' + exampleName, function () { /* Load the example in the test iframe */ beforeEach(function (done) { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); $('#map').one('load', function () { /* allow logging to percolate through to our test environment */ $('iframe#map')[0].contentWindow.console = console; diff --git a/tests/test-utils.js b/tests/test-utils.js index 34a251085b..ead0678851 100644 --- a/tests/test-utils.js +++ b/tests/test-utils.js @@ -288,12 +288,3 @@ module.exports.createMap = function (opts, css) { opts.node = node; return geo.map(opts); }; - -/** - * Return true if the browser is probably PhantomJS. - * - * @returns {boolean} - */ -module.exports.isPhantomJS = function () { - return window.navigator.userAgent.indexOf('PhantomJS') >= 0; -}; diff --git a/tests/tutorials.js b/tests/tutorials.js index bd21f0ca7e..67cfc5db30 100644 --- a/tests/tutorials.js +++ b/tests/tutorials.js @@ -18,7 +18,7 @@ describe('tutorials', function () { describe('Test ' + tutorialName, function () { /* Load the tutorial in the test iframe */ beforeEach(function (done) { - sinon.stub(console, 'warn', function () {}); + sinon.stub(console, 'warn').callsFake(function () {}); $('#map').one('load', function () { window.setTimeout(done, 1); }); $('#map').attr('src', '/tutorials/' + tutorialName + '/index.html'); }, 150000);