From aeba1072f1f763f68964d0af93a9d5c7a7bb56e2 Mon Sep 17 00:00:00 2001 From: abe33 Date: Fri, 23 Nov 2018 14:43:06 +0100 Subject: [PATCH 1/6] Add support for testing against kited-test This can be activated using a LIVE_ENVIRONMENT env variable. --- package-lock.json | 200 ++++++++++++++++-------- package.json | 2 +- test/helpers.js | 17 +- test/json-runner.test.js | 41 +++-- test/json/expectations/request.js | 55 ++++--- test/json/expectations/request_count.js | 33 +++- test/json/utils.js | 5 + 7 files changed, 248 insertions(+), 105 deletions(-) diff --git a/package-lock.json b/package-lock.json index 774784d..833a779 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "kite", - "version": "0.45.1", + "version": "0.51.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2282,24 +2282,28 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "optional": true, "requires": { @@ -2309,12 +2313,14 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -2323,34 +2329,40 @@ }, "chownr": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "2.6.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "optional": true, "requires": { @@ -2359,25 +2371,29 @@ }, "deep-extend": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "dev": true, "optional": true, "requires": { @@ -2386,13 +2402,15 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, "requires": { @@ -2408,7 +2426,8 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "optional": true, "requires": { @@ -2422,13 +2441,15 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.21", - "bundled": true, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "dev": true, "optional": true, "requires": { @@ -2437,7 +2458,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "dev": true, "optional": true, "requires": { @@ -2446,7 +2468,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, "requires": { @@ -2456,18 +2479,21 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "^1.0.0" @@ -2475,13 +2501,15 @@ }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -2489,12 +2517,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "minipass": { "version": "2.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", + "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, "requires": { "safe-buffer": "^5.1.1", @@ -2503,7 +2533,8 @@ }, "minizlib": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "dev": true, "optional": true, "requires": { @@ -2512,7 +2543,8 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -2520,13 +2552,15 @@ }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "needle": { "version": "2.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.0.tgz", + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", "dev": true, "optional": true, "requires": { @@ -2537,7 +2571,8 @@ }, "node-pre-gyp": { "version": "0.10.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz", + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "dev": true, "optional": true, "requires": { @@ -2555,7 +2590,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, "requires": { @@ -2565,13 +2601,15 @@ }, "npm-bundled": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz", + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.1.10", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.10.tgz", + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "dev": true, "optional": true, "requires": { @@ -2581,7 +2619,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, "requires": { @@ -2593,18 +2632,21 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" @@ -2612,19 +2654,22 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, "requires": { @@ -2634,19 +2679,22 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true, "optional": true }, "rc": { "version": "1.2.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz", + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "dev": true, "optional": true, "requires": { @@ -2658,7 +2706,8 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true } @@ -2666,7 +2715,8 @@ }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "optional": true, "requires": { @@ -2681,7 +2731,8 @@ }, "rimraf": { "version": "2.6.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "optional": true, "requires": { @@ -2690,42 +2741,49 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -2735,7 +2793,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, "requires": { @@ -2744,7 +2803,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -2752,13 +2812,15 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.1.tgz", + "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", "dev": true, "optional": true, "requires": { @@ -2773,13 +2835,15 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "optional": true, "requires": { @@ -2788,12 +2852,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "yallist": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", "dev": true } } diff --git a/package.json b/package.json index de7c188..97694c2 100644 --- a/package.json +++ b/package.json @@ -147,4 +147,4 @@ "vscode": "^1.1.22", "widjet-test-utils": "^1.8.0" } -} \ No newline at end of file +} diff --git a/test/helpers.js b/test/helpers.js index 7e856d1..d50536d 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -32,10 +32,19 @@ function waitsFor(m, f, t, i) { return new Promise((resolve, reject) => { const interval = setInterval(() => { - if (f()) { - clearTimeout(timeout); - clearInterval(interval); - resolve(); + const res = f(); + if (res) { + if (res.then) { + res.then(() => { + clearTimeout(timeout); + clearInterval(interval); + resolve(); + }, (err) => {}); + } else { + clearTimeout(timeout); + clearInterval(interval); + resolve(); + } } }, intervalTime); diff --git a/test/json-runner.test.js b/test/json-runner.test.js index b8ffdb8..9167290 100644 --- a/test/json-runner.test.js +++ b/test/json-runner.test.js @@ -7,7 +7,9 @@ const {kite} = require('../src/kite'); const sinon = require('sinon'); const vscode = require('vscode'); const KiteAPI = require('kite-api'); -const {jsonPath, walk, describeForTest, featureSetPath} = require('./json/utils'); +const KiteConnect = require('kite-connector'); +const NodeClient = require('kite-connector/lib/clients/node'); +const {jsonPath, walk, describeForTest, featureSetPath, inLiveEnvironment} = require('./json/utils'); const {withKite, withKitePaths, withKiteRoutes, updateKitePaths} = require('kite-api/test/helpers/kite'); const {fakeResponse} = require('kite-api/test/helpers/http'); const ACTIONS = {}; @@ -65,6 +67,11 @@ describe('JSON tests', () => { }); function buildTest(data, file) { + + if (data.live_environment === false) { + return; + } + if (data.ignore) { return; } @@ -85,13 +92,7 @@ function buildTest(data, file) { }) withKite(kiteSetup(data.setup.kited), () => { - withKitePaths({}, undefined, () => { - beforeEach('mock kited paths setup', () => { - updateKitePaths(pathsSetup(data.setup, root)) - }) - withKiteRoutes([ - [o => o.path === '/clientapi/plan', o => fakeResponse(200, '{}')] - ]) + const block = () => { data.test.reverse().reduce((f, s) => { switch (s.step) { case 'action': @@ -104,7 +105,29 @@ function buildTest(data, file) { return f; } }, () => {})(); - }); + }; + + if(!inLiveEnvironment()) { + withKitePaths({}, undefined, () => { + beforeEach('mock kited paths setup', () => { + updateKitePaths(pathsSetup(data.setup, root)) + }) + withKiteRoutes([ + [o => o.path === '/clientapi/plan', o => fakeResponse(200, '{}')] + ]) + block(); + }); + } else { + beforeEach('live setup', () => { + KiteConnect.client = new NodeClient('localhost', '56624'); + return KiteConnect.request({ + path: '/testapi/request-history/reset', + method: 'POST', + }); + }); + + block(); + } }); }); } diff --git a/test/json/expectations/request.js b/test/json/expectations/request.js index 4dccbe5..1c7e384 100644 --- a/test/json/expectations/request.js +++ b/test/json/expectations/request.js @@ -4,10 +4,11 @@ const expect = require('expect.js') const vscode = require('vscode'); const http = require('http'); const KiteAPI = require('kite-api'); -const {loadPayload, substituteFromContext, buildContext, itForExpectation} = require('../utils'); +const KiteConnect = require('kite-connector'); +const {loadPayload, substituteFromContext, buildContext, itForExpectation, inLiveEnvironment} = require('../utils'); const {waitsFor, formatCall} = require('../../helpers') -let closeMatches; +let closeMatches, calls; const getDesc = (expectation, root) => () => { const base = [ 'request to', @@ -27,12 +28,6 @@ const getDesc = (expectation, root) => () => { closeMatches.forEach((call) => { base.push(`\n - ${formatCall(call)}`) }); - base.push(`\nAll calls:\n${KiteAPI.request.getCalls().map(c => { - let [{path, method}, payload] = c.args; - method = method || 'GET'; - - return `- ${formatCall({path, method, payload})}` - }).join('\n')}`) } else { // .map(({args: [{path, method}, payload]}) => `${method || 'GET'} ${path} '${payload || ''}'`)); base.push(`\nbut no calls were anywhere close\n${KiteAPI.request.getCalls().map(c => { @@ -64,8 +59,14 @@ const getNotDesc = (expectation, root) => { return base.join(' '); }; -const mostRecentCallMatching = (exPath, exMethod, exPayload, context = {}, env) => { - const calls = KiteAPI.request.getCalls(); +const mostRecentCallMatching = (data, exPath, exMethod, exPayload, context = {}, env) => { + const calls = data || KiteAPI.request.getCalls().map(c => { + return { + path: c.args[0].path, + method: c.args[0].method, + body: c.args[1], + }; + }); closeMatches = []; let matched = false; @@ -78,7 +79,7 @@ const mostRecentCallMatching = (exPath, exMethod, exPayload, context = {}, env) if (calls.length === 0) { return false; } return calls.reverse().reduce((b, c, i, a) => { - let [{path, method}, payload] = c.args; + let {path, method, body} = c; method = method || 'GET'; // b is false here only if we found a call that partially matches @@ -91,8 +92,8 @@ const mostRecentCallMatching = (exPath, exMethod, exPayload, context = {}, env) if (path === exPath) { if (method === exMethod) { - closeMatches.push({path, method, payload}); - if (!exPayload || expect.eql(JSON.parse(payload), exPayload)) { + closeMatches.push({path, method, body}); + if (!exPayload || expect.eql(JSON.parse(body), exPayload)) { matched = true; return true; } else { @@ -116,12 +117,28 @@ const mostRecentCallMatching = (exPath, exMethod, exPayload, context = {}, env) module.exports = ({expectation, not, root}) => { beforeEach('request matching', function() { const promise = waitsFor(getDesc(expectation, root), () => { - return mostRecentCallMatching( - expectation.properties.path, - expectation.properties.method, - expectation.properties.body, - buildContext(root), - this.env); + if (inLiveEnvironment()) { + return KiteAPI.requestJSON({path: '/testapi/request-history'}) + .then((data) => { + if (!mostRecentCallMatching( + data, + expectation.properties.path, + expectation.properties.method, + expectation.properties.body, + buildContext(root), + this.env)) { + throw new Error('fail'); + } + }); + } else { + return mostRecentCallMatching( + null, + expectation.properties.path, + expectation.properties.method, + expectation.properties.body, + buildContext(root), + this.env); + } }, 300); if(not) { diff --git a/test/json/expectations/request_count.js b/test/json/expectations/request_count.js index af6b6fe..64a8148 100644 --- a/test/json/expectations/request_count.js +++ b/test/json/expectations/request_count.js @@ -3,12 +3,18 @@ const expect = require('expect.js') const vscode = require('vscode'); const http = require('http'); -const {loadPayload, substituteFromContext, buildContext, itForExpectation} = require('../utils'); +const {loadPayload, substituteFromContext, buildContext, itForExpectation, inLiveEnvironment} = require('../utils'); const {waitsFor} = require('../../helpers') const KiteAPI = require('kite-api'); -const callsMatching = (exPath, exMethod, exPayload, context={}) => { - const calls = KiteAPI.request.getCalls(); +const callsMatching = (data, exPath, exMethod, exPayload, context={}) => { + const calls = data || KiteAPI.request.getCalls().map(c => { + return { + path: c.args[0].path, + method: c.args[0].method, + body: c.args[1], + }; + }); exPath = substituteFromContext(exPath, context) exPayload = exPayload && substituteFromContext(loadPayload(exPayload), context); @@ -19,25 +25,42 @@ const callsMatching = (exPath, exMethod, exPayload, context={}) => { if(calls.length === 0) { return false; } return calls.reverse().filter((c) => { - let [{path, method}, payload] = c.args; + let {path, method, body} = c; method = method || 'GET' // console.log(path, method, payload) - return path === exPath && method === exMethod && (!exPayload || expect.eql(JSON.parse(payload), exPayload)) + return path === exPath && method === exMethod && (!exPayload || expect.eql(JSON.parse(body), exPayload)) }); } module.exports = ({expectation, not, root}) => { beforeEach('request count', () => { const promise = waitsFor(`${expectation.properties.count} requests to '${expectation.properties.path}' for test '${expectation.description}'`, () => { + if (inLiveEnvironment()) { + return KiteAPI.requestJSON({path: '/testapi/request-history'}) + .then((data) => { + const calls = callsMatching( + data, + expectation.properties.path, + expectation.properties.method, + expectation.properties.body, + buildContext(root)); + + if (calls.length !== expectation.properties.count) { + throw new Error('fail'); + } + }); + } else { const calls = callsMatching( + null, expectation.properties.path, expectation.properties.method, expectation.properties.body, buildContext(root)); return calls.length === expectation.properties.count; + } }, 300) .catch(err => { console.log(err); diff --git a/test/json/utils.js b/test/json/utils.js index c05c241..0a14f9b 100644 --- a/test/json/utils.js +++ b/test/json/utils.js @@ -9,6 +9,10 @@ const sinon = require('sinon'); const base = path.resolve(__dirname, '..'); const testBase = path.join(base, '..', 'node_modules', 'editors-json-tests'); +function inLiveEnvironment() { + return process.env.LIVE_ENVIRONMENT != undefined; +} + function jsonPath(...p) { return path.join(testBase, ...p); } @@ -200,5 +204,6 @@ module.exports = { describeForTest, NotificationsMock, featureSetPath, + inLiveEnvironment, }; From c58dc9e2fc105d0b04dea813442670182cf8cbd1 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 26 Nov 2018 14:18:16 +0100 Subject: [PATCH 2/6] Add kited-test setup for travis --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c85d91f..ad515e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,15 @@ before_install: sh -e /etc/init.d/xvfb start; sleep 3; fi + - curl --silent -L "https://s3-us-west-1.amazonaws.com/kite-data/tensorflow/libtensorflow-cpu-linux-x86_64-1.9.0.tar.gz" | tar -C $HOME -xz + - export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH" + - curl --silent --compressed --output "$HOME/kited-test" "https://s3-us-west-1.amazonaws.com/kited-test/linux/kited-test" + - chmod u+x "$HOME/kited-test" install: - npm install script: - - npm test \ No newline at end of file + - $HOME/kited-test > ~/kited-test.log 2>&1 & sleep 20 && KITED_TEST=true bash ./build-plugin.bash CI + - npm test + - LIVE_ENVIRONMENT=1 npm test \ No newline at end of file From b463f84758ad0a2ae0fd6e8523eac21e216c6e46 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 26 Nov 2018 14:24:28 +0100 Subject: [PATCH 3/6] Start kited-test in before_install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ad515e2..cd0fe97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,11 @@ before_install: - export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH" - curl --silent --compressed --output "$HOME/kited-test" "https://s3-us-west-1.amazonaws.com/kited-test/linux/kited-test" - chmod u+x "$HOME/kited-test" + - $HOME/kited-test > ~/kited-test.log 2>&1 & sleep 20 && KITED_TEST=true bash ./build-plugin.bash CI install: - npm install script: - - $HOME/kited-test > ~/kited-test.log 2>&1 & sleep 20 && KITED_TEST=true bash ./build-plugin.bash CI - npm test - LIVE_ENVIRONMENT=1 npm test \ No newline at end of file From 8ac263ba7ecd1225fada7021d81a6d96e96e3bfb Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 26 Nov 2018 14:26:08 +0100 Subject: [PATCH 4/6] Add some log to know when live testing is enabled --- test/json-runner.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/json-runner.test.js b/test/json-runner.test.js index 9167290..3c59890 100644 --- a/test/json-runner.test.js +++ b/test/json-runner.test.js @@ -58,6 +58,10 @@ function pathsSetup(setup, root) { const featureSet = require(featureSetPath()); +if(inLiveEnvironment()) { + console.log("---------------------------------------", "LIVE TESTING ENABLED", "---------------------------------------"); +} + describe('JSON tests', () => { featureSet.forEach(feature => { walk(jsonPath('tests', feature), (testFile) => { From 9c87657b7a5aeb30b5e3c04040bc5d7806623d44 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 26 Nov 2018 14:28:22 +0100 Subject: [PATCH 5/6] :fire: pycharm config in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd0fe97..7803ce6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: - export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH" - curl --silent --compressed --output "$HOME/kited-test" "https://s3-us-west-1.amazonaws.com/kited-test/linux/kited-test" - chmod u+x "$HOME/kited-test" - - $HOME/kited-test > ~/kited-test.log 2>&1 & sleep 20 && KITED_TEST=true bash ./build-plugin.bash CI + - $HOME/kited-test > ~/kited-test.log 2>&1 install: - npm install From d9ccc957c2d7f35f8b37299deffda354bd3df449 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 26 Nov 2018 14:30:33 +0100 Subject: [PATCH 6/6] Avoid kited-test locking the build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7803ce6..ae79b91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: - export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH" - curl --silent --compressed --output "$HOME/kited-test" "https://s3-us-west-1.amazonaws.com/kited-test/linux/kited-test" - chmod u+x "$HOME/kited-test" - - $HOME/kited-test > ~/kited-test.log 2>&1 + - $HOME/kited-test > ~/kited-test.log 2>&1 & sleep 10 install: - npm install