From 19ffed4094cedeb013cabc65a41de42a538480d8 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 14 Nov 2017 23:57:55 +0100 Subject: [PATCH 01/12] chore(package): update lockfile --- yarn.lock | 319 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 212 insertions(+), 107 deletions(-) diff --git a/yarn.lock b/yarn.lock index f184686..bb398ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21,8 +21,8 @@ resolved "https://registry.npmjs.org/@robotlegsjs/signals/-/signals-0.0.12.tgz#5d7cbbfdba902c289529cce23186985cccb64884" "@types/bluebird@^3.5.17": - version "3.5.17" - resolved "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.17.tgz#f9eee76920e7aded0f665ee7658c058407bd12ff" + version "3.5.18" + resolved "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.18.tgz#6a60435d4663e290f3709898a4f75014f279c4d6" "@types/chai@^4.0.4": version "4.0.4" @@ -94,7 +94,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.0.0, ajv@^5.1.5: +ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5: version "5.3.0" resolved "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" dependencies: @@ -257,8 +257,8 @@ asap@^2.0.0: resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" asn1.js@^4.0.0: - version "4.9.1" - resolved "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" + version "4.9.2" + resolved "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.2.tgz#8117ef4f7ed87cd8f89044b5bff97ac243a16c9a" dependencies: bn.js "^4.0.0" inherits "^2.0.1" @@ -295,8 +295,8 @@ async@1.x, async@^1.4.0, async@^1.5.2: resolved "https://registry.npmjs.org/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" async@^2.1.2, async@^2.1.4: - version "2.5.0" - resolved "https://registry.npmjs.org/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" + version "2.6.0" + resolved "https://registry.npmjs.org/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" dependencies: lodash "^4.14.0" @@ -312,7 +312,11 @@ aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" -aws4@^1.2.1: +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + +aws4@^1.2.1, aws4@^1.6.0: version "1.6.0" resolved "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" @@ -516,6 +520,18 @@ boom@2.x.x: dependencies: hoek "2.x.x" +boom@4.x.x: + version "4.3.1" + resolved "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" + dependencies: + hoek "4.x.x" + +boom@5.x.x: + version "5.2.0" + resolved "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" + dependencies: + hoek "4.x.x" + boxen@^0.6.0: version "0.6.0" resolved "https://registry.npmjs.org/boxen/-/boxen-0.6.0.tgz#8364d4248ac34ff0ef1b2f2bf49a6c60ce0d81b6" @@ -810,8 +826,8 @@ clone-stats@^0.0.1: resolved "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" clone@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" + version "1.0.3" + resolved "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f" co@^4.6.0: version "4.6.0" @@ -822,8 +838,8 @@ code-point-at@^1.0.0: resolved "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" color-convert@^1.9.0: - version "1.9.0" - resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + version "1.9.1" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" dependencies: color-name "^1.1.1" @@ -934,8 +950,8 @@ configstore@^2.0.0: xdg-basedir "^2.0.0" connect-history-api-fallback@^1.3.0: - version "1.4.0" - resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.4.0.tgz#3db24f973f4b923b0e82f619ce0df02411ca623d" + version "1.5.0" + resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a" connect@^3.6.0: version "3.6.5" @@ -1058,9 +1074,15 @@ cryptiles@2.x.x: dependencies: boom "2.x.x" +cryptiles@3.x.x: + version "3.1.2" + resolved "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" + dependencies: + boom "5.x.x" + crypto-browserify@^3.11.0: - version "3.11.1" - resolved "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.1.tgz#948945efc6757a400d6e5e5af47194d10064279f" + version "3.12.0" + resolved "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" dependencies: browserify-cipher "^1.0.0" browserify-sign "^4.0.0" @@ -1072,6 +1094,7 @@ crypto-browserify@^3.11.0: pbkdf2 "^3.0.3" public-encrypt "^4.0.0" randombytes "^2.0.0" + randomfill "^1.0.3" currently-unhandled@^0.4.1: version "0.4.1" @@ -1227,6 +1250,10 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" +detect-libc@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.2.tgz#71ad5d204bf17a6a6ca8f450c61454066ef461e1" + detect-node@^2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127" @@ -1473,9 +1500,9 @@ es6-map@^0.1.3, es6-map@^0.1.5: es6-symbol "~3.1.1" event-emitter "~0.3.5" -es6-promise@~4.0.3: - version "4.0.5" - resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz#7882f30adde5b240ccfa7f7d78c548330951ae42" +es6-promise@^4.0.3: + version "4.1.1" + resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a" es6-set@~0.1.5: version "0.1.5" @@ -1691,7 +1718,7 @@ express@^4.13.3: utils-merge "1.0.1" vary "~1.1.2" -extend@3, extend@^3.0.0, extend@~3.0.0: +extend@3, extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" @@ -1701,12 +1728,12 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" -extract-zip@~1.6.5: - version "1.6.5" - resolved "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz#99a06735b6ea20ea9b705d779acffcc87cff0440" +extract-zip@^1.6.5: + version "1.6.6" + resolved "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" dependencies: concat-stream "1.6.0" - debug "2.2.0" + debug "2.6.9" mkdirp "0.5.0" yauzl "2.4.1" @@ -1887,6 +1914,14 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +form-data@~2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + formatio@1.2.0, formatio@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb" @@ -1914,7 +1949,7 @@ fs-access@^1.0.0: dependencies: null-check "^1.0.0" -fs-extra@~1.0.0: +fs-extra@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950" dependencies: @@ -1927,11 +1962,11 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" fsevents@^1.0.0: - version "1.1.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-1.1.2.tgz#3282b713fb3ad80ede0e9fcf4611b5aa6fc033f4" + version "1.1.3" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" dependencies: nan "^2.3.0" - node-pre-gyp "^0.6.36" + node-pre-gyp "^0.6.39" fstream-ignore@^1.0.0, fstream-ignore@^1.0.5: version "1.0.5" @@ -2295,6 +2330,10 @@ har-schema@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + har-validator@~4.2.1: version "4.2.1" resolved "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" @@ -2302,6 +2341,13 @@ har-validator@~4.2.1: ajv "^4.9.1" har-schema "^1.0.5" +har-validator@~5.0.3: + version "5.0.3" + resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" + dependencies: + ajv "^5.1.0" + har-schema "^2.0.0" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -2362,7 +2408,7 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.0" -hasha@~2.2.0: +hasha@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz#78d7cbfc1e6d66303fe79837365984517b2f6ee1" dependencies: @@ -2378,6 +2424,15 @@ hawk@3.1.3, hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" +hawk@~6.0.2: + version "6.0.2" + resolved "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" + dependencies: + boom "4.x.x" + cryptiles "3.x.x" + hoek "4.x.x" + sntp "2.x.x" + he@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -2394,6 +2449,10 @@ hoek@2.x.x: version "2.16.3" resolved "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" +hoek@4.x.x: + version "4.2.0" + resolved "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" + homedir-polyfill@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" @@ -2458,6 +2517,14 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + https-browserify@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" @@ -2955,8 +3022,8 @@ jsprim@^1.2.2: verror "1.10.0" just-extend@^1.1.26: - version "1.1.26" - resolved "https://registry.npmjs.org/just-extend/-/just-extend-1.1.26.tgz#dba4ad2786d319f1d10afab106e004b5a0851ac2" + version "1.1.27" + resolved "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905" karma-chai-sinon@^0.1.5: version "0.1.5" @@ -3039,14 +3106,14 @@ karma-sourcemap-writer@^0.1.2: graceful-fs "^4.1.3" karma-webpack@^2.0.5: - version "2.0.5" - resolved "https://registry.npmjs.org/karma-webpack/-/karma-webpack-2.0.5.tgz#4f56887e32cf4f9583391c2388415de06af06efd" + version "2.0.6" + resolved "https://registry.npmjs.org/karma-webpack/-/karma-webpack-2.0.6.tgz#967918e59750ebe0f40829263435fde7ac81bdb4" dependencies: async "~0.9.0" loader-utils "^0.2.5" lodash "^3.8.0" - source-map "^0.1.41" - webpack-dev-middleware "^1.0.11" + source-map "^0.5.6" + webpack-dev-middleware "^1.12.0" karma@^1.7.1: version "1.7.1" @@ -3080,10 +3147,14 @@ karma@^1.7.1: tmp "0.0.31" useragent "^2.1.12" -kew@~0.7.0: +kew@^0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" +killable@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz#da8b84bd47de5395878f95d64d02f2449fe05e6b" + kind-of@^3.0.2: version "3.2.2" resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -3300,16 +3371,16 @@ log4js@^0.6.31: semver "~4.3.3" loglevel@^1.4.1: - version "1.5.1" - resolved "https://registry.npmjs.org/loglevel/-/loglevel-1.5.1.tgz#189078c94ab9053ee215a0acdbf24244ea0f6502" + version "1.6.0" + resolved "https://registry.npmjs.org/loglevel/-/loglevel-1.6.0.tgz#ae0caa561111498c5ba13723d6fb631d24003934" lolex@^1.6.0: version "1.6.0" resolved "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" -lolex@^2.1.3: - version "2.1.3" - resolved "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz#53f893bbe88c80378156240e127126b905c83087" +lolex@^2.2.0: + version "2.3.0" + resolved "https://registry.npmjs.org/lolex/-/lolex-2.3.0.tgz#d6bad0f0aa5caebffcfebb09fb2caa89baaff51c" longest@^1.0.1: version "1.0.1" @@ -3529,8 +3600,8 @@ moment@2.17.0: resolved "https://registry.npmjs.org/moment/-/moment-2.17.0.tgz#a4c292e02aac5ddefb29a6eed24f51938dd3b74f" moment@2.x.x: - version "2.19.1" - resolved "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167" + version "2.19.2" + resolved "https://registry.npmjs.org/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe" ms@0.7.1: version "0.7.1" @@ -3625,10 +3696,11 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" -node-pre-gyp@^0.6.36: - version "0.6.38" - resolved "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.38.tgz#e92a20f83416415bb4086f6d1fb78b3da73d113d" +node-pre-gyp@^0.6.39: + version "0.6.39" + resolved "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" dependencies: + detect-libc "^1.0.2" hawk "3.1.3" mkdirp "^0.5.1" nopt "^4.0.1" @@ -3747,7 +3819,7 @@ nyc@^11.3.0: yargs "^10.0.3" yargs-parser "^8.0.0" -oauth-sign@~0.8.1: +oauth-sign@~0.8.1, oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -4045,19 +4117,23 @@ performance-now@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + phantomjs-prebuilt@^2.1.7: - version "2.1.15" - resolved "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.15.tgz#20f86e82d3349c505917527745b7a411e08b3903" - dependencies: - 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" + version "2.1.16" + resolved "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz#efd212a4a3966d3647684ea8ba788549be2aefef" + dependencies: + 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" pify@^2.0.0: version "2.3.0" @@ -4078,8 +4154,8 @@ pinkie@^2.0.0: resolved "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" pixi-gl-core@^1.0.3: - version "1.1.0" - resolved "https://registry.npmjs.org/pixi-gl-core/-/pixi-gl-core-1.1.0.tgz#a52cb4dd3254f9c7857a0e9c2356b00e6ec0c761" + version "1.1.2" + resolved "https://registry.npmjs.org/pixi-gl-core/-/pixi-gl-core-1.1.2.tgz#b5377f69bc3b3187b9a62430de031fde343e5439" pixi.js@^4.6.0: version "4.6.0" @@ -4143,8 +4219,8 @@ preserve@^0.2.0: resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" prettier@^1.7.4: - version "1.7.4" - resolved "https://registry.npmjs.org/prettier/-/prettier-1.7.4.tgz#5e8624ae9363c80f95ec644584ecdf55d74f93fa" + version "1.8.2" + resolved "https://registry.npmjs.org/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8" process-nextick-args@~1.0.6: version "1.0.7" @@ -4154,7 +4230,7 @@ process@^0.11.0: version "0.11.10" resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" -progress@~1.1.8: +progress@^1.1.8: version "1.1.8" resolved "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" @@ -4232,7 +4308,7 @@ qjobs@^1.1.4: version "1.1.5" resolved "https://registry.npmjs.org/qjobs/-/qjobs-1.1.5.tgz#659de9f2cf8dcc27a1481276f205377272382e73" -qs@6.5.1: +qs@6.5.1, qs@~6.5.1: version "6.5.1" resolved "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" @@ -4275,12 +4351,19 @@ randomatic@^1.1.3: is-number "^3.0.0" kind-of "^4.0.0" -randombytes@^2.0.0, randombytes@^2.0.1: +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz#dc009a246b8d09a177b4b7a0ae77bc570f4b1b79" dependencies: safe-buffer "^5.1.0" +randomfill@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/randomfill/-/randomfill-1.0.3.tgz#b96b7df587f01dd91726c418f30553b1418e3d62" + dependencies: + randombytes "^2.0.5" + safe-buffer "^5.1.0" + range-parser@^1.0.3, range-parser@^1.2.0, range-parser@~1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -4473,13 +4556,13 @@ replace-ext@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" -request-progress@~2.0.1: +request-progress@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz#5d36bb57961c673aa5b788dbc8141fdf23b44e08" dependencies: throttleit "^1.0.0" -request@2.81.0, request@~2.81.0: +request@2.81.0: version "2.81.0" resolved "https://registry.npmjs.org/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" dependencies: @@ -4506,6 +4589,33 @@ request@2.81.0, request@~2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" +request@^2.81.0: + version "2.83.0" + resolved "https://registry.npmjs.org/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.6.0" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.1" + forever-agent "~0.6.1" + form-data "~2.3.1" + har-validator "~5.0.3" + hawk "~6.0.2" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.17" + oauth-sign "~0.8.2" + performance-now "^2.1.0" + qs "~6.5.1" + safe-buffer "^5.1.1" + stringstream "~0.0.5" + tough-cookie "~2.3.3" + tunnel-agent "^0.6.0" + uuid "^3.1.0" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -4514,7 +4624,7 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" -requires-port@1.0.x, requires-port@1.x.x: +requires-port@1.0.x, requires-port@1.x.x, requires-port@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -4741,13 +4851,13 @@ sinon-chai@^2.14.0: resolved "https://registry.npmjs.org/sinon-chai/-/sinon-chai-2.14.0.tgz#da7dd4cc83cd6a260b67cca0f7a9fdae26a1205d" sinon@^4.0.2: - version "4.0.2" - resolved "https://registry.npmjs.org/sinon/-/sinon-4.0.2.tgz#c81f62456d37986c84e9f522ddb9ce413bda49d2" + version "4.1.2" + resolved "https://registry.npmjs.org/sinon/-/sinon-4.1.2.tgz#65610521d926fb53742dd84cd599f0b89a82f440" dependencies: diff "^3.1.0" formatio "1.2.0" lodash.get "^4.4.2" - lolex "^2.1.3" + lolex "^2.2.0" nise "^1.2.0" supports-color "^4.4.0" type-detect "^4.0.0" @@ -4762,6 +4872,12 @@ sntp@1.x.x: dependencies: hoek "2.x.x" +sntp@2.x.x: + version "2.1.0" + resolved "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" + dependencies: + hoek "4.x.x" + socket.io-adapter@0.5.0: version "0.5.0" resolved "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz#cb6d4bb8bec81e1078b99677f9ced0046066bb8b" @@ -4840,23 +4956,17 @@ source-map-support@^0.5.0: dependencies: source-map "^0.6.0" -source-map@>=0.5.6, source-map@^0.6.0: +source-map@>=0.5.6, source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" -source-map@^0.1.41: - version "0.1.43" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" - dependencies: - amdefine ">=0.0.4" - source-map@^0.4.4: version "0.4.4" resolved "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" dependencies: amdefine ">=0.0.4" -source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6: +source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -5012,7 +5122,7 @@ string_decoder@~1.0.3: dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.4: +stringstream@~0.0.4, stringstream@~0.0.5: version "0.0.5" resolved "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -5228,7 +5338,7 @@ topo@1.x.x: dependencies: hoek "2.x.x" -tough-cookie@~2.3.0: +tough-cookie@~2.3.0, tough-cookie@~2.3.3: version "2.3.3" resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" dependencies: @@ -5298,8 +5408,8 @@ tslint@^5.8.0: tsutils "^2.12.1" tsutils@^2.12.1: - version "2.12.1" - resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.12.1.tgz#f4d95ce3391c8971e46e54c4cf0edb0a21dd5b24" + version "2.12.2" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.12.2.tgz#ad58a4865d17ec3ddb6631b6ca53be14a5656ff3" dependencies: tslib "^1.7.1" @@ -5324,8 +5434,8 @@ type-check@~0.3.2: prelude-ls "~1.1.2" type-detect@^4.0.0: - version "4.0.3" - resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz#0e3f2670b44099b0b46c284d136a7ef49c74c2ea" + version "4.0.5" + resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz#d70e5bc81db6de2a381bcaca0c6e0cbdc7635de2" type-is@~1.6.15: version "1.6.15" @@ -5339,8 +5449,8 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" typescript@^2.5.3: - version "2.5.3" - resolved "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d" + version "2.6.1" + resolved "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz#ef39cdea27abac0b500242d6726ab90e0c846631" uglify-js@^2.6, uglify-js@^2.8.29: version "2.8.29" @@ -5406,11 +5516,11 @@ url-parse@1.0.x: requires-port "1.0.x" url-parse@^1.1.8: - version "1.1.9" - resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.1.9.tgz#c67f1d775d51f0a18911dd7b3ffad27bb9e5bd19" + version "1.2.0" + resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.2.0.tgz#3a19e8aaa6d023ddd27dcc44cb4fc8f7fec23986" dependencies: querystringify "~1.0.0" - requires-port "1.0.x" + requires-port "~1.0.0" url@^0.11.0: version "0.11.0" @@ -5444,7 +5554,7 @@ uuid@^2.0.1, uuid@^2.0.2: version "2.0.3" resolved "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" @@ -5509,7 +5619,7 @@ weak-map@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz#79691584d98607f5070bd3b70a40e6bb22e401eb" -webpack-dev-middleware@^1.0.11, webpack-dev-middleware@^1.11.0: +webpack-dev-middleware@^1.11.0, webpack-dev-middleware@^1.12.0: version "1.12.0" resolved "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.0.tgz#d34efefb2edda7e1d3b5dbe07289513219651709" dependencies: @@ -5520,8 +5630,8 @@ webpack-dev-middleware@^1.0.11, webpack-dev-middleware@^1.11.0: time-stamp "^2.0.0" webpack-dev-server@^2.9.3: - version "2.9.3" - resolved "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.9.3.tgz#f0554e88d129e87796a6f74a016b991743ca6f81" + version "2.9.4" + resolved "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.9.4.tgz#7883e61759c6a4b33e9b19ec4037bd4ab61428d1" dependencies: ansi-html "0.0.7" array-includes "^3.0.3" @@ -5537,6 +5647,7 @@ webpack-dev-server@^2.9.3: import-local "^0.1.1" internal-ip "1.2.0" ip "^1.1.5" + killable "^1.0.0" loglevel "^1.4.1" opn "^5.1.0" portfinder "^1.0.9" @@ -5551,11 +5662,11 @@ webpack-dev-server@^2.9.3: yargs "^6.6.0" webpack-sources@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf" + version "1.0.2" + resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.2.tgz#d0148ec083b3b5ccef1035a6b3ec16442983b27a" dependencies: source-list-map "^2.0.0" - source-map "~0.5.3" + source-map "~0.6.1" webpack@^3.8.1: version "3.8.1" @@ -5592,8 +5703,8 @@ websocket-driver@>=0.5.1: websocket-extensions ">=0.1.1" websocket-extensions@>=0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.2.tgz#0e18781de629a18308ce1481650f67ffa2693a5d" + version "0.1.3" + resolved "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" which-module@^1.0.0: version "1.0.0" @@ -5603,18 +5714,12 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@^1.1.1, which@^1.2.1, which@^1.2.4, which@^1.2.8, which@^1.2.9: +which@^1.1.1, which@^1.2.1, which@^1.2.10, which@^1.2.4, which@^1.2.8, which@^1.2.9: version "1.3.0" resolved "https://registry.npmjs.org/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: isexe "^2.0.0" -which@~1.2.10: - version "1.2.14" - resolved "https://registry.npmjs.org/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" - dependencies: - isexe "^2.0.0" - wide-align@^1.1.0: version "1.1.2" resolved "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" From c9f3335bce684f152d9aa33fa6a44bdd747f3aac Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 14 Nov 2017 23:59:39 +0100 Subject: [PATCH 02/12] use ISignal type instead of any --- .../bender/extensions/signalMediator/impl/SignalMap.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts index 582066d..669c804 100644 --- a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts +++ b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts @@ -42,7 +42,7 @@ export class SignalMap implements ISignalMap { this.storeSignalHandler(signal, handler); } - public removeFromSignal(signal: any, handler: Function): void { + public removeFromSignal(signal: ISignal, handler: Function): void { signal.remove(handler); if ( @@ -73,7 +73,7 @@ export class SignalMap implements ISignalMap { /* Protected Functions */ /*============================================================================*/ - protected storeSignalHandler(signal: any, handler: Function): void { + protected storeSignalHandler(signal: ISignal, handler: Function): void { if (this._handlersBySignal.get(signal) == null) { this._handlersBySignal.set(signal, [handler]); } else { From 80e4332e214b26510bcec7fcf14a9c390cecc786 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 00:14:37 +0100 Subject: [PATCH 03/12] use get and set methods from Map class instead of bracket notation --- .../bender/extensions/signalMediator/impl/SignalMap.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts index 669c804..aba9647 100644 --- a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts +++ b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts @@ -46,16 +46,16 @@ export class SignalMap implements ISignalMap { signal.remove(handler); if ( - this._handlersBySignal[signal] == null || - this._handlersBySignal[signal].length === 0 + this._handlersBySignal.get(signal) === null || + this._handlersBySignal.get(signal).length === 0 ) { return; } - let handlerIndex = this._handlersBySignal[signal].indexOf(handler); + let handlerIndex = this._handlersBySignal.get(signal).indexOf(handler); if (handlerIndex > -1) { - this._handlersBySignal[signal].splice(handlerIndex, 1); + this._handlersBySignal.get(signal).splice(handlerIndex, 1); } } @@ -74,7 +74,7 @@ export class SignalMap implements ISignalMap { /*============================================================================*/ protected storeSignalHandler(signal: ISignal, handler: Function): void { - if (this._handlersBySignal.get(signal) == null) { + if (this._handlersBySignal.get(signal) === null) { this._handlersBySignal.set(signal, [handler]); } else { this._handlersBySignal.get(signal).push(handler); From 34beaeebbaa6726c47e85940c17ffa6a4cd85935 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 00:52:14 +0100 Subject: [PATCH 04/12] use has to verify if the mapper have a element --- .../bender/extensions/signalMediator/impl/SignalMap.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts index aba9647..dc2464a 100644 --- a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts +++ b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts @@ -46,7 +46,7 @@ export class SignalMap implements ISignalMap { signal.remove(handler); if ( - this._handlersBySignal.get(signal) === null || + !this._handlersBySignal.has(signal) || this._handlersBySignal.get(signal).length === 0 ) { return; @@ -74,7 +74,7 @@ export class SignalMap implements ISignalMap { /*============================================================================*/ protected storeSignalHandler(signal: ISignal, handler: Function): void { - if (this._handlersBySignal.get(signal) === null) { + if (!this._handlersBySignal.has(signal)) { this._handlersBySignal.set(signal, [handler]); } else { this._handlersBySignal.get(signal).push(handler); From 285241357181636ddc551868eeec9f2c9c44960e Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 00:52:56 +0100 Subject: [PATCH 05/12] clear method already removes all elements from a map --- .../bender/extensions/signalMediator/impl/SignalMap.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts index dc2464a..c1ca4c5 100644 --- a/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts +++ b/src/robotlegs/bender/extensions/signalMediator/impl/SignalMap.ts @@ -65,8 +65,6 @@ export class SignalMap implements ISignalMap { ); this._handlersBySignal.clear(); - - this._handlersBySignal = new Map(); } /*============================================================================*/ From 3d1757cc91e5b75ebbbbceae95248ebb19cee980 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 00:57:47 +0100 Subject: [PATCH 06/12] add unit tests for SignalMap class --- .../signalMediator/impl/signalMap.test.ts | 282 ++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 test/robotlegs/bender/extensions/signalMediator/impl/signalMap.test.ts diff --git a/test/robotlegs/bender/extensions/signalMediator/impl/signalMap.test.ts b/test/robotlegs/bender/extensions/signalMediator/impl/signalMap.test.ts new file mode 100644 index 0000000..d994427 --- /dev/null +++ b/test/robotlegs/bender/extensions/signalMediator/impl/signalMap.test.ts @@ -0,0 +1,282 @@ +// ------------------------------------------------------------------------------ +// Copyright (c) 2017 RobotlegsJS. All Rights Reserved. +// +// NOTICE: You are permitted to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// ------------------------------------------------------------------------------ + +import "../../../../../entry.ts"; + +import { assert } from "chai"; + +import { Signal } from "@robotlegsjs/signals"; + +import { ISignalMap } from "../../../../../../src/robotlegs/bender/extensions/signalMediator/api/ISignalMap"; +import { SignalMap } from "../../../../../../src/robotlegs/bender/extensions/signalMediator/impl/SignalMap"; + +describe("SignalMap", () => { + let signalMap: ISignalMap; + + beforeEach(() => { + signalMap = new SignalMap(); + }); + + afterEach(() => { + signalMap = null; + }); + + it("can_be_instantiated", () => { + assert.instanceOf(signalMap, SignalMap); + }); + + it("addToSignal_handler_is_called", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + + signalMap.addToSignal(signal, () => { + called = true; + }); + + signal.dispatch(); + + assert.isTrue(called); + }); + + it("addToSignal_handlers_are_called", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + signalMap.addToSignal(signal, () => { + count++; + }); + signalMap.addToSignal(signal, () => { + count++; + }); + signalMap.addToSignal(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.deepEqual(count, expected); + }); + + it("addToSignal_handlers_are_called_twice_when_signal_dispatch_twice", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + signalMap.addToSignal(signal, () => { + count++; + }); + signalMap.addToSignal(signal, () => { + count++; + }); + signalMap.addToSignal(signal, () => { + count++; + }); + + signal.dispatch(); + signal.dispatch(); + + assert.deepEqual(count, expected * 2); + }); + + it("addOnceToSignal_handler_is_called", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + + signalMap.addOnceToSignal(signal, () => { + called = true; + }); + + signal.dispatch(); + + assert.isTrue(called); + }); + + it("addOnceToSignal_handler_is_called_once_when_signal_dispatch_twice", () => { + const expected: number = 1; + let count: number = 0; + + let signal: Signal = new Signal(); + + signalMap.addOnceToSignal(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("addOnceToSignal_handlers_are_called", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + signalMap.addOnceToSignal(signal, () => { + count++; + }); + signalMap.addOnceToSignal(signal, () => { + count++; + }); + signalMap.addOnceToSignal(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("addOnceToSignal_handlers_are_called_once_when_signal_dispatch_twice", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + signalMap.addOnceToSignal(signal, () => { + count++; + }); + signalMap.addOnceToSignal(signal, () => { + count++; + }); + signalMap.addOnceToSignal(signal, () => { + count++; + }); + + signal.dispatch(); + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("removeFromSignal_removes_handler_that_is_not_called", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + let handler: Function = () => { + called = true; + }; + + signalMap.addToSignal(signal, handler); + signalMap.removeFromSignal(signal, handler); + + signal.dispatch(); + + assert.isFalse(called); + }); + + it("removeFromSignal_do_nohing_when_handler_was_not_added_before", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + let handler: Function = () => { + called = true; + }; + + signalMap.removeFromSignal(signal, handler); + + signal.dispatch(); + + assert.isFalse(called); + }); + + it("removeFromSignal_remove_handlers", () => { + const expected: number = 0; + let count: number = 0; + + let signal: Signal = new Signal(); + + let handler1: Function = () => { + count++; + }; + let handler2: Function = () => { + count++; + }; + let handler3: Function = () => { + count++; + }; + + signalMap.addToSignal(signal, handler1); + signalMap.addToSignal(signal, handler2); + signalMap.addToSignal(signal, handler3); + signalMap.removeFromSignal(signal, handler1); + signalMap.removeFromSignal(signal, handler2); + signalMap.removeFromSignal(signal, handler3); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("removeFromSignal_do_nothing_when_signal_have_handlers_but_handler_removed_was_not_added_before", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + let handler1: Function = () => { + count++; + }; + let handler2: Function = () => { + count++; + }; + let handler3: Function = () => { + count++; + }; + let handler4: Function = () => { + count++; + }; + + signalMap.addToSignal(signal, handler1); + signalMap.addToSignal(signal, handler2); + signalMap.addToSignal(signal, handler3); + signalMap.removeFromSignal(signal, handler4); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("removeAll_do_nothing_when_no_handler_is_stored", () => { + signalMap.removeAll(); + }); + + it("removeAll_remove_all_handlers", () => { + const expected: number = 0; + let count: number = 0; + + let signal: Signal = new Signal(); + + let handler1: Function = () => { + count++; + }; + let handler2: Function = () => { + count++; + }; + let handler3: Function = () => { + count++; + }; + let handler4: Function = () => { + count++; + }; + + signalMap.addToSignal(signal, handler1); + signalMap.addToSignal(signal, handler2); + signalMap.addToSignal(signal, handler3); + signalMap.addToSignal(signal, handler4); + signalMap.removeAll(); + + signal.dispatch(); + + assert.equal(count, expected); + }); +}); From 51ff2bed9118e697ba5f81cd2c14dd1ff2aa94e6 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 01:43:44 +0100 Subject: [PATCH 07/12] run unit tests using karma --- karma.conf.js | 136 ++++++++++++++++++++++++---------------------- package.json | 5 +- test/entry.ts | 3 +- webpack.config.js | 84 ++++++++++++++-------------- yarn.lock | 9 ++- 5 files changed, 125 insertions(+), 112 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index cc49e6d..2811acc 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -3,76 +3,80 @@ process.env.NODE_ENV = 'test'; const webpack = require("webpack"); const path = require("path"); -const webpackConfig = require('./webpack.config.js')({isTest: true}); +const webpackConfig = require('./webpack.config.js')({ isTest: true }); delete webpackConfig.entry; -module.exports = function (config) { +let frameworks = [ + "mocha", + "chai", + "sinon", + "es6-shim" +]; - var configuration = { - basePath: "", - frameworks: [ - "mocha", - "chai", - "sinon", - "es6-shim" - ], - files: [ - "./test/**/**/**.test.ts", - { - pattern: '**/*.map', - served: true, - included: false, - watched: true - } - ], - preprocessors: { - "./**/**/**/**.ts": ["sourcemap"], - "./test/**/**/**.test.ts": ["webpack"] - }, - webpack: webpackConfig, - webpackMiddleware: { - noInfo: true - }, - plugins: [ - "karma-webpack", - "karma-sourcemap-writer", - "karma-sourcemap-loader", - "karma-remap-istanbul", - "karma-mocha-reporter", - "karma-mocha", - "karma-chai", - "karma-sinon", - "karma-es6-shim", - "karma-coverage" - ], - reporters: (config.singleRun - ? ["dots", "mocha", "coverage"] - : ["dots", "mocha"]), - coverageReporter: { - dir: "coverage", - reporters: [ - {type: 'html', subdir: 'report-html'}, - {type: 'lcov', subdir: 'report-lcov'} - ], - instrumenterOptions: { - istanbul: {noCompact: true} - } - }, - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'] - }; +let plugins = [ + "karma-webpack", + "karma-sourcemap-writer", + "karma-sourcemap-loader", + "karma-mocha-reporter", + "karma-mocha", + "karma-chai", + "karma-sinon", + "karma-es6-shim", + "karma-remap-istanbul", + "karma-coverage-istanbul-reporter" +]; - if (process.env.TRAVIS) { - configuration.browsers = ['PhantomJS']; - configuration.plugins.push("karma-phantomjs-launcher"); - } else { - configuration.browsers = ['Chrome']; - configuration.plugins.push("karma-chrome-launcher"); - } +module.exports = function(config) { - config.set(configuration); + var configuration = { + basePath: "", + frameworks: frameworks, + files: [ + { pattern: "node_modules/reflect-metadata/Reflect.js", include: true }, + { pattern: "node_modules/bluebird/js/browser/bluebird.js", include: true }, + { pattern: "./test/**/**/**.test.ts", include: true }, + { pattern: '**/*.map', served: true, included: false, watched: true } + ], + preprocessors: { + "./**/**/**/**.ts": ["sourcemap"], + "./test/**/**/**.test.ts": ["webpack"] + }, + webpack: webpackConfig, + webpackMiddleware: { + noInfo: true + }, + plugins: plugins, + reporters: ( + config.singleRun ? + ["dots", "mocha", "coverage-istanbul"] : + ["dots", "mocha"] + ), + coverageIstanbulReporter: { + reports: ["html", "lcov", "lcovonly", "text-summary"], + dir: "coverage", + fixWebpackSourcePaths: true, + "report-config": { + html: { + subdir: "html-report" + } + } + }, + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: [], + browserNoActivityTimeout: 50000 + }; + + if (process.env.TRAVIS) { + configuration.browsers = ['PhantomJS']; + configuration.plugins.push("karma-phantomjs-launcher"); + } else { + configuration.browsers = ['PhantomJS']; + configuration.plugins.push("karma-phantomjs-launcher"); + } + + config.set(configuration); }; diff --git a/package.json b/package.json index 35f8648..d1bb046 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "lib/index.js", "typings": "lib/index.d.ts", "scripts": { - "test": "nyc mocha", - "karma": "karma start", + "test": "karma start --single-run", + "mocha": "nyc mocha", "autoformat": "prettier --config .prettierrc --write {src,test}/**/*.ts", "tslint-check": "tslint-config-prettier-check ./tslint.json", "clean-up": "rm -rf .nyc_output && rm -rf coverage && rm -rf lib", @@ -80,6 +80,7 @@ "karma-chai-sinon": "^0.1.5", "karma-chrome-launcher": "^2.2.0", "karma-coverage": "^1.1.1", + "karma-coverage-istanbul-reporter": "^1.3.0", "karma-es6-shim": "^1.0.0", "karma-jasmine": "^1.1.0", "karma-mocha": "^1.3.0", diff --git a/test/entry.ts b/test/entry.ts index 9cb5bf7..43e47eb 100644 --- a/test/entry.ts +++ b/test/entry.ts @@ -6,7 +6,8 @@ // in accordance with the terms of the license agreement accompanying it. // ------------------------------------------------------------------------------ -import "reflect-metadata"; +/// + import "bluebird/js/browser/bluebird"; import "es6-symbol/implement"; import "es6-map/implement"; diff --git a/webpack.config.js b/webpack.config.js index 8b73e14..f9c9aca 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,48 +1,48 @@ const webpack = require('webpack'); const path = require('path'); -module.exports = (function (options) { - - if (!options) options = {isTest: false}; - - var tsconfig = options.isTest ? "tsconfig.test.json" : "tsconfig.json"; - - return { - entry: { - main: path.join(__dirname, "src/index.ts") - }, - - output: { - path: path.join(__dirname, "dist"), - filename: "bundle.js" - }, - - devtool: 'inline-source-map', - - module: { - rules: [ - {test: /\.ts$/, loader: "ts-loader?configFileName=" + tsconfig}, - { - test: /^(.(?!\.test))*\.ts$/, - loader: "istanbul-instrumenter-loader", - query: { - embedSource: true - }, - enforce: "post" - } - ] - }, - - plugins: [ - // new webpack.optimize.UglifyJsPlugin() - new webpack.SourceMapDevToolPlugin({test: /\.ts$/i}) - ], - - resolve: { - extensions: ['.ts', '.js', '.json'], - alias: { - // sinon: 'sinon/pkg/sinon' - } +module.exports = (function(options) { + + if (!options) options = {isTest: false}; + + var tsconfig = options.isTest ? "tsconfig.test.json" : "tsconfig.json"; + + return { + entry: { + main: path.join(__dirname, "src/index.ts") + }, + + output: { + path: path.join(__dirname, "dist"), + filename: "bundle.js" + }, + + devtool: 'inline-source-map', + + module: { + rules: [ + { test: /\.ts$/, loader: "ts-loader?configFile=" + tsconfig }, + { + test: /^(.(?!\.test))*\.ts$/, + loader: "istanbul-instrumenter-loader", + query: { + embedSource: true + }, + enforce: "post" } + ] + }, + + plugins: [ + // new webpack.optimize.UglifyJsPlugin() + new webpack.SourceMapDevToolPlugin({ test: /\.ts$/i }) + ], + + resolve: { + extensions: ['.ts', '.js', '.json'], + alias: { + // sinon: 'sinon/pkg/sinon' + } } + } }); diff --git a/yarn.lock b/yarn.lock index bb398ba..e27b698 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2840,7 +2840,7 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -istanbul-api@^1.1.0-alpha: +istanbul-api@^1.1.0-alpha, istanbul-api@^1.1.8: version "1.2.1" resolved "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz#0c60a0515eb11c7d65c6b50bba2c6e999acd8620" dependencies: @@ -3040,6 +3040,13 @@ karma-chrome-launcher@^2.2.0: fs-access "^1.0.0" which "^1.2.1" +karma-coverage-istanbul-reporter@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-1.3.0.tgz#d142cd9c55731c9e363ef7374e8ef1a31bebfadb" + dependencies: + istanbul-api "^1.1.8" + minimatch "^3.0.4" + karma-coverage@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/karma-coverage/-/karma-coverage-1.1.1.tgz#5aff8b39cf6994dc22de4c84362c76001b637cf6" From 6bee5d84157c3c0934a9e152e121e2fd508e6563 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 01:44:07 +0100 Subject: [PATCH 08/12] add unit tests for SignalMediator class --- .../impl/signalMediator.test.ts | 181 ++++++++++++++++++ .../signalMediator/support/TestMediator.ts | 39 ++++ 2 files changed, 220 insertions(+) create mode 100644 test/robotlegs/bender/extensions/signalMediator/impl/signalMediator.test.ts create mode 100644 test/robotlegs/bender/extensions/signalMediator/support/TestMediator.ts diff --git a/test/robotlegs/bender/extensions/signalMediator/impl/signalMediator.test.ts b/test/robotlegs/bender/extensions/signalMediator/impl/signalMediator.test.ts new file mode 100644 index 0000000..cf3fb62 --- /dev/null +++ b/test/robotlegs/bender/extensions/signalMediator/impl/signalMediator.test.ts @@ -0,0 +1,181 @@ +// ------------------------------------------------------------------------------ +// Copyright (c) 2017 RobotlegsJS. All Rights Reserved. +// +// NOTICE: You are permitted to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// ------------------------------------------------------------------------------ + +import "../../../../../entry.ts"; + +import { assert } from "chai"; + +import { Signal } from "@robotlegsjs/signals"; + +import { TestMediator } from "../support/TestMediator"; + +describe("SignalMediator", () => { + let testMediator: TestMediator; + + beforeEach(() => { + testMediator = new TestMediator(); + }); + + afterEach(() => { + testMediator = null; + }); + + it("addToSignal_handler_is_called", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + + testMediator.addToSignalRouter(signal, () => { + called = true; + }); + + signal.dispatch(); + + assert.isTrue(called); + }); + + it("addToSignal_handlers_are_called", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + testMediator.addToSignalRouter(signal, () => { + count++; + }); + testMediator.addToSignalRouter(signal, () => { + count++; + }); + testMediator.addToSignalRouter(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.deepEqual(count, expected); + }); + + it("addToSignal_handlers_are_called_twice_when_signal_dispatch_twice", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + testMediator.addToSignalRouter(signal, () => { + count++; + }); + testMediator.addToSignalRouter(signal, () => { + count++; + }); + testMediator.addToSignalRouter(signal, () => { + count++; + }); + + signal.dispatch(); + signal.dispatch(); + + assert.deepEqual(count, expected * 2); + }); + + it("addOnceToSignal_handler_is_called", () => { + let called: boolean = false; + + let signal: Signal = new Signal(); + + testMediator.addOnceToSignalRouter(signal, () => { + called = true; + }); + + signal.dispatch(); + + assert.isTrue(called); + }); + + it("addOnceToSignal_handler_is_called_once_when_signal_dispatch_twice", () => { + const expected: number = 1; + let count: number = 0; + + let signal: Signal = new Signal(); + + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("addOnceToSignal_handlers_are_called", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("addOnceToSignal_handlers_are_called_once_when_signal_dispatch_twice", () => { + const expected: number = 3; + let count: number = 0; + + let signal: Signal = new Signal(); + + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + testMediator.addOnceToSignalRouter(signal, () => { + count++; + }); + + signal.dispatch(); + signal.dispatch(); + + assert.equal(count, expected); + }); + + it("postDestroy_removes_all_handlers", () => { + const expected: number = 0; + let count: number = 0; + + let signal: Signal = new Signal(); + + let handler1: Function = () => { + count++; + }; + let handler2: Function = () => { + count++; + }; + let handler3: Function = () => { + count++; + }; + + testMediator.addOnceToSignalRouter(signal, handler1); + testMediator.addOnceToSignalRouter(signal, handler2); + testMediator.addOnceToSignalRouter(signal, handler3); + testMediator.postDestroy(); + + signal.dispatch(); + + assert.equal(count, expected); + }); +}); diff --git a/test/robotlegs/bender/extensions/signalMediator/support/TestMediator.ts b/test/robotlegs/bender/extensions/signalMediator/support/TestMediator.ts new file mode 100644 index 0000000..fc71e2a --- /dev/null +++ b/test/robotlegs/bender/extensions/signalMediator/support/TestMediator.ts @@ -0,0 +1,39 @@ +// ------------------------------------------------------------------------------ +// Copyright (c) 2017 RobotlegsJS. All Rights Reserved. +// Copyright (c) 2016 San Dinh Studios. All Rights Reserved. +// +// NOTICE: You are permitted to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// ------------------------------------------------------------------------------ + +import { ISignal } from "@robotlegsjs/signals"; + +import { EventDispatcher } from "@robotlegsjs/core"; + +import { EventMap } from "@robotlegsjs/core/lib/robotlegs/bender/extensions/localEventMap/impl/EventMap"; + +import { SignalMediator } from "../../../../../../src/robotlegs/bender/extensions/signalMediator/impl/SignalMediator"; + +export class TestMediator extends SignalMediator { + constructor() { + super(); + + this.eventMap = new EventMap(); + } + + public addToSignalRouter(signal: ISignal, handler: Function): void { + this.addToSignal(signal, handler); + } + + public addOnceToSignalRouter(signal: ISignal, handler: Function): void { + this.addOnceToSignal(signal, handler); + } + + public initialize(): void { + console.log("do nothing"); + } + + public destroy(): void { + console.log("do nothing"); + } +} From 571cba38c728e8e41b50a70659b8f51fd2fd3591 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 01:56:47 +0100 Subject: [PATCH 09/12] improve code coverage of SignalMediatorExtension class --- .../signalMediator/signalMediatorExtension.test.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/robotlegs/bender/extensions/signalMediator/signalMediatorExtension.test.ts b/test/robotlegs/bender/extensions/signalMediator/signalMediatorExtension.test.ts index a96d372..d13eecb 100644 --- a/test/robotlegs/bender/extensions/signalMediator/signalMediatorExtension.test.ts +++ b/test/robotlegs/bender/extensions/signalMediator/signalMediatorExtension.test.ts @@ -10,7 +10,7 @@ import "../../../../entry.ts"; import { assert } from "chai"; -import { Context } from "@robotlegsjs/core"; +import { IExtension, Context } from "@robotlegsjs/core"; import { SignalMediatorExtension } from "../../../../../src/robotlegs/bender/extensions/signalMediator/SignalMediatorExtension"; import { ISignalMap } from "../../../../../src/robotlegs/bender/extensions/signalMediator/api/ISignalMap"; @@ -24,16 +24,24 @@ describe("SignalMediatorExtension", () => { }); afterEach(() => { + if (context.initialized) { + context.destroy(); + } context = null; }); it("signalMap is mapped into injector", () => { - let actual: Object = null; + let actual: any = null; context.install(SignalMediatorExtension); - context.whenInitializing(function(): void { + context.whenInitializing(() => { actual = context.injector.get(ISignalMap); }); context.initialize(); assert.instanceOf(actual, SignalMap); }); + + it("toString_returns_a_string", () => { + let extension: IExtension = new SignalMediatorExtension(); + assert.isString(extension.toString()); + }); }); From c1b9cfb70481acb36937b8bf7076f2bd0b85ddfa Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 02:03:27 +0100 Subject: [PATCH 10/12] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ecca76..4ee1e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ - Add Pull Request Template (see #22). +- Use Map object properly (see #23). + - Update dev dependencies to latest version. ## RobotlegsJS-Pixi-SignalMediator 0.0.1 From 90648413cf8b94e5001202b1d2ff8c42a5fd5c24 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 02:09:21 +0100 Subject: [PATCH 11/12] update code climate token --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 93b84e1..6a75a93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js node_js: - stable env: - - CODECLIMATE_REPO_TOKEN=1b3aa177194deaeceb778c50f17f975f7000517d10cd53937de6fae600918425 + - CODECLIMATE_REPO_TOKEN=611584fd9f3548ccff1c929361b6f63e199ff57f326c7e4427231db871665ec1 - CODECLIMATE_API_HOST=https://codebeat.co/webhooks/code_coverage CODECLIMATE_REPO_TOKEN=f8670689-0731-4631-aa9a-5561931884ba before_install: - export CHROME_BIN=chromium-browser From c7a562eec2b243f0b5452098ab675f7148e705b7 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Wed, 15 Nov 2017 02:10:14 +0100 Subject: [PATCH 12/12] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee1e24..4296be3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ ## RobotlegsJS-Pixi-SignalMediator 0.1.0 -### v0.1.0 +### [v0.1.0](https://github.com/RobotlegsJS/RobotlegsJS-Pixi-SignalMediator/releases/tag/0.1.0) - 2017-11-15 - Update @robotlegsjs/pixi to version 0.1.0 (see #16).