diff --git a/.bookignore b/.bookignore new file mode 100644 index 000000000..010f8a084 --- /dev/null +++ b/.bookignore @@ -0,0 +1,10 @@ +lib +test +bin +.bookignore +.eslintignore +.eslintrc.js +.gitignore +.npmignore +.travis.yml +ISSUE_TEMPLATE.md diff --git a/.jshintignore b/.eslintignore similarity index 89% rename from .jshintignore rename to .eslintignore index b7b8df3e8..8b46802b2 100644 --- a/.jshintignore +++ b/.eslintignore @@ -1,4 +1,6 @@ +**/.* node_modules /coverage lib/coverage/tinytable.sorter.js lib/browser/client-scripts/gemini.calibrate.min.js +/_book diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..ed3166bbf --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + extends: 'gemini-testing', + root: true +}; diff --git a/.gitignore b/.gitignore index 82e99087b..41e005292 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ build node_modules /coverage /lib/browser/client-scripts/gemini.calibrate.min.js +/_book diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index 1dab2c0ff..000000000 --- a/.jscsrc +++ /dev/null @@ -1,99 +0,0 @@ -{ - "excludeFiles": [ - ".git", - "node_modules", - "/coverage", - "lib/coverage/tinytable.sorter.js", - "lib/browser/client-scripts/gemini.calibrate.min.js" - ], - "requireCurlyBraces": [ - "if", - "else", - "for", - "while", - "do", - "try", - "catch" - ], - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "return", - "try", - "catch" - ], - "requireSpaceBeforeBlockStatements": true, - "requireParenthesesAroundIIFE": true, - "requireSpacesInConditionalExpression": { - "beforeConsequent": true, - "afterConsequent": true, - "beforeAlternate": true - }, - "disallowSpacesInConditionalExpression": { - "afterTest": true - }, - "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "requireSpacesInFunctionDeclaration": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInFunctionDeclaration": { - "beforeOpeningRoundBrace": true - }, - "requireBlocksOnNewline": true, - "disallowPaddingNewlinesInBlocks": true, - "disallowSpacesInsideObjectBrackets": true, - "disallowSpacesInsideArrayBrackets": true, - "disallowSpacesInsideParentheses": true, - "disallowSpaceAfterObjectKeys": true, - "requireCommaBeforeLineBreak": true, - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforeBinaryOperators": [ - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==" - ], - - "requireSpaceAfterBinaryOperators": [ - "=", - ",", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==" - ], - "requireCamelCaseOrUpperCaseIdentifiers": true, - "disallowKeywords": ["with"], - "disallowMultipleLineStrings": true, - "disallowMultipleLineBreaks": true, - "validateLineBreaks": "LF", - "validateQuoteMarks": "'", - "validateIndentation": 4, - "disallowMixedSpacesAndTabs": true, - "disallowTrailingWhitespace": true, - "disallowTrailingComma": true, - "disallowKeywordsOnNewLine": ["else", "catch"], - "requireLineFeedAtFileEnd": true, - "requireCapitalizedConstructors": true, - "safeContextKeyword": ["_this"], - "disallowYodaConditions": true -} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 5cb88861b..000000000 --- a/.jshintrc +++ /dev/null @@ -1,44 +0,0 @@ -{ - "esversion": 6, - "bitwise": true, - "camelcase": true, - "curly": true, - "eqeqeq": true, - "freeze": true, - "immed": true, - "indent": 4, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "nonew": true, - "quotmark": "single", - "undef": true, - "unused": "vars", - "strict": true, - "trailing": true, - "maxparams": 3, - "node": true, - "laxbreak": true, - "overrides": { - "test/**": { - "mocha": true - }, - "lib/browser/client-scripts/*": { - "node": false, - "browserify": true - } - }, - - "globals": { - "describe": false, - "xdescribe": false, - "before": false, - "after": false, - "beforeEach": false, - "afterEach": false, - "it": false, - "xit": false, - "assert": false, - "sinon": false - } -} diff --git a/.npmignore b/.npmignore index 84ca827f9..b599ad665 100644 --- a/.npmignore +++ b/.npmignore @@ -1,10 +1,8 @@ -.gitignore -.travis.yml -.jshintignore -.jshintrc -.npmignore -.sublime-project* +**/.* test/ coverage/ CONTRIBUTING.md /lib/browser/client-scripts/gemini.calibrate.js +/_book +/book.json +/.bookignore diff --git a/.travis.yml b/.travis.yml index 57043962c..3c79bd72c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,14 @@ language: node_js sudo: false script: npm run ${NPM_SCRIPT} after_success: cat ${TRAVIS_BUILD_DIR}/coverage/lcov.info | coveralls -node_js: '4' +node_js: + - '8' env: global: # SAUCE_USERNAME - - secure: g1hP6mcOh5BRX1+4yxm6/vXYoWIHwNoIIIn0wfT8iFe8TIPwf8xAddXgU6KRAW8gUrS6hZvblpEyhz6khJ7pHsxcla5FmGg5ok8uvaD5H7o0ihmaWAOw8YYD9KgwZz6cJEk9EtsXUQmxwiDFO0Y03f97B8nxp56ENXzHQ7JGoQ4= + - secure: SGYVs5XUYWTZVbc7OCXjw8EeWZvmoM46vWk/bTJRLLLDrNGxSSNubhuToDmEWC0lV02qtp8W1XKJt2d/nmG/dJ7K1SZfLQSZi/zTRfkPWtf9uaaPOHMGt7O69lipnuaaSOavVlZfOPIg02iVjCj9Mwy/BAaRSR4qWeN+N6Sp0kI= # SAUCE_ACCESS_KEY - - secure: UondfJRnFfyjIOHoC5CXMiC8kPotq4dmgI93G5KETC2yLplRMNLBGSgaa+wuow3kDk0gDamYPWl/wV0tGbKG5qAvtm8DcvgONzIamTKYElf+7wmeHSoBZQ8vbrvu2Eo+zw8kGIzreBvOnm8TxpTM1vE6mAtfXq+aBGhW3l/2Mkw= - - CXX=g++-4.8 - -cache: - directories: - - node_modules + - secure: gmcCnuKOboJ2hFKZV8gxUzg1w/RbYr2YN0fky6llXQWi+VHZMa+YIN4HPOP4JVyvbGQA/6JQTj4E9JVAb9MnnBk58nXcEn5R8V9RU5EMBC8+zme22ILMFIvnrPhcMzjoEuupfGxbXmqzASNTWtQQd0qQ2flm8OyOMl+jCqAWCHs= matrix: fast_finish: true @@ -54,12 +50,3 @@ matrix: - env: - BROWSER=android5 - NPM_SCRIPT='test-browser --coverage' - - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-4.8 - - g++-4.8 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..df381177b --- /dev/null +++ b/AUTHORS @@ -0,0 +1,28 @@ +The following authors have created the source code of "Gemini" +published and distributed by YANDEX LLC as the owner: + +Sergey Tatarintsev +Anton Usmansky +Evgeniy Konstantinov +Vladimir Alaev +Evgeniy Gavryushin +Andrey Kuznecov +Rostislav Shtanko +Sergey Belov +Ilia Isupov +Dmitriy Dudkevich + +Contributors: + +Roman Hatipov +Alexandr Tikvach +Leonid Rudenko +Angelina Konstantinova +Misha Berezin +Maxime +David Chin +Ben Edwards +Oleg Apostol +Inna Belaya +Alex Baumgertner +Anton Rudeshko (Tesla) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fda3e7e2..5780eb07a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,881 @@ -# Changelog +# Change Log +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [7.5.2](https://github.com/gemini-testing/gemini/compare/v7.5.1...v7.5.2) (2019-11-25) + + + + +## [7.5.1](https://github.com/gemini-testing/gemini/compare/v7.5.0...v7.5.1) (2019-07-29) + + +### Bug Fixes + +* make executeJS method work properly with arrow function ([514fc1b](https://github.com/gemini-testing/gemini/commit/514fc1b)) + + + + +# [7.5.0](https://github.com/gemini-testing/gemini/compare/v7.4.1...v7.5.0) (2019-07-25) + + +### Features + +* **config:** add support for workers config option ([d7b7710](https://github.com/gemini-testing/gemini/commit/d7b7710)) + + + + +## [7.4.1](https://github.com/gemini-testing/gemini/compare/v7.4.0...v7.4.1) (2019-03-20) + + +### Bug Fixes + +* error maximum call stack size exceeded from looks-same ([0e18704](https://github.com/gemini-testing/gemini/commit/0e18704)) + + + + +# [7.4.0](https://github.com/gemini-testing/gemini/compare/v7.3.0...v7.4.0) (2019-03-13) + + +### Bug Fixes + +* notice about deprecated option replacement ([b066b16](https://github.com/gemini-testing/gemini/commit/b066b16)) + + +### Features + +* add diff clusters ([f80cf09](https://github.com/gemini-testing/gemini/commit/f80cf09)) + + + + +# [7.3.0](https://github.com/gemini-testing/gemini/compare/v7.2.0...v7.3.0) (2019-01-29) + + +### Bug Fixes + +* build diff image with using "antialiasingTolerance" prop ([7ff6e2a](https://github.com/gemini-testing/gemini/commit/7ff6e2a)) + + +### Features + +* add option "buildDiffOpts" to configure building diff image ([2c672df](https://github.com/gemini-testing/gemini/commit/2c672df)) + + + + +# [7.2.0](https://github.com/gemini-testing/gemini/compare/v7.1.2...v7.2.0) (2019-01-24) + + +### Features + +* use ref image from looks-same ([3a1a3f3](https://github.com/gemini-testing/gemini/commit/3a1a3f3)) + + + + +## [7.1.2](https://github.com/gemini-testing/gemini/compare/v7.1.1...v7.1.2) (2019-01-10) + + +### Bug Fixes + +* do not fall by memory in looks-same ([67b432e](https://github.com/gemini-testing/gemini/commit/67b432e)) + + + + +## [7.1.1](https://github.com/gemini-testing/gemini/compare/v7.1.0...v7.1.1) (2018-12-26) + + +### Bug Fixes + +* use gemini-core with stable looks-same ([9f8e97b](https://github.com/gemini-testing/gemini/commit/9f8e97b)) + + + + +# [7.1.0](https://github.com/gemini-testing/gemini/compare/v7.0.1...v7.1.0) (2018-12-26) + + +### Features + +* pass diff bounds to error from looks-same ([bdb3aab](https://github.com/gemini-testing/gemini/commit/bdb3aab)) + + + + +## [7.0.1](https://github.com/gemini-testing/gemini/compare/v7.0.0...v7.0.1) (2018-12-14) + + + + +# [7.0.0](https://github.com/gemini-testing/gemini/compare/v6.0.0...v7.0.0) (2018-12-13) + + +### Bug Fixes + +* do not convert ref image file to base64 to get size ([99c767f](https://github.com/gemini-testing/gemini/commit/99c767f)) + + +### Chores + +* drop node versions previous to 8 ([2eeddbb](https://github.com/gemini-testing/gemini/commit/2eeddbb)) + + +### BREAKING CHANGES + +* now supported version of node >= 8.0.0 + + + + +# [6.0.0](https://github.com/gemini-testing/gemini/compare/v5.9.1...v6.0.0) (2018-11-29) + + +### Features + +* emits image sizes on test execution events ([09b4318](https://github.com/gemini-testing/gemini/commit/09b4318)) + + +### BREAKING CHANGES + +* now on test execution events (TEST_RESULT, UPDATE_RESULT, RETRY, ERROR) emited image info (object) with path and size instead of only emit image path + + + + +## [5.9.1](https://github.com/gemini-testing/gemini/compare/v5.9.0...v5.9.1) (2018-10-02) + + + + +# [5.9.0](https://github.com/gemini-testing/gemini/compare/v5.8.1...v5.9.0) (2018-09-11) + + +### Features + +* add "antialiasingTolerance" option ([de7cc86](https://github.com/gemini-testing/gemini/commit/de7cc86)) + + + + +## [5.8.1](https://github.com/gemini-testing/gemini/compare/v5.8.0...v5.8.1) (2018-09-04) + + +### Bug Fixes + +* 'changeOrientation' action waits for screen rotate ([4e42d7e](https://github.com/gemini-testing/gemini/commit/4e42d7e)) + + + + +# [5.8.0](https://github.com/gemini-testing/gemini/compare/v5.7.2...v5.8.0) (2018-08-14) + + +### Features + +* set default browser orientation before each test ([8348d7a](https://github.com/gemini-testing/gemini/commit/8348d7a)) + + + + +## [5.7.2](https://github.com/gemini-testing/gemini/compare/v5.7.1...v5.7.2) (2018-06-09) + + + + +## [5.7.1](https://github.com/gemini-testing/gemini/compare/v5.7.0...v5.7.1) (2018-05-21) + + +### Bug Fixes + +* **vflat:** verbose reporter does not show session id ([187f8e8](https://github.com/gemini-testing/gemini/commit/187f8e8)) + + + + +# [5.7.0](https://github.com/gemini-testing/gemini/compare/v5.6.2...v5.7.0) (2018-05-07) + + +### Features + +* introduce hermione.halt method ([da68965](https://github.com/gemini-testing/gemini/commit/da68965)) + + + + +## [5.6.2](https://github.com/gemini-testing/gemini/compare/v5.6.1...v5.6.2) (2018-03-26) + + +### Bug Fixes + +* move set option to commander global options ([85d7d04](https://github.com/gemini-testing/gemini/commit/85d7d04)) + + + + +## [5.6.1](https://github.com/gemini-testing/gemini/compare/v5.6.0...v5.6.1) (2018-03-23) + + +### Bug Fixes + +* child suites retries not called ([a141462](https://github.com/gemini-testing/gemini/commit/a141462)) + + + + +# [5.6.0](https://github.com/gemini-testing/gemini/compare/v5.5.2...v5.6.0) (2018-03-20) + + +### Features + +* "skip" and "only" methods for tests API ([7b1853a](https://github.com/gemini-testing/gemini/commit/7b1853a)) + + + + +## [5.5.2](https://github.com/gemini-testing/gemini/compare/v5.5.1...v5.5.2) (2018-03-13) + + +### Bug Fixes + +* suite clone does not clone fullUrl ([4d9bc62](https://github.com/gemini-testing/gemini/commit/4d9bc62)) + + + + +## [5.5.1](https://github.com/gemini-testing/gemini/compare/v5.5.0...v5.5.1) (2018-02-26) + + +### Bug Fixes + +* child suite retries not called ([6268b62](https://github.com/gemini-testing/gemini/commit/6268b62)) + + + + +# [5.5.0](https://github.com/gemini-testing/gemini/compare/v5.4.1...v5.5.0) (2018-02-14) + + +### Features + +* **config:** introduce shouldRerty config option ([pull/878](https://github.com/gemini-testing/gemini/pull/878)) + + + +## [5.4.1](https://github.com/gemini-testing/gemini/compare/v5.4.0...v5.4.1) (2018-02-12) + + +### Bug Fixes + +* ignoreElements fail if outside viewport ([0f8b2c7](https://github.com/gemini-testing/gemini/commit/0f8b2c7)) + + + + +# [5.4.0](https://github.com/gemini-testing/gemini/compare/v5.3.0...v5.4.0) (2018-02-04) + + +### Features + +* **stats:** move part of the logic to the gemini-core ([99e7e0c](https://github.com/gemini-testing/gemini/commit/99e7e0c)) + + + + +# [5.3.0](https://github.com/gemini-testing/gemini/compare/v5.2.1...v5.3.0) (2018-01-30) + + +### Features + +* introduce option to specify delay before a screenshot is made ([ec52a5e](https://github.com/gemini-testing/gemini/commit/ec52a5e)) +* use new versions of glob-extra and gemini-coverage ([74ae6bf](https://github.com/gemini-testing/gemini/commit/74ae6bf)) + + + + +## [5.2.1](https://github.com/gemini-testing/gemini/compare/v5.2.0...v5.2.1) (2018-01-14) + + +### Bug Fixes + +* update gemini-core to 2.3.2 ([d74403d](https://github.com/gemini-testing/gemini/commit/d74403d)) + + + + +# [5.2.0](https://github.com/gemini-testing/gemini/compare/v5.1.2...v5.2.0) (2018-01-12) + + +### Features + +* **calibrator:** move to gemini-core ([fc87b21](https://github.com/gemini-testing/gemini/commit/fc87b21)) +* **new-browser:** change default value for resetZoom ([5006927](https://github.com/gemini-testing/gemini/commit/5006927)) + + + + +## [5.1.2](https://github.com/gemini-testing/gemini/compare/v5.1.1...v5.1.2) (2017-12-20) + + +### Bug Fixes + +* **coverage:** support webpack sourcemaps format ([1794e13](https://github.com/gemini-testing/gemini/commit/1794e13)) + + + + +## [5.1.1](https://github.com/gemini-testing/gemini/compare/v5.1.0...v5.1.1) (2017-12-07) + + +### Bug Fixes + +* allow unknown options before parsing config file ([98a5d5f](https://github.com/gemini-testing/gemini/commit/98a5d5f)) + + + + +# [5.1.0](https://github.com/gemini-testing/gemini/compare/v5.0.1...v5.1.0) (2017-12-06) + + +### Features + +* allow to extend cli parser via CLI event ([81fb51f](https://github.com/gemini-testing/gemini/commit/81fb51f)) + + + + +## [5.0.1](https://github.com/gemini-testing/gemini/compare/v5.0.0...v5.0.1) (2017-12-05) + + +### Bug Fixes + +* validate timeout type in wait element actions ([007a836](https://github.com/gemini-testing/gemini/commit/007a836)) + + + + +# [5.0.0](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.12...v5.0.0) (2017-12-01) + + +### Bug Fixes + +* Fixed not checking if dragTo is a valid element ([13566a1](https://github.com/gemini-testing/gemini/commit/13566a1)) + + +### Features + +* emit async INIT event instead of async plugins load ([b21aa58](https://github.com/gemini-testing/gemini/commit/b21aa58)) +* remove backwards compatibility for passing grep to readTests ([ed4ece5](https://github.com/gemini-testing/gemini/commit/ed4ece5)) +* remove bluebird-q compatibility layer ([7844620](https://github.com/gemini-testing/gemini/commit/7844620)) +* remove deprecated BEGIN_SESSION and END_SESSION events ([2c22d1d](https://github.com/gemini-testing/gemini/commit/2c22d1d)) +* remove deprecated CAPTURE event ([d06a913](https://github.com/gemini-testing/gemini/commit/d06a913)) +* remove deprecated END_TEST event ([9c7c8e2](https://github.com/gemini-testing/gemini/commit/9c7c8e2)) +* remove deprecated WARNING event ([c906b1f](https://github.com/gemini-testing/gemini/commit/c906b1f)) +* remove q-promise-utils ([67b3682](https://github.com/gemini-testing/gemini/commit/67b3682)) + + + + +# [5.0.0-alpha.12](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.11...v5.0.0-alpha.12) (2017-11-02) + + +### Bug Fixes + +* load plugins only once ([a56e39b](https://github.com/gemini-testing/gemini/commit/a56e39b)) + + + + +# [5.0.0-alpha.11](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.10...v5.0.0-alpha.11) (2017-11-01) + + +### Features + +* AFTER_TESTS_READ event with suite tree ([c67b644](https://github.com/gemini-testing/gemini/commit/c67b644)) +* wait for plugins load ([340286f](https://github.com/gemini-testing/gemini/commit/340286f)) + + + + +# [5.0.0-alpha.10](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.9...v5.0.0-alpha.10) (2017-10-31) + + + + +# [5.0.0-alpha.9](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.7...v5.0.0-alpha.9) (2017-10-19) + + +### Bug Fixes + +* **errors:** stacktraces of custom errors should include error message ([63eb59b](https://github.com/gemini-testing/gemini/commit/63eb59b)) +* pass current image path to reference image error ([968fe9a](https://github.com/gemini-testing/gemini/commit/968fe9a)) + + +### Features + +* drop node[@4](https://github.com/4) support ([e6dc2f8](https://github.com/gemini-testing/gemini/commit/e6dc2f8)) + + + + +# [5.0.0-alpha.8](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.7...v5.0.0-alpha.8) (2017-08-31) + + +### Bug Fixes + +* **errors:** stacktraces of custom errors should include error message ([63eb59b](https://github.com/gemini-testing/gemini/commit/63eb59b)) +* pass current image path to reference image error ([968fe9a](https://github.com/gemini-testing/gemini/commit/968fe9a)) + + + + +# [5.0.0-alpha.7](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.6...v5.0.0-alpha.7) (2017-08-28) + + + + +# [5.0.0-alpha.6](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.5...v5.0.0-alpha.6) (2017-08-02) + + + + +# [5.0.0-alpha.5](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.4...v5.0.0-alpha.5) (2017-07-11) + + +### Bug Fixes + +* tests statistic should listen events on main runner ([e676c3a](https://github.com/gemini-testing/gemini/commit/e676c3a)) + + + + +# [5.0.0-alpha.4](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.3...v5.0.0-alpha.4) (2017-07-04) + + +### Bug Fixes + +* incorrect .js config resolving ([db6b539](https://github.com/gemini-testing/gemini/commit/db6b539)) + + +### Features + +* add method 'shouldSkip(browserId)' to suite instance ([bad551c](https://github.com/gemini-testing/gemini/commit/bad551c)) +* provide the ability to modify retries count from plugins ([deafd55](https://github.com/gemini-testing/gemini/commit/deafd55)) + + + + +# [5.0.0-alpha.3](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2017-06-08) + + + + +# [5.0.0-alpha.2](https://github.com/gemini-testing/gemini/compare/v5.0.0-alpha.0...v5.0.0-alpha.2) (2017-06-06) + + +### Bug Fixes + +* bug with count of failed tests in the statistic ([ef550c5](https://github.com/gemini-testing/gemini/commit/ef550c5)) + + + + +# [5.0.0-alpha.0](https://github.com/gemini-testing/gemini/compare/v4.19.3...v5.0.0-alpha.0) (2017-05-25) + + +### Features + +* make setUrl work like url.resolve ([dcf6f17](https://github.com/gemini-testing/gemini/commit/dcf6f17)) + + + + +## [4.19.3](https://github.com/gemini-testing/gemini/compare/v4.19.2...v4.19.3) (2017-05-03) + + +### Performance Improvements + +* lazy load of images in HTML report for retries ([754368a](https://github.com/gemini-testing/gemini/commit/754368a)) + + + + +## [4.19.2](https://github.com/gemini-testing/gemini/compare/v4.19.1...v4.19.2) (2017-03-27) + + +### Bug Fixes + +* enable correct suite through suite collection api ([60c1147](https://github.com/gemini-testing/gemini/commit/60c1147)) + + + + +## [4.19.1](https://github.com/gemini-testing/gemini/compare/v4.19.0...v4.19.1) (2017-02-15) + + +### Bug Fixes + +* method "fullUrl" should resolve url in runtime ([e796dce](https://github.com/gemini-testing/gemini/commit/e796dce)) +* Prevented EMFILE error (too many open files) ([e8e4dca](https://github.com/gemini-testing/gemini/commit/e8e4dca)) + + + + +# [4.19.0](https://github.com/gemini-testing/gemini/compare/v4.18.2...v4.19.0) (2017-02-10) + + +### Features + +* Pass suiteCollection on BEGIN event to allow to modify it ([7d04923](https://github.com/gemini-testing/gemini/commit/7d04923)) + + + + +## [4.18.2](https://github.com/gemini-testing/gemini/compare/v4.18.1...v4.18.2) (2017-02-02) + + +### Bug Fixes + +* prevent endless loop when suitesPerSession is set to infinity ([2b399b6](https://github.com/gemini-testing/gemini/commit/2b399b6)) + + + + +## [4.18.1](https://github.com/gemini-testing/gemini/compare/v4.18.0...v4.18.1) (2017-01-25) + + +### Bug Fixes + +* Make clickable reason-links for skipped results in html report ([d266665](https://github.com/gemini-testing/gemini/commit/d266665)) + + + + +# [4.18.0](https://github.com/gemini-testing/gemini/compare/v4.17.1...v4.18.0) (2017-01-23) + + +### Features + +* add method 'gemini.ctx' to tests API ([66f2aa6](https://github.com/gemini-testing/gemini/commit/66f2aa6)) + + + + +## [4.17.1](https://github.com/gemini-testing/gemini/compare/v4.17.0...v4.17.1) (2017-01-18) + + +### Bug Fixes + +* roll back striptags version without breaking changes ([cd4e26e](https://github.com/gemini-testing/gemini/commit/cd4e26e)) + + + + +# [4.17.0](https://github.com/gemini-testing/gemini/compare/v4.16.0...v4.17.0) (2017-01-16) + + +### Features + +* Add test filename to html report's metaInfo section ([0311f6d](https://github.com/gemini-testing/gemini/commit/0311f6d)) + + + + +# [4.16.0](https://github.com/gemini-testing/gemini/compare/v4.15.0...v4.16.0) (2016-12-23) + + +### Bug Fixes + +* log a path to an HTML report after tests finish ([86a8466](https://github.com/gemini-testing/gemini/commit/86a8466)) +* set default reporter for command 'update' ([feb72bc](https://github.com/gemini-testing/gemini/commit/feb72bc)) + + +### Features + +* Add extended WebDriver error data in output ([73a26ed](https://github.com/gemini-testing/gemini/commit/73a26ed)) + + + + +# [4.15.0](https://github.com/gemini-testing/gemini/compare/v4.14.4...v4.15.0) (2016-12-21) + + +### Features + +* Allow to ignore every element, matching selector ([c36ed78](https://github.com/gemini-testing/gemini/commit/c36ed78)) +* **html-reporter:** add ability to specify output path for each report ([b25409e](https://github.com/gemini-testing/gemini/commit/b25409e)) + + + + +## [4.14.4](https://github.com/gemini-testing/gemini/compare/v4.14.1...v4.14.4) (2016-12-12) + + +### Bug Fixes + +* correct implementation of doubleClick action ([f8746a9](https://github.com/gemini-testing/gemini/commit/f8746a9)) +* emit browser start/stop events in correct places ([e8a427e](https://github.com/gemini-testing/gemini/commit/e8a427e)) +* IE9 does not include pseudo-element styles ([906988b](https://github.com/gemini-testing/gemini/commit/906988b)) +* Remove session id console output for skipped tests ([6aa92e1](https://github.com/gemini-testing/gemini/commit/6aa92e1)) + + + + +## [4.14.3](https://github.com/gemini-testing/gemini/compare/v4.14.2...v4.14.3) (2016-12-05) + + +### Bug Fixes + +* correct implementation of doubleClick action ([f8746a9](https://github.com/gemini-testing/gemini/commit/f8746a9)) + + + + +## [4.14.2](https://github.com/gemini-testing/gemini/compare/v4.14.1...v4.14.2) (2016-11-24) + + +### Bug Fixes + +* emit browser start/stop events in correct places ([e8a427e](https://github.com/gemini-testing/gemini/commit/e8a427e)) +* IE9 does not include pseudo-element styles ([906988b](https://github.com/gemini-testing/gemini/commit/906988b)) + + + + +## [4.14.1](https://github.com/gemini-testing/gemini/compare/v4.14.0...v4.14.1) (2016-11-22) + + +### Bug Fixes + +* fix invalid urls to reference images ([85a426d](https://github.com/gemini-testing/gemini/commit/85a426d)) +* fix invalid urls to reference images ([ed2ac15](https://github.com/gemini-testing/gemini/commit/ed2ac15)) +* remove polyfill-service dependency ([364bcbf](https://github.com/gemini-testing/gemini/commit/364bcbf)), closes [#673](https://github.com/gemini-testing/gemini/issues/673) [#635](https://github.com/gemini-testing/gemini/issues/635) + + + + +# [4.14.0](https://github.com/gemini-testing/gemini/compare/v4.13.4...v4.14.0) (2016-11-16) + + +### Bug Fixes + +* **documentation:** update information about using gemini options ([251329b](https://github.com/gemini-testing/gemini/commit/251329b)) +* correct exit on 'SIGHUP', 'SIGINT' or 'SIGTERM' ([1f0ffbe](https://github.com/gemini-testing/gemini/commit/1f0ffbe)) +* Implement advanced verification for suites with same names ([2572af5](https://github.com/gemini-testing/gemini/commit/2572af5)) + + +### Features + +* **html-reporter:** add ability to copy suite name and open suite urls ([6219b74](https://github.com/gemini-testing/gemini/commit/6219b74)) + + +### Performance Improvements + +* Use reference images instead of actual(current) in HTML report ([ef198bc](https://github.com/gemini-testing/gemini/commit/ef198bc)) + + + + +## [4.13.4](https://github.com/gemini-testing/gemini/compare/v4.13.3...v4.13.4) (2016-11-07) + + +### Bug Fixes + +* **config:** throw error if value contain not valid json string ([60cc4f0](https://github.com/gemini-testing/gemini/commit/60cc4f0)) +* **config:** use JSON.parse for plugins values from cli/env ([6039fd1](https://github.com/gemini-testing/gemini/commit/6039fd1)) + + + + +## [4.13.3](https://github.com/gemini-testing/gemini/compare/v4.13.1...v4.13.3) (2016-11-03) + + +### Bug Fixes + +* **glob-extra:** replace isMasks to isMask ([830be2e](https://github.com/gemini-testing/gemini/commit/830be2e)) +* **html-reporter:** don't store ref when it equal with current image ([3183c21](https://github.com/gemini-testing/gemini/commit/3183c21)) +* **test:** improve some tests ([c56bdcb](https://github.com/gemini-testing/gemini/commit/c56bdcb)) + + + + +## [4.13.2](https://github.com/gemini-testing/gemini/compare/v4.13.1...v4.13.2) (2016-10-26) + + +### Bug Fixes + +* **glob-extra:** replace isMasks to isMask ([830be2e](https://github.com/gemini-testing/gemini/commit/830be2e)) +* **test:** improve some tests ([c56bdcb](https://github.com/gemini-testing/gemini/commit/c56bdcb)) + + + + +## [4.13.1](https://github.com/gemini-testing/gemini/compare/v4.13.0...v4.13.1) (2016-10-25) + + +### Bug Fixes + +* do not show skipped tests in retries ([799dc80](https://github.com/gemini-testing/gemini/commit/799dc80)) + + + + +# [4.13.0](https://github.com/gemini-testing/gemini/compare/v4.12.2...v4.13.0) (2016-10-19) + + +### Features + +* **cli:** Add command 'list' to show list of browsers or sets from config ([b5e4b4a](https://github.com/gemini-testing/gemini/commit/b5e4b4a)) +* Implement readRawConfig static API method ([b269b0b](https://github.com/gemini-testing/gemini/commit/b269b0b)) + + + + +## 4.12.2 - 20160-10-11 + +* Fix `startRunner` and `endRunner` to correctly wait for promises, returned + from plugins. +* Various fixes related to `bluebird` migration. All "is not a function" errors + now should be gone. +* Fix assignment to const error in html report. + + +## 4.12.1 - 2016-10-06 + +* Restore 4.10 plugin loading order — plugins now loaded before any tests files + are read. +* Internal promises library changed `bluebird`. This should make gemini a little + bit faster. + + +## 4.12.0 - 2016-10-03 + +* Added the ability to specify exclude paths in which the gemini tests will not be searched, see [documentation](https://github.com/gemini-testing/gemini/blob/master/doc/config.md#system-settings) +* Fixed bug which causes skip errors which might be occur in listeners of `START_RUNNER` and `END_RUNNER` events + + +## 4.11.3 - 2016-09-29 + +* Second attempt of fixing order of file read events + + +## 4.11.2 - 2016-09-27 + +* Fixed bug which causes emitting `beforeFileRead` after the file has already been read in GeminiFacade + + +## 4.11.1 - 2016-09-26 + +Identical to 4.11, published by mistake + + +## 4.11.0 - 2016-09-23 + +* Do not delay retry failed tests until all tests finish. Retry ASAP +* Added `events` field for `gemini` instance in plugins, see [documentation](https://github.com/gemini-testing/gemini/blob/master/doc/plugins.md) for more details. +* Updated `Quick start` section in documentation + + +## 4.10.0 - 2016-09-19 + +* Lodash updated to v4.x +* Clone suite tree for each browser runner +* Use `catch` method instead of `fail` in q + + +## 4.9.4 - 2016-09-13 + +* Fixed `Out of the bounds` error (see [#543]) + +[#543]: https://github.com/gemini-testing/gemini/issues/543 + + +## 4.9.2 - 2016-09-09 + +* Updated third party libraries, so Array.prototype methods won't be overwritten + anymore + + +## 4.9.1 - 2016-09-05 + +* Fixed abort of the broken session on test error +* Fixed incorrect creation of set with empty files +* Updated version of glob-extra + + +## 4.9.0 - 2016-09-01 + +* Close browser session after error in a test +* Set left button as default for mouse button actions +* Fixed wrong validation of `grep` option from cli + + +## 4.8.0 - 2016-08-30 + +* Fixed bug which causes `Cannot find files by mask gemini` error if sets in config are not specified (see [#569]) +* Fixed bug which causes `/null` url in meta-info +* Displaying the number of updated images via command `gemini update` in flat reporter + + +## 4.7.2 - 2016-08-26 + +* Correctly display the images in the html report in case suite names contain non-urlsafe characters. + + +## 4.7.1 - 2016-08-25 + +* Fixed critical bug which causes failing of browser requests + + +## 4.7.0 - 2016-08-25 + +* `beforeFileRead` and `afterFileRead` API events were added. This allows plugins to be notified + when gemini is about to read a test file and when it was read +* `CAPTURE` and `END_TEST` events were declared as deprecated. `UPDATE_RESULT` and `TEST_RESULT` events should be used instead of them respectively +* Added the ability to see in flat reporter which states were really updated via gemini update command +* Added `sessionQuitTimeout` option which allows to change timeout for session termination +* Disallowed usage of empty names for suites +* Added nodejs@6.x support + + +## 4.6.0 - 2016-08-11 + +* Added `GEMINI_SKIP_BROWSERS` environment variable support +* Added the ability to log config for each browser using `DEBUG=gemini:config` environment variable +* Fix: escape special symbols in HTML report +* Fix: correct displaying of test url in meta-info of an HTML report + + +## 4.5.0 - 2016-08-05 + +* Retry only failed states on fail instead of all states of the suite +* Add ability to set file masks for test paths in a `sets` option +* Add ability to implement custom source path resolving for CSS files in coverage +* Fix: keep original stack when cloning error + + +## 4.4.4 - 2016-07-27 + +* Revert code changes made for version 4.4.3 + + +## 4.4.3 - 2016-07-26 + +* Fix bug with resolving source paths in gemini coverage module + + +## 4.4.2 - 2016-07-20 + +* Fixed retry of individual states (error with 'isCoverageEnabled on undefined') +* Support `changeOrientation` for `appium` below 1.5.x +* Back to upstream of `uglify-js` + + ## 4.4.1 - 2016-07-18 * Froze uglify-js version at v2.6.4 @@ -8,6 +884,7 @@ * Output path to html report to a console * Updated version of looks-same dependency to 3.0.0 + ## 4.4.0 - 2016-06-17 * Added option `compositeImage` which allows to test areas with height larger than viewport one, @@ -19,6 +896,7 @@ * Fix: do not fail test if a hidden element was added to method `ignoreElements`. * Fix displaying of retries in HTML report after adding of `sessionId` in meta-info of HTML reporter. + ## 4.3.0 - 2016-06-02 * Added new browser option `screenshotMode` which allows to set an image capture mode, see the [documentation](https://github.com/gemini-testing/gemini/blob/v4.3.0/doc/config.md#browsers-settings) for more details. @@ -27,10 +905,12 @@ * Fix: do not emit an error if `browser.quit` fails, warning will be logged. * Fix: support passing of `sessionId` to an error if launching of a browser fails. + ## 4.2.0 - 2016-05-26 * Added option `sessionRequestTimeout` which sets a timeout for getting of browser sessions + ## 4.1.0 - 2016-05-20 * Supported displaying of meta-info in HTML reporter which contains suite/state url @@ -39,26 +919,31 @@ * Dropped throwing of critical errors in states, this means that a state failure always emits an `err` event * Fix: browser sessions will be freed immediately if there are no states to run instead of waiting for the end of all remaining running states in other browser sessions + ## 4.0.4 - 2016-04-29 * Fix: use top level windowSize * Fix error object instance after serializing + ## 4.0.3 - 2016-04-26 * Fix image processing: use pixel ratio in subprocesses + ## 4.0.2 - 2016-04-25 * Fix failed suites count in summary line * Throw error on image validation fail * Show page screenshot on image validation error + ## 4.0.1 - 2016-04-20 * Fix documentation * Fix: require default config by absolute path + ## 4.0.0 - 2016-04-20 * Fixed hang in browser pool queue when using `parallelLimit` option @@ -73,14 +958,17 @@ * Removed `gather command`. Use `update` command instead * Now error data will be extended with path to image instead of image itself: `error.image` => `error.imagePath` + ## 3.0.2 - 2016-03-30 * Fix: Child suite context should have same data as parent has (@j0tunn) + ## 3.0.1 - 2016-03-24 * Fixed element find caching (@j0tunn) + ## 3.0.0 - 2016-03-23 * Fixed `CLIENT_STOPPED_SESSION` bug when performing setWindowSize in post actions (@j0tunn) @@ -100,10 +988,12 @@ * Removed skip method for actions (@j0tunn) * Accumulate "before" and "after" actions for nested suites (@j0tunn) + ## 2.1.1 - 2016-01-27 * Fix: specified name for NoRefImageError (@SwinX) + ## 2.1.0 - 2016-01-25 * Fixed bug in enable/disable logic in suite collection - may not work properly when disabling @@ -111,12 +1001,14 @@ * Added possibility to enable/disable suites by full name (@j0tunn) * Added possibility to specify `grep` condition for `readTests` API method (@SwinX) + ## 2.0.3 - 2015-12-23 * Fix update command called without any options (@sipayRT) * Limited pool fix: push defer queue if failed to free browser (@j0tunn) * Add editor files to the .npmignore (@j0tunn) + ## 2.0.0 - 2015-12-19 * `gemini update` command: ability to update only new and changed references (@sipayRT) @@ -139,34 +1031,41 @@ * `gemini.readTests` now returns `SuiteCollection` instance instead of `rootSuite` object (@j0tunn) * `gemini gather` deprecated in favor of `gemini update` (@sipayRT) + ## 1.1.6 - 2015-12-04 * Remove restirction for maximum open concurrent sockets (@j0tunn) + ## 1.1.5 - 2015-12-03 * Show reference image if test failed due to lack of it (@sipayrt) * Fixed result in HTML report for sibling states appear several times on retry (@SwinX) + ## 1.1.4 - 2015-11-27 * Fix: in LimitedPool next browser request will be triggered if failed to receive browser from underlying pool (@SwinX) + ## 1.1.3 - 2015-11-25 * Implemented TestCounter class for reporters (@SwinX) * Fixed undefined session id in vflat reporter (@SwinX) * Immediately quit browser if failed to create it (@SwinX) + ## 1.1.2 - 2015-11-20 * Fix: wrong initial-scale meta data (@sipayrt) * Fix: build crashed on 'gather' command (@SwinX) + ## 1.1.1 - 2015-11-18 * Fix: html reporter correctly handles `error` event if no data about state passed + ## 1.1.0 - 2015-11-18 * Implemented suite retry on compare diff and critical errors (@SwinX) @@ -178,35 +1077,42 @@ * Fix: free browser after cancel (@j0tunn) * Fix: keep original error if 'afterHook' or 'postActions' failed (@j0tunn) + ## 1.0.6 - 2015-11-06 * Show error message + whole page screenshot on test fail (@sipayrt) * Fix: clean browsers pool after finalization (@SwinX) * Fix: check for global window variable on client-side (@eroshinev) + ## 1.0.5 - 2015-11-03 * Do not fail tests if browsers specified from env does not exists in config (@sipayrt) + ## 1.0.4 - 2015-10-13 * Fix counting of skipped test by flat reporter (@sipayrt) * Pass sessionId on events for correctly TC work (@sipayrt) + ## 1.0.3 - 2015-10-12 * Fix: return correct exit code on test failing (@sipayrt) + ## 1.0.2 - 2015-10-12 * Fix handling of END_RUNNER event (@sipayrt) + ## 1.0.1 - 2015-10-08 * Fix: END_RUNNER event delivered to plugins in case of critical error (@SwinX) * Fix: make screenshot after prepareScreenshot() has been executed (@sipayrt) * Remove spaces from env GEMINI_BROWSERS (@sipayrt) + ## 1.0.0 - 2015-10-05 * Add Android support (@SevInf) @@ -223,16 +1129,19 @@ * Fix: fire END_SUITE event when nested suites are done (@scf2k) + ## 0.13.5 - 2015-09-09 * Added the `vflat` reporter (@unlok) + ## 0.13.4 - 2015-08-30 * Path to the plugin configuration fixed (@SevInf) * Sets support (@j0tunn) + ## 0.13.3 - 2015-08-27 * mouseUp action: make element argument optional (@just-boris). @@ -241,10 +1150,12 @@ * html report: load report images in lazy mode (@scf2k). + ## 0.13.2 - 2015-08-17 * Fix: correct handling of no-ref-image error (@j0tunn). + ## 0.13.1 - 2015-08-15 * Inline sourcemaps support in coverage calculation (@j0tunn). @@ -253,6 +1164,7 @@ * API: do not override options with CLI flags and env vars by default (@SevInf). + ## 0.13.0 - 2015-08-10 * Fail when removed option is detected and warn if removed env var is detected @@ -270,10 +1182,12 @@ * Corrected updates (@maximerassi). + ## 0.13.0-beta.1 — 2015-07-31 Previous version was published without a tarball once again. Republishing. + ## 0.13.0-beta — 2015-07-29 * BREAKING CHANGE: new config format. See [docs](doc/config.md). @@ -385,26 +1299,31 @@ Previous version was published without a tarball once again. Republishing. * New option `sessionsPerBrowser` allows to launch multiple session for each browser and run tests in parallel. + ## 0.12.8 - 2015-07-23 * Correctly restore window size when `setWindowSize` is called in `before` callback (@SevInf). + ## 0.12.7 - 2015-07-20 * Correctly calculate element position if WebDriver returns screenshot thinner then document (@SevInf). + ## 0.12.6 - 2015-06-16 * More clear error when capture are is hidden (@hatroman). * Mouse cursor is moved to (0,0) before the first test (@j0tunn). + ## 0.12.5 - 2015-05-28 Republish 0.12.4 due to another npm bug. + ## 0.12.4 - 2015-05-28 * Fix calibration to work in Chrome 43+ (@SevInf). @@ -414,14 +1333,17 @@ Republish 0.12.4 due to another npm bug. * `windowSize` option is ignored in Opera Presto browsers (@SevInf). + ## 0.12.3 - 2015-05-21 * Sizzle: work with selectors ending with space (@SevInf). + ## 0.12.2 - 2015-05-19 * Fix client bridge script injection (@SevInf). + ## 0.12.1 - 2015-05-18 CRITICAL BUG WAS INTRODUCED IN THIS VERSION. @@ -435,19 +1357,23 @@ Version was deleted from npm, use 0.12.2 instead. * Coverage now correctly detects intersection of the elements and capture area (@scff). + ## 0.12.0 - 2015-05-07 * When capturing element is visible compltely in the viewport do not scroll to element's location while taking the screenshot (@scff). + ## 0.11.5 - 2015-04-30 * Fix calibration in IE8 and add functional tests for it (@SevInf). + ## 0.11.4 - 2015-04-29 * Calibration affects only top and left sides of the screenshot (@scff). + ## 0.11.3 - 2015-04-24 * Take into account horizontal scrolling when validating capture area for @@ -458,14 +1384,17 @@ Version was deleted from npm, use 0.12.2 instead. * Correctly report execptions, thrown during coverage gathering (@SevInf). + ## 0.11.2 - 2015-04-21 * Republish 0.11.1 due to npm registry bug. + ## 0.11.1 - 2015-04-21 * Fix crash after all tests are finished (@SevInf). + ## 0.11.0 - 2015-04-18 * Plugins support (@Saulis). @@ -498,6 +1427,7 @@ Version was deleted from npm, use 0.12.2 instead. * HTML report refactoring (@hatroman). + ## 0.10.0 - 2015-04-06 * Fix calibration to work in IE8 again (@SevInf) @@ -512,11 +1442,13 @@ Version was deleted from npm, use 0.12.2 instead. * Ported 0.9.9 changes (@SevInf) + ## 0.10.0-beta.2 - 2015-03-26 * Use document height instead of body height to determine whether webdriver returns document or viewport screenshot (@SevInf) + ## 0.10.0-beta.1 - 2015-03-19 * Basic support for IE8 browser (@SevInf). @@ -554,11 +1486,13 @@ Version was deleted from npm, use 0.12.2 instead. * Warn if coverage for CSS file cannot be calculated due to same-origin policy (@SevInf) + ## 0.9.9 - 2015-04-06 * Adds new option `--browser` to the CLI and `browsers` to the API which allows to run tests in a subset of browsers (@SevInf). + ## 0.9.8 - 2015-02-11 * Work correctly if WebDriver implementation returns screenshot with @@ -577,6 +1511,7 @@ Version was deleted from npm, use 0.12.2 instead. * Correctly report image path in `gather` API (@SevInf). + ## 0.9.7 - 2015-02-09 * Add new wait methods (@SevInf): @@ -587,14 +1522,17 @@ Version was deleted from npm, use 0.12.2 instead. - `waitForJSCondition` + ## 0.9.6 - 2015-01-27 * Work on a pages that modify `Array.prototype` (@SevInf). + ## 0.9.5 - 2014-12-10 * Works on Windows again (@SevInf). + ## 0.9.4 - 2014-12-03 * Add `sendFile` action which now should be used instead of `sendKeys` to set @@ -604,11 +1542,13 @@ Version was deleted from npm, use 0.12.2 instead. * Fail only single test if reference image is not found (@SevInf). + ## 0.9.3 - 2014-11-07 * Coverage generator now follows symlinks while resolving the paths to CSS files. So the final report will have real paths but not pointing to symlinks. + ## 0.9.2 - 2014-11-07 * Move the coverage HTML templating code to separate module (gemini-coverage). @@ -617,10 +1557,12 @@ Version was deleted from npm, use 0.12.2 instead. error also will now fail only single state instead of a whole testing process (@SevInf). + ## 0.9.1 - 2014-10-23 * Ignore `@keyframes` at-rule while collecting coverage (@scf2k). + ## 0.9.0 - 2014-10-22 * Replace `GraphicsMagick` with lightweight `png-img` library (@j0tunn). @@ -646,16 +1588,19 @@ Version was deleted from npm, use 0.12.2 instead. * Restructure documentation and add quick start guide in russian and english (@jk708). + ## 0.8.2 - 2014-10-06 * Reset cursor position before reloading the page. When resetting it just after page load, old cursor position may trigger some transitions which will not be finished before first screenshot. + ## 0.8.1 – 2014-09-30 * `test` command will exit with correct codes + ## 0.8.0 - 2014-09-30 * New image comparison algorithm is implemented: @@ -686,6 +1631,7 @@ Version was deleted from npm, use 0.12.2 instead. * Show required dimensions in error message when origin does not fir to full-page screenshot (@scf2k) + ## 0.7.0 - 2014-09-15 * Show meaningful error when capture area origin does not fit to full-page @@ -704,10 +1650,12 @@ Version was deleted from npm, use 0.12.2 instead. (@scf2k). + ## 0.6.5 - 2014-09-12 Was republished as 0.7.0 due to a breaking change. + ## 0.6.4 - 2014-08-13 * Add command line completion (@unlok). @@ -716,22 +1664,26 @@ Was republished as 0.7.0 due to a breaking change. * Add `focus(element)` action (@arikon). + ## 0.6.3 - 2014-08-05 * Allow to use empty string with `sendKeys`. It can be used to focus on an element without changing states. + ## 0.6.2 - 2014-08-01 * Reset mouse position for each suite. Previously, cursor may stay at the position left from a previous suite and some elements was captured with hover effect when there shouldn't be any. + ## 0.6.1 - 2014-07-30 * Fix incorrect capture region rounding, causing bottom row of the element to be cropped sometimes. + ## 0.6.0 - 2014-07-28 * `:before` and `:after` pseudo-elements outline and shadow are now taken into @@ -758,6 +1710,7 @@ Was republished as 0.7.0 due to a breaking change. * Global installations of `gemini` now runs local one, if available. + ## 0.5.0 - 2014-07-17 * Browsers are now launched once for each run (previously, they were launched @@ -782,14 +1735,17 @@ Was republished as 0.7.0 due to a breaking change. * Fix `--version` option. + ## 0.4.2 - 2014-06-25 * Fix missing images in html report. + ## 0.4.1 - 2014-06-19 * Correctly detect crop region in Firefox + ## 0.4.0 - 2014-06-18 * Crop region for screenshots is calculated via client script inside browser @@ -837,6 +1793,7 @@ Was republished as 0.7.0 due to a breaking change. * If `gemini` is run without subcommand, help text will be shown. + ## 0.3.4 - 2014-05-28 * Enhanced html report: @@ -850,6 +1807,7 @@ Was republished as 0.7.0 due to a breaking change. - stats of total numbers of tests run, failed, succeeded and skipped are shown at the top. + ## 0.3.3 - 2014-05-19 * Allow to use multiple reporters in `test` command. @@ -873,6 +1831,7 @@ Was republished as 0.7.0 due to a breaking change. * Fix error when `gridUrl` was required even if there is only `phantomjs` browser. + ## 0.3.2 - 2014-05-15 * Allow to override `gridUrl` and `rootUrl` settings with cli options @@ -880,6 +1839,7 @@ Was republished as 0.7.0 due to a breaking change. * Correctly report error, when wrong argument passed to an action. + ## 0.3.1 - 2014-05-13 * Ability to set additional capabilities for all browsers, using `capabilities` @@ -902,6 +1862,7 @@ Was republished as 0.7.0 due to a breaking change. * When `gemini` is unable to launch browser, more clearer error message will be displayed. + ## 0.3.0 - 2014-04-30 * Elements to take screen shots of and elements to perform action on are now @@ -978,11 +1939,13 @@ Was republished as 0.7.0 due to a breaking change. * Public API now has constants for special keys to use in `sendKeys` actions (i.e. `gemini.CONTROL` for `CTRL` key). + ## 0.2.1 - 2014-04-23 * Fix a bug with incorrect reference to the suite in states. Because of this bug dynamic elements was not updated properly. + ## 0.2.0 - 2014-04-22 * New test suites API. Plans are replaced by test suites defined by explicit @@ -1053,6 +2016,7 @@ Was republished as 0.7.0 due to a breaking change. * Tree reporter is now used for `gather` command. + ## 0.1.1 - 2014-04-08 * `phantomjs` always starts maximized. This fixes the error, when some shadows @@ -1065,6 +2029,9 @@ Was republished as 0.7.0 due to a breaking change. * browsers are always closed, even if there was an error. + ## 0.1.0 - 2014-03-27 * Initial release + +[#569]: https://github.com/gemini-testing/gemini/issues/569 diff --git a/CLA.md b/CLA.md new file mode 100644 index 000000000..37ca442a0 --- /dev/null +++ b/CLA.md @@ -0,0 +1,34 @@ +# Notice to external contributors + +## General info + +Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA you may find here: +1) https://yandex.ru/legal/cla/?lang=en (in English) and +2) https://yandex.ru/legal/cla/?lang=ru (in Russian). + +By adopting the CLA, you state the following: + +* You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA, +* You has read the terms and conditions of the CLA and agree with them in full, +* You are legally able to provide and license your contributions as stated, +* We may use your contributions for our open source projects and for any other our project too, +* We rely on your assurances concerning the rights of third parties in relation to your contributes. + +If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you has already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA. + +## Provide contributions + +If you have already adopted terms and conditions of the CLA, you are able to provide your contributes. When you submit your pull request, please add the following information into it: + +``` +I hereby agree to the terms of the CLA available at: [link]. +``` + +Replace the bracketed text as follows: +* `[link]` is the link at the current version of the CLA (you may add here a link https://yandex.ru/legal/cla/?lang=en (in English) or a link https://yandex.ru/legal/cla/?lang=ru (in Russian). + +It is enough to provide us such notification at once. + +## Other questions + +If you have any questions, please mail us at opensource@yandex-team.ru. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e44f4ad8..88730635b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -New contributions are welcomed. Follow this guide if you want to make one. +New contributions are welcomed. Follow this guide and [CLA](CLA.md) if you want to make one. ## Make a pull request @@ -11,10 +11,8 @@ All bug fixes and new features should go to the [`master`](https://github.com/ge ## Commit messages -Commit messages should describe what have been changed and why. The first line should be wrapped -to 50 characters, the second one should be blank. All other lines should be wrapped to 72 characters. - -[Example of a good commit message](https://github.com/gemini-testing/gemini/commit/1096ee26d79be6e580e90146dbe161fb5a662d80). +Commit messages should follow [conventional changelog +standard](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md). ## Code style and static analysis diff --git a/LICENSE b/LICENSE index c392e82f5..299767d2b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Sergej Tatarincev +Copyright (c) 2014 YANDEX LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 7f87e5e9e..e18226cba 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,131 @@ -# Gemini quick start +# Gemini -[![Join the chat at -https://gitter.im/gemini-testing/gemini](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gemini-testing/gemini?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![npm](https://img.shields.io/npm/v/gemini.svg?maxAge=2592000)](https://www.npmjs.com/package/gemini) +[![Build Status](https://travis-ci.org/gemini-testing/gemini.svg?branch=master)](https://travis-ci.org/gemini-testing/gemini) +[![Coverage Status](https://img.shields.io/coveralls/gemini-testing/gemini.svg)](https://coveralls.io/r/gemini-testing/gemini) +[![Join the chat at https://gitter.im/gemini-testing/gemini](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gemini-testing/gemini?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Stories on waffle.io](https://img.shields.io/badge/waffle-dashboard-green.svg)](http://waffle.io/gemini-testing/gemini) -[![Build -Status](https://travis-ci.org/gemini-testing/gemini.svg?branch=master)](https://travis-ci.org/gemini-testing/gemini) +[Gemini](https://github.com/gemini-testing/gemini) is a utility for regression +testing the visual appearance of web pages. -[![Coverage -Status](https://img.shields.io/coveralls/gemini-testing/gemini.svg)](https://coveralls.io/r/gemini-testing/gemini) +Gemini allows you to: -[Gemini](https://github.com/gemini-testing/gemini) is the utility for regression -testing of web pages appearance. - -Its key features are: - -* Compatibility with different browsers: +* Work with different browsers: - Google Chrome (tested in latest version) - Mozilla Firefox (tested in latest version) - IE8+ - Opera 12+ -* Ability to test separate sections of a web page; +* Test separate sections of a web page + +* Include the `box-shadow` and `outline` properties when calculating element position and size + +* Ignore some special case differences between images (rendering artifacts, text caret, + etc.) + +* Gather CSS test coverage statistics + +**Gemini** was created at [Yandex](http://www.yandex.com/) and is especially +useful to UI library developers. + +## Quick start + +### Installing + +``` +npm install -g gemini +npm install -g selenium-standalone +selenium-standalone install +``` + +### Configuring + +Put the `.gemini.js` file in the root of your project: + +```javascript +module.exports = { + rootUrl: 'http://yandex.ru', + gridUrl: 'http://127.0.0.1:4444/wd/hub', + + browsers: { + chrome: { + desiredCapabilities: { + browserName: 'chrome' + } + } + } +}; +``` + +### Writing tests + +Write a test and put it in the `gemini` folder in the root of your project: + +```javascript +gemini.suite('yandex-search', (suite) => { + suite.setUrl('/') + .setCaptureElements('.home-logo') + .capture('plain'); +}); +``` -* Position and size of an element are calculated including its `box-shadow` and - `outline` properties; +### Saving reference images -* Some special case differences between images (rendering artifacts, text caret, - etc.) are ignored; +You have written a new test and should save a reference image for it: +``` +gemini update +``` -* CSS test coverage statistics. +### Running tests -**Gemini** is created at [Yandex](http://www.yandex.com/) and will be especially -useful to UI libraries developers. +Start `selenium-standalone` in a separate tab before running the tests: +``` +selenium-standalone start +``` -Current document is a quick step-by-step guide that describes installation, -configuration and usage of **Gemini**. +Run gemini tests: +``` +gemini test +``` ## Dependencies Required software: -1. WebDriver server implementation. There are few possible options: +1. WebDriver server implementation. There are several options: - - [Selenium Server](http://docs.seleniumhq.org/download/) – for testing in - different browsers. + - [Selenium Server](http://docs.seleniumhq.org/download/) — for testing in + different browsers. Launch with the `selenium-standalone start` command (if you will get error like "No Java runtime present, requesting install." you should install [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/index.html) for your OS.). - - [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) - for - testing in Google Chrome. + - [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) — for + testing in Google Chrome. Launch with the `chromedriver --port=4444 --url-base=wd/hub` command. - - [PhantomJS](http://phantomjs.org/) — launch with `phantomjs + - [PhantomJS](http://phantomjs.org/) — launch with the `phantomjs --webdriver=4444` command. - Cloud WebDriver services, such as [SauceLabs](http://saucelabs.com/) or [BrowserStack](http://www.browserstack.com/) -2. Compiler with support of C++11 (`GCC@4.6` or higher). This is a +2. Compiler with support for C++11 (`GCC@4.6` or higher). This is a [png-img](https://github.com/gemini-testing/png-img) requirement. + Compiling on Windows machines requires the [node-gyp prerequisites](https://github.com/nodejs/node-gyp#on-windows). -## Installation +## Installing -### Global installation - -To install the utility use [npm](https://www.npmjs.org/) command `install`: +To install the utility, use the [npm](https://www.npmjs.org/) `install` command: ```sh npm install -g gemini ``` -Global installation is used for commands launch. - -### Local installation - -To write the tests you will also need local installation of `Gemini`. Run the -following command in project directory: - -```sh -npm install gemini -``` +Global installation is used for launching commands. -## Configuration +## Configuring -**Gemini** is configured using config file at the root of the project. -Gemini can use one of the next files: +**Gemini** is configured using a config file at the root of the project. +Gemini can use one of the following files: * `.gemini.conf.js` * `.gemini.conf.json` * `.gemini.conf.yml` @@ -90,10 +133,10 @@ Gemini can use one of the next files: * `.gemini.json` * `.gemini.yml` -Lets say we want to run our tests only in locally installed `PhantomJS`. +Let's say we want to run our tests only in the locally installed `PhantomJS`. -In this case, the minimal configuration file will need to have only the root url -of your web app and WebDriver capabilities of `PhantomJS`: +In this case, the minimal configuration file will only need to have the root URL +of your web app and the WebDriver capabilities of `PhantomJS`: For example, ```yaml @@ -104,14 +147,14 @@ browsers: browserName: phantomjs ``` -Also, you need to run `PhantomJS` manually in a `WebDriver` mode: +Also, you need to run `PhantomJS` manually in `WebDriver` mode: ``` phantomjs --webdriver=4444 ``` -In case you are using remote WebDriver server, you can specify its URL with +If you are using a remote WebDriver server, you can specify its URL with the `gridUrl` option: ```yaml @@ -153,14 +196,14 @@ browsers: ### Other configuration options -[See the details](doc/config.md) of a config file structure and available +[See the details](doc/config.md) of the config file structure and available options. ## Writing tests Each of the blocks that are being tested may be in one of the determined states. -States are tested with the help of chains of step-by-step actions declared in -test suites of a block. +States are tested with the help of chains of step-by-step actions declared in a block's +test suites. For example, let's write a test for a search block at [yandex.com](http://www.yandex.com): @@ -168,63 +211,49 @@ For example, let's write a test for a search block at ```javascript gemini.suite('yandex-search', function(suite) { suite.setUrl('/') - .setCaptureElements('.main-table') + .setCaptureElements('.search2__input') .capture('plain') .capture('with text', function(actions, find) { - actions.sendKeys(find('.input__control'), 'hello gemini'); + actions.sendKeys(find('.search2__input .input__control'), 'hello gemini'); }); }); ``` -We create a new test suite `yandex-search` and assume that we will capture the -`.main-table` element from a root URL `http://yandex.com`. We know that the +We are creating a new test suite `yandex-search`, assuming that we will capture the +`.search2__input` element from the root URL `http://yandex.com`. We know that the block has two states: -* `plain` – right after the page is loaded; -* `with text` – with `hello gemini` text inserted into `.input__control`. +* `plain` — right after the page is loaded +* `with text` — with the `hello gemini` text inserted into `.search2__input .input__control` -States are executed one after another in order of definition without browser -reload in between. +States are executed one after another in the order in which they are defined, without the browser +reloading in between. -[See the details](doc/tests.md) of tests creation methods. +[See the details](doc/tests.md) of test creation methods. ## Using CLI -To complete the test creation procedure you need to take reference shots using +To complete the test creation procedure, you need to take reference shots using the following command: ``` gemini update [paths to test suites] ``` -For test launch (to compare current state of a block with a reference shot) use +To launch a test (to compare the current state of a block with a reference shot), use the command: ``` gemini test [paths to test suites] ``` -To see the difference between current state of a block and a reference picture -more clearly, use HTML reporter: - -``` -gemini test --reporter html [paths to test suites] -``` -When all tests are performed, you will see a link to an HTML report. - -You can use both console and HTML reporters at the same time: - -``` -gemini test --reporter html --reporter flat [paths to test suites] -``` - [See the details](doc/commands.md) of interaction with CLI and available options. ## GUI -Instead of a command line you can use graphical user interface of `Gemini`. It -is located in [gemini-gui](https://github.com/gemini-testing/gemini-gui) package +You can use the `Gemini` graphical user interface instead of the command line. It +is located in the [gemini-gui](https://github.com/gemini-testing/gemini-gui) package and must be installed additionally: ``` @@ -233,18 +262,18 @@ npm install -g gemini-gui GUI advantages: -* Handy reference shots preview; +* Handy preview of reference shots -* Clear real-time demonstration of differences between a reference shot and - current state of a block; +* Clear real-time demonstration of the differences between a reference shot and + the current state of a block -* Easy update of reference shots. +* Easy to update reference shots ## Plugins -Gemini can be extended with plugins. You could choose from the [existing +Gemini can be extended with plugins. You can choose from the [existing plugins](https://www.npmjs.com/browse/keyword/gemini-plugin) or [write your -own](doc/plugins.md). To use the plugin, install and enable it in your +own](doc/plugins.md). To use a plugin, install and enable it in your `.gemini.yml`: ```yaml @@ -254,7 +283,19 @@ system: plugin-option: value ``` +## HTML report + +To see the difference between the current state of a block and a reference picture +more clearly, use the [HTML reporter](https://github.com/gemini-testing/html-reporter) - plugin for gemini. This +plugin produces HTML report, which displays reference image, current image and +differences between them, for each state in each browser. When all tests are +completed, you will see a link to HTML report. + ## Programmatic API -To use Gemini in your scripts or build tools you can use experimental +To use Gemini in your scripts or build tools, you can use the experimental [programmatic API](doc/programmatic-api.md). + +## Events + +To learn more about all events in Gemini, see the [events documentation](doc/events.md). diff --git a/SUMMARY.md b/SUMMARY.md new file mode 100644 index 000000000..ddd9f8a5e --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,13 @@ +# Summary + +* [Introduction](README.md) +* [Configuration](doc/config.md) +* [Command-line interface](doc/commands.md) +* [Tests API](doc/tests.md) +* [Programmatic API](doc/programmatic-api.md) +* [Events](doc/events.md) +* [Plugins API](doc/plugins.md) +* [Plugins list](https://www.npmjs.com/browse/keyword/gemini-plugin) +* [Contributing](CONTRIBUTING.md) +* [Changelog](CHANGELOG.md) +* [CLA](CLA.md) diff --git a/book.json b/book.json new file mode 100644 index 000000000..2ade22dbb --- /dev/null +++ b/book.json @@ -0,0 +1,15 @@ +{ + "gitbook": "3.2.0", + "title": "Gemini", + "description": "Visual regression testing tool", + "plugins": ["edit-link", "github", "advanced-emoji"], + "pluginsConfig": { + "edit-link": { + "base": "https://github.com/gemini-testing/gemini/edit/master", + "label": "Edit on github" + }, + "github": { + "url": "https://github.com/gemini-testing/gemini" + } + } +} diff --git a/doc/commands.md b/doc/commands.md index c292ce1a9..efe246fdd 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -24,8 +24,8 @@ By default, this command will do two things: Also, you can run this command with options: - * `--diff` - update only existing images, states with no reference images will be ignored; - * `--new` - generate only missing images. + * `--diff` — update only existing images, states with no reference images will be ignored; + * `--new` — generate only missing images. If no paths are specified, each `.js` file from `gemini` directory will be processed. By default, configuration will be loaded from `.gemini.yml` in the @@ -33,7 +33,7 @@ current directory. To specify other config, use `--config` or `-c` option. ## Running tests -To compare you reference screenshots with current state of blocks, use: +To compare your reference screenshots with current state of blocks, use: ``` gemini test [paths to suites] @@ -44,26 +44,16 @@ Paths and configuration are treated the same way as in `update` command. Each state with appearance different from reference image will be treated as the failed test. -By default, only names of the states are listed in shell. To get more -information you can use HTML reporter: - -`gemini test --reporter html [paths to suites]` - -This will produce an HTML file in `gemini-report` directory. It will display -reference image, current image and differences between them, for each state in -each browser. - -Available reporters are: +By default, only names of the states are listed in shell, but you can use available +reporters: * `flat` (default console reporter); * `vflat` (verbose console reporter); -* `html` for HTML report. -You can also use multiple reporters at the same time using multiple -`--reporter` options: +You can choose them using option `--reporter`: ``` -gemini test --reporter flat --reporter html +gemini test --reporter vflat ``` ### CSS code coverage (experimental) @@ -75,18 +65,24 @@ report), partially (yellow) or was not captured at all (red). ## Common CLI options -* `--config`, `-c` – specify config file to use. +* `--config`, `-c` — specify config file to use. -* `--grep PATTERN` – execute only suites with names that match the regular +* `--grep PATTERN` — execute only suites with names that match the regular expression pattern. + For example: + - `--grep 'suite name'` - execute suites which includes name `suite name` + - `--grep '^(?!suite name)'` - execute suites which do not start with `suite name` * `--browser ID` — execute suite only for specified browser id. Can be used - multiple times. Can be also specified with `GEMINI_BROWSERS` environment - variable. If both CLI option and env variable are set, CLI has precedence. + multiple times. Can be also specified with `GEMINI_BROWSERS` and `GEMINI_SKIP_BROWSERS` + environment variables (browsers should be separated by a comma). If both CLI option + and env variable are set, CLI has precedence. + +* `--set`, `-s` — specify set to run -* `--help` – display help message. +* `--help` — display help message. -* `--version` – display version. +* `--version` — display version. ## Overriding config options diff --git a/doc/config.md b/doc/config.md index 3c6e3d3d4..42c56ae97 100644 --- a/doc/config.md +++ b/doc/config.md @@ -1,20 +1,28 @@ # Gemini configuration -**Gemini** is configured using `.gemini.yml` file at the root of the project. +In the following example **gemini** is configured using `.gemini.yml` file at the root of the project. +But you can use one of the files specified in [configuring section](../readme.md#configuring). Complete example with all available settings looks like this, but you'll need to specify only a few settings specific for your project: ```yaml rootUrl: https://example.com/root -gridUrl: http://webdriber.example.com +gridUrl: http://webdriver.example.com desiredCapabilities: commonThing: value calibrate: false tolerance: 3.5 +antialiasingTolerance: 0, +compareOpts: + stopOnFirstFail: false +buildDiffOpts: + ignoreAntialiasing: true + ignoreCaret: true httpTimeout: 5000 sessionRequestTimeout: 60000 -screenshotsDir: './screens' +sessionQuitTimeout: 5000 +screenshotsDir: ./screens windowSize: 1600x1080 sessionsPerBrowser: 2 suitesPerSession: 100 @@ -28,7 +36,7 @@ browsers: firefox-latest: rootUrl: https://example.com/special-for-ff - screenshotsDir: './ff-screens' + screenshotsDir: ./ff-screens calibrate: true desiredCapabilities: version: "31.0" @@ -50,10 +58,14 @@ sets: system: projectRoot: ../project sourceRoot: ../project/src + tempDir: ./temp-images + exclude: + - node_modules/** plugins: teamcity: true debug: true parallelLimit: 3 + workers: 4 diffColor: '#ff0000' coverage: enabled: true @@ -69,23 +81,32 @@ system: There is a `system` section in the config file, which contains global `gemini` settings. These settings can not be set per-browser. -* `projectRoot` – root directory of a project. All relative paths in config or +* `projectRoot` — root directory of a project. All relative paths in config or options will be resolved relatively to it. By default it is the directory config file is placed in. -* `sourceRoot` – directory which contains the source files. Local sources +* `sourceRoot` — directory which contains the source files. Local sources will be used in the coverage report when the source map is available, but the sources can not be downloaded via URLs from the test pages. By default, it is equal to `projectRoot`. -* `tempDir` – directory to save temporary images (current states) to. This +* `tempDir` — directory to save temporary images (current states) to. This directory should exist. Gemini will create own temp directory in it with name starting with `.gemini.tmp.` where all temporary images will be saved. After run created directory will be removed. If not set system temp directory will be used. -* `plugins` - list of plugins to enable. Should have form of `pluginName: - settings`. For example: +* `exclude` — array of glob patterns to exclude paths from the test search. For example: + +```yaml +exclude: + - node_modules/** + - gemini/helpers/** + - foo/{bar,baz}/*.js +``` + +* `plugins` — list of plugins to enable. Should have form of `pluginName: + settings`. For example: ```yaml plugins: @@ -95,28 +116,37 @@ settings. These settings can not be set per-browser. password: pass ``` - Each plugin should be an installed npm package named `gemini-`. + Each plugin should be an installed npm package. -* `debug` – turn on debug logging to the terminal. +* `debug` — turn on debug logging to the terminal. -* `parallelLimit` – by default, `gemini` will run all browsers simultaneously. +* `parallelLimit` — by default, `gemini` will run all browsers simultaneously. Sometimes (i.e. when using cloud services, such as SauceLabs) you have a limit of a number of browser that can be run once at a time. Use this option to limit the number of browsers that `gemini` will try to run in parallel. -* `diffColor` – specifies color which will be used to highlight differences +* `workers` — by default, `gemini` will run as many parallel + workers as cores available, this option allows you to limit it. + +* `diffColor` — specifies color which will be used to highlight differences between images. Specified in hexadecimal RGB (`#RRGGBB`). Magenta by default (`#FF00FF`). -* `coverage` - `gemini` can gather and report CSS tests coverage. It supports +* `coverage` — `gemini` can gather and report CSS tests coverage. It supports source maps, so you can get the report even if you are using preprocessor or minifier. The JSON and html reports are saved to `gemini-coverage` directory. There are many settings under this section: - - `enabled` – set to `true` to enable coverage reporting. + - `enabled` — set to `true` to enable coverage reporting. - - `exclude` – array of file paths or glob patterns to exclude from coverage + - `map` — function which can be used for overriding default logic of source root path resolving. + By default it returns path to CSS file relative to the source root. + This function accepts 2 arguments: + * `url` — full url of source file which coverage should be obtained + * `rootUrl` — root url specified in the config for current browser + + - `exclude` — array of file paths or glob patterns to exclude from coverage report. For example: ```yaml @@ -125,10 +155,11 @@ settings. These settings can not be set per-browser. exclude: - libs/** - path/to/some.css - - ``` - - `html` - set to false to disable html report and save only JSON. + - `html` — set to false to disable html report and save only JSON. + +* `ctx` — a context which will be available in tests via method `gemini.ctx`. ## Browsers settings @@ -153,70 +184,103 @@ for constructing screens file names. Settings list: -* `rootUrl` (required) – the root URL of your website. Target URLs of your - test suites will be resolved relatively to it. +* `rootUrl` (required) — the root URL of your website. Target URLs of your + test suites will be resolved relatively to it. If top level `rootUrl` value is set + and browser `rootUrl` — is relative url, then resolved `rootUrl` will be result of + concatenation of top level `rootUrl` and individual browser `rootUrl`. -* `desiredCapabilities` (required) - WebDriver +* `desiredCapabilities` (required) — WebDriver [DesiredCapabilites](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities) for the browser. Per-browser value will be merged with top-level value instead of overriding it. -* `gridUrl` – WebDriver URL to use for taking screenshots. By default is +* `gridUrl` — WebDriver URL to use for taking screenshots. By default is http://localhost:4444/wd/hub -* `calibrate` - does this browser need to perform the calibration procedure. +* `calibrate` — does this browser need to perform the calibration procedure. This procedure allows to correctly capture the image in case the particular WebDriver implementation captures browser UI along with web page. Enabled by default. If you are sure this is not the case for your WebDriver, you can disable it by setting this option to `false`. -* `httpTimeout` - timeout for HTTP requests to WebDriver, milliseconds. By +* `httpTimeout` — timeout for HTTP requests to WebDriver, milliseconds. By default the server timeout is used. -* `sessionRequestTimeout` - timeout for getting of browser sessions, milliseconds. By default the value of option `httpTimeout` is used. +* `sessionRequestTimeout` — timeout for getting of browser sessions, milliseconds. By default the value of option `httpTimeout` is used. + +* `sessionQuitTimeout` — timeout for closing browser sessions, milliseconds. By default the value of option `httpTimeout` is used. -* `screenshotsDir` – directory to save reference screenshots to. +* `screenshotsDir` — directory to save reference screenshots to. `/gemini/screens` by default. -* `tolerance` - indicates maximum allowed +* `tolerance` — indicates maximum allowed [CIEDE2000](http://en.wikipedia.org/wiki/Color_difference#CIEDE2000) difference between colors. Used only in non-strict mode. By default it's 2.3 which should be enough for the most cases. Increasing global default is not recommended, prefer changing tolerance for particular suites or states instead. -* `windowSize` – specify browser window dimensions (i.e. `1600x1200`). If not +* `antialiasingTolerance` — read about this option in [looks-same](https://github.com/gemini-testing/looks-same#comparing-images-with-ignoring-antialiasing). + +* `compareOpts` — extra options for comparing images. See [looks-same](https://github.com/gemini-testing/looks-same#comparing-images) documentation for the list of available options. Default values are: +```javascript +compareOpts: { + stopOnFirstFail: false +} +``` + +#### buildDiffOpts +Extra options for building diff image. See [looks-same](https://github.com/gemini-testing/looks-same#building-diff-image) documentation for the list of available options. Default values are: +```javascript +buildDiffOpts: { + ignoreAntialiasing: true, + ignoreCaret: true +} +``` + +* `windowSize` — specify browser window dimensions (i.e. `1600x1200`). If not specified, the size of the window depends on WebDriver. :warning: You can't set specific resolutions for browser Opera or mobile platforms. They use only full-screen resolution. -* `sessionsPerBrowser` - how many WebDriver sessions can be launched +* `sessionsPerBrowser` — how many WebDriver sessions can be launched simultaneously for this browser. Default is 1. Increase the value if you want to speed up your tests. -* `suitesPerSession` - maximum amount of test suites to run in each web driver +* `suitesPerSession` — maximum amount of test suites to run in each web driver session. After limit is reached, session gets closed and new session gets started. By default is `.inf` (no limit). Set to smaller number if you are experiencing stability problems. -* `retry` – maximum amount of relaunch fallen tests with a critical error. If not +* `retry` — maximum amount of relaunch fallen tests with a critical error. If not specified, the fallen tests will not be relaunched (by default it's 0). - Note that fallen test will not be retried immediately, it will be delayed until - all tests finish and then restarted in new browser session. So the tests will be - performed in waves: - - run all tests - - first retry: run tests failed during all tests run - - second retry: run tests failed during first retry - - ... + Note that the same test never be performed in the same browser session. -* `screenshotMode` - image capture mode. There are 3 allowed values for this option: +* `shouldRetry` — function which defines whether to make a retry. Should returns `Boolean` value. First argument is `data` which is the result of the test run, it's an Object with following fields: + * `attempt {Number}` number of retries performed for the test + * `retriesLeft {Number}` number of retries left + * `[equal] {Boolean}` notice that if the test fails with critical error equal can be absent + +* `screenshotMode` — image capture mode. There are 3 allowed values for this option: * `auto` (default). Mode will be obtained automatically. * `fullpage`. Gemini will deal with screenshot of full page. * `viewport`. Only viewport area will be used. -* `compositeImage` – allows testing of regions which bottom bounds are outside of a viewport height (default: `false`). +* `compositeImage` — allows testing of regions which bottom bounds are outside of a viewport height (default: `false`). In the resulting screenshot the area which fits the viewport bounds will be **joined** with the area which is outside of the viewport height. + :warning: Option does not work in Opera@12.16. + +* `screenshotDelay` — allows to specify a delay (in milliseconds) before making any screenshot. + By default there is no delay. + + This is useful when the page has elements which are animated. + +* `orientation` – browser orientation that will be set before each test run. It is useful to restore the default browser orientation after test execution in which orientation was changed. There are 3 allowed values for this option: + * `null` (default). No action will be taken. + * `landscape`. Orientation will be changed to landscape mode before running the test. + * `portrait`. Orientation will be changed to portrait mode before running the test. + ## Sets You can link some set of tests with certain browsers using `sets`. @@ -233,11 +297,13 @@ sets: ... ``` -* `files` - list of test files or directories with test files. Should be relative to project root directory. `gemini` by default. Can be a string if you want to specify just one file or directory. +* `files` — list of test files or directories with test files. Should be relative to project root directory. Also, you can use masks for this property. For example: `gemini/test-suites/*.gemini.js`. Can be a string if you want to specify just one file or directory. + +* `browsers` — list of browser ids to run tests specified in `files`. All browsers by default. -* `browsers` - list of browser ids to run tests specified in `files`. All browsers by default. +If sets are not specified in config, all files from `gemini` directory will be launched in all browsers specified in a config. -If no sets specified then default set named `all` with all defaults will be created. +You can specify sets to run using CLI option [`--set`](./commands.md#common-cli-options). ## Overriding settings @@ -266,7 +332,7 @@ To save screenshots for IE9 to different location (considering you have browser with `ie9` id in the config): ``` -gemini update --browsers-ie9-screenshots-dir ./ie9-screens +gemini update --browsers-ie-9-screenshots-dir ./ie9-screens ``` To override setting with environment variable, convert its full path to diff --git a/doc/events.md b/doc/events.md new file mode 100644 index 000000000..ac3d94479 --- /dev/null +++ b/doc/events.md @@ -0,0 +1,294 @@ +# Gemini events + +Events are listed in order they are emitted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EventDescription
CLI +Emitted right at start, before cli is parsed. Allows to add new commands and extend help message. +Event is emitted with 1 argument parser which is the +commander +instance used inside gemini itself. +
INIT +Emitted before any job start (test, update or readTests). +If handler returns a promise, then job will start only after the promise is resolved. +Emitted only once no matter how many times job is performed. +
BEFORE_FILE_READ +Emitted before each test file is read. Event is emitted with 1 argument filePath, +which is the absolute path to the file to be read. +
AFTER_FILE_READ +Emitted after each test file has been read. Event is emitted with 1 argument filePath +which is the absolute path to the file that was read. +
AFTER_TESTS_READ +Emitted after all tests were read (during test, update or readTests call). +Event is emitted with 1 argument data: +
+{
+    suiteCollection // suite collection with all suites parsed from test files
+}
+
+
START_RUNNER +Emitted before the start of test or update command. +If you return a promise from the event handler, the start of the command will be delayed until the promise resolves. +
BEGIN +Runner event. Emitted on runner start with 1 argument data: +
+{
+    suiteCollection, // suite collection which will be run
+    config,          // gemini config
+    totalStates,     // number of states in collection
+    browserIds       // all browser ids from config
+}
+
+
BEGIN_SUITE +Emitted before decide if should test suite in specified browser. Event is emitted with 1 argument data: +
+{
+    suite,
+    browserId
+}
+
+
SKIP_STATE +Emitted if browser is skipped in this state. Event is emitted with 1 argument data: +
+{
+    suite,
+    state,
+    browserId
+}
+
+
START_BROWSER +Emitted on browser session start. Emitted with +browser instance. +If handler returns a promise, tests will be executed in this session only after the promise is resolved. +
BEGIN_STATE +Emitted before launching browser for test. Event is emitted with 1 argument data: +
+{
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
UPDATE_RESULT +Emitted always during update. Event is emitted with 1 argument result: +
+{
+    refImg,    // reference image info which includes absolute path and size (width, height)
+    updated,   // shows if reference image has been changed
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
RETRY +Emitted if test has failed but there is still number of retries left. +Event is emitted with 1 argument result: +
+{
+    refImg,        // reference image info which includes absolute path and size (width, height)
+    currImg,       // current image info which includes absolute path and size (width, height)
+    equal,         // always false for retries
+    tolerance,     // specified for current test or globally in .gemini.js
+    saveDiffTo,    /* function responsible for building diff and present
+                      in the result only if images aren't equal */
+    attempt,       // number of retry for browser in current test
+    retriesLeft,   /* number of left retries > 0, when number hits 0
+                      event TEST_RESULT is called instead */
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
TEST_RESULT +Emitted always after the test is completed. Event is emitted with 1 argument result: +
+{
+    refImg,        // reference image info which includes absolute path and size (width, height)
+    currImg,       // current image info which includes absolute path and size (width, height)
+    equal,         // shows if images are equal
+    tolerance,     // specified for current test or globally in .gemini.js
+    saveDiffTo,    /* function responsible for building diff and present
+                      in the result only if images aren't equal */
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
END_STATE +Emitted right after UPDATE_RESULT and TEST_RESULT with 1 argument data: +
+{
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
STOP_BROWSER +Emitted right before browser session end. Emitted with +browser instance. +If handler returns a promise, quit will be performed only after the promise is resolved. +
END_SUITE +Emitted right after suite is skipped or tested in specified browser. Emitted with 1 argument data: +
+{
+    suite,     // tested suite
+    browserId, // skipped or tested browser
+}
+
+
ERROR +Emitted with 1 argument err, which is an instance of Error +and has additional fields depending on the cause of error. + +For example, if Reference image is missing, err will have additional fields: + +
+{
+    refImg,
+    currImg,
+    suite,
+    state,
+    browserId,
+    sessionId
+}
+
+
INTERRUPT +Emitted on signal events SIGHUP, SIGINT or SIGTERM. +The event is emitted with 1 argument data – {exitCode}, wich is +
    +
  • 129 for SIGHUP +
  • 130 for SIGINT +
  • 143 for SIGTERM +
+
END +Emitted when all tests are completed with 1 argument stat, which contains statistics for tests. + +For example: + +
+{
+    total: 6,
+    updated: 0,
+    passed: 2,
+    failed: 1,
+    skipped: 3,
+    retries: 8
+}
+
+
END_RUNNER +Emitted after the end of the test or update command. +
diff --git a/doc/plugins.md b/doc/plugins.md index 169fbacc2..6974e05a5 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -2,11 +2,17 @@ Gemini plugin is just an npm package with a `gemini-` name. Module should export a single function which receives `Gemini` class instance -and user-specified options. For example: +and user-specified options. +`Gemini` instance contains two fields: +* `config` — current config with specified options +* `events` — all emitted events, which can be used by plugins +For example: ```js module.exports = function(gemini, options) { console.log('Hello from plugin'); + console.log('Show me config: ', gemini.config); + console.log('Show me all events: ', gemini.events); }; ``` diff --git a/doc/programmatic-api.md b/doc/programmatic-api.md index 0313c53e3..9f66539cd 100644 --- a/doc/programmatic-api.md +++ b/doc/programmatic-api.md @@ -35,15 +35,17 @@ console.log(gemini.config.rootUrl); ## Reading the tests -`gemini.readTests(paths, grep)` – read all of the tests from specified paths into +`gemini.readTests(paths, options)` — read all of the tests from specified paths into one suite collection. * `paths` is an array of files or directories paths containing Gemini tests. If not specified, will look for tests in `$projectRoot/gemini` directory. -* `grep` is a regular expression to filter suites to read. By default, all tests - will be read. If this option is set, only suites with name matching the - pattern will be read. +Options: + +* `grep` — regular expression to filter suites to read. By default, all tests + will be added to collection. If this option is set, only suites with name matching the + pattern will be added to collection. Returns promise which resolves to a `SuiteCollection` object. @@ -68,29 +70,29 @@ Also SuiteCollection object is returned by `gemini.readTests` method. SuiteCollection API: -* `SuiteCollection([suites])` - constructor. +* `SuiteCollection([suites])` — constructor. Takes optional `suites` parameter, these are the top level suites. -* `add(suite)` - add suite to collection. +* `add(suite)` — add suite to collection. -* `topLevelSuites()` - return array of top level suites. +* `topLevelSuites()` — return array of top level suites. -* `allSuites()` - return array of all suites in collection. Goes through all suites +* `allSuites()` — return array of all suites in collection. Goes through all suites children recursively. -* `disableAll()` - disable all suites in collection +* `disableAll()` — disable all suites in collection -* `enableAll()` - enable all suites in collection +* `enableAll()` — enable all suites in collection -* `disable(suite, [opts])` - disable suite and all its children +* `disable(suite, [opts])` — disable suite and all its children `suite` can be a real suite object, or suite full name `opts` are optional: - * `opts.browser` - browser to disable suite in - * `opts.state` - disable only specified state + * `opts.browser` — browser to disable suite in + * `opts.state` — disable only specified state -* `enable(suite, [opts])` - enable suite and all its children. Arguments are the same as in +* `enable(suite, [opts])` — enable suite and all its children. Arguments are the same as in `disable` Example on how to run only certain states in certain browsers: @@ -110,24 +112,24 @@ return gemini.test(collection); Suite objects have the following properties: -* `id` – unique numeric identificator of the suite. Automatically generated +* `id` — unique numeric identificator of the suite. Automatically generated when loading suites. -* `name` – the name of the suite. +* `name` — the name of the suite. -* `children` – array of subsuites of the current suite. +* `children` — array of subsuites of the current suite. -* `states` – array of the `State` objects, defined in a suite. +* `states` — array of the `State` objects, defined in a suite. ### State Suite objects have the following properties: -* `name` – the name of the state. +* `name` — the name of the state. Methods: -* `shouldSkip(browserId)` – returns `true` if this state should be skipped for +* `shouldSkip(browserId)` — returns `true` if this state should be skipped for a browser. ## Updating reference screenshots @@ -140,28 +142,29 @@ or `SuiteCollection` instance. Options: -* `reporters` – array of reporters to use. Each element can be either string +* `reporters` — array of reporters to use. Each element can be either string (to use corresponding built-in reporter) or reporter function (to use a custom reporter). -* `grep` – regular expression to filter suites to run. By default, all tests +* `grep` — regular expression to filter suites to run. By default, all tests will be executed. If this option is set, only suites with name matching the pattern will be executed. * `browsers` — array of browser ids to execute tests in. By default, tests are executed in all browsers, specified in config. -* `diff`(Boolean) - update only existing images with some diff, states with no reference images will be ignored. +* `sets` — array of set names to execute tests in. By default, tests are + executed for all sets, specified in config. -* `new`(Boolean) - generate only missing images. +* `diff`(Boolean) — update only existing images with some diff, states with no reference images will be ignored. -Returns promise that resolve to a stats object with following keys: +* `new`(Boolean) — generate only missing images. -* `total` – total number of tests executed. +Returns promise that resolve to a stats object with following keys: -* `skipped` – number of skipped tests. +* `total` — total number of tests executed. -* `errored` – number of errored tests. +* `skipped` — number of skipped tests. Rejects promise if critical error occurred. @@ -174,44 +177,70 @@ or `SuiteCollection` instance. Options: -* `reporters` – array of reporter to use. Each element can be either string +* `reporters` — array of reporter to use. Each element can be either string (to use corresponding built-in reporter) or reporter function (to use a custom reporter). -* `grep` – regular expression to filter suites to run. By default, all tests +* `grep` — regular expression to filter suites to run. By default, all tests will be executed. If this option is set, only suites with name matching the pattern will be executed. * `browsers` — array of browser ids to execute tests in. By default, tests are executed in all browsers, specified in config. +* `sets` — array of set names to execute tests in. By default, tests are + executed for all sets, specified in config. + Returns promise that resolve to a stats object with following keys: -* `total` – total number of tests executed. -* `skipped` – number of skipped tests. -* `errored` – number of errored tests. -* `passed` – number of passed tests. -* `failed` – number of failed tests. +* `total` — total number of tests executed. + +* `skipped` — number of skipped tests. + +* `passed` — number of passed tests. + +* `failed` — number of failed tests. Rejects promise if critical error occurred. +## Halting + +```js +gemini.halt(error, [timeout=60000ms]); +``` + +Method for abnormal termination of the test run in case of a terminal error. If process fails to gracefully shutdown in `timeout` milliseconds, it would be forcibly terminated (unless `timeout` is explicitly set to `0`). + ## Utilites -* `gemini.getScreenshotPath(suite, stateName, browserId)` – returns path to +* `gemini.getScreenshotPath(suite, stateName, browserId)` — returns path to the reference screenshot of the specified state for specified browser. -* `gemini.getBrowserCapabilites(browserId)` – returns WebDriver capabilities +* `gemini.getBrowserCapabilites(browserId)` — returns WebDriver capabilities for specified `browserId`. -* `gemini.browserIds` – list of all browser identificators to use for tests. +* `gemini.browserIds` — list of all browser identificators to use for tests. + +* `Gemini.readRawConfig` — reads configuration file for specified `filePath` +and returns content as JS object. This method does not validate and analyze +gemini configuration. ## Events `gemini` instance emits some events, which can be used by external scripts or -plugins: +plugins. -* `startRunner` - emitted before the start of `test` or `update` command. If - you return a promise from the event handler, the start of the command will - be delayed until the promise resolves. +[See the details](../doc/events.md) about available events. -* `endRunner` - emitted after the end of the `test` or `update` command. +Plugin example with the listening on the events: +```javascript +module.exports = (gemini, options) => { + gemini.on(gemini.events.START_RUNNER, () => { + return setUp(gemini.config, options.param); // config can be mutated + }); + + gemini.on(gemini.events.END_RUNNER, () => { + return tearDown(); + }); +}; +``` diff --git a/doc/tests.md b/doc/tests.md index 932537e62..2998ed42d 100644 --- a/doc/tests.md +++ b/doc/tests.md @@ -34,20 +34,20 @@ gemini.suite('button', function(suite) { Arguments of a `gemini.suite`: -* `name` – the name of the new test suite. Name is displayed in reports and - affects screenshots filenames. +* `name` — the name of the new test suite. Name is displayed in reports and + affects screenshots filenames. **Important** Name of test suite can not be empty. -* `callback(suite)` – callback, used to set up the suite. Receives a suite +* `callback(suite)` — callback, used to set up the suite. Receives a suite builder instance (described below). ## Suite builder methods All methods are chainable: -* `setUrl(url)` – specifies address of a web page to take screenshots from. +* `setUrl(url)` — specifies address of a web page to take screenshots from. URL is relative to `rootUrl` config field. -* `setCaptureElements('selector1', 'selector2', ...})` – specifies CSS +* `setCaptureElements('selector1', 'selector2', ...})` — specifies CSS selectors of the elements that will be used to determine a region of a web page to capture. @@ -62,65 +62,26 @@ All methods are chainable: All tests in a suite will fail if none of the elements will be found. -* `ignoreElements('selector1', 'selector2', ...)` - elements, matching +* `ignoreElements('.selector1', {every: '.selector2'}, ...)` — elements, matching specified selectors will be ignored when comparing images. + - `.selector1` — Ignore only the first matched element. + - `{every: '.selector2'}` — Ignore all matched elements. -* `setTolerance(value)` - overrides global tolerance value for the whole suite +* `setTolerance(value)` — overrides global tolerance value for the whole suite (See `tolerance`option description in [config](./config.md) documentation for details). -* `skip([browser])` – skip all tests and nested suites for: - - - `skip()` – all browsers; - - - `skip('id')` – browser with specified `id`; - - - `skip('id', comment)` – browser with specified `id` and show `comment` in the report; - - - `skip(/some RegExp/)` – browser with `id` which matches `/some RegExp/`; - - - `skip(/some RegExp/, comment)` – browser with `id` which matches `/some RegExp/` and show `comment` in the report; - - - `skip(['id1', /RegExp1/, ...])` – multiple browsers; - - - `skip(['id1', /RegExp1/, ...], comment)` – multiple browsers and show `comment` in the report. - - All browsers from subsequent calls to `.skip()` are added to the skip list: - - ```js - suite - .skip('id1') - .skip(/RegExp1/); - ``` - - is equivalent to - - ```js - suite.skip([ - 'id1', - /RegExp1/ - ]); - ``` - -* `browsers([browser])` – run all tests and nested suites in specified browsers: - - - `browsers('id')` – browser with specified `id`; - - - `browsers(/some RegExp/)` – browser `id` which matches `/some RegExp/`; - - - `browsers(['id1', /RegExp1/, ...])` – multiple browsers. - -* `capture(stateName, [options], callback(actions, find))` – defines a new +* `capture(stateName, [options], callback(actions, find))` — defines a new state to capture. Optional callback describes a sequence of actions to bring the page to this state, starting from a **previous** state of the suite. States are executed one after another in order of definition without browser reload in between. Callback accepts two arguments: - * `actions` – chainable object that should be used to specify a series of + * `actions` — chainable object that should be used to specify a series of actions to perform. - * `find(selector)` – use this function to search for an element to act on. + * `find(selector)` — use this function to search for an element to act on. Search is lazy and actually will be performed the first time element is needed. Search will be performed once for each `find` call, so if you need to perform multiple actions on the same element, save the result to @@ -145,7 +106,7 @@ All methods are chainable: See `tolerance`option description in [config](./config.md) documentation for details. -* `before(callback(actions, find))` – use this function to execute some code +* `before(callback(actions, find))` — use this function to execute some code before the first state. The arguments of a callback are the same as for `capture` callback. Context is shared between `before` callback and all of suite's state callbacks, so you can use this hook to lookup for an element @@ -164,9 +125,75 @@ All methods are chainable: }); ``` -* `after(callback(actions, find))` – use this function to execute some code +* `after(callback(actions, find))` — use this function to execute some code after the last state. The arguments of a callback are the same as for `capture` and `before` callbacks and context is shared between all of them. + +### Skip tests + +Sometimes you need to skip tests in specific browsers. For example, tested features +are not available in some browsers yet. + +* `skip.in([browser])` — skip all tests and nested suites for: + + - `skip.in('id')` — browser with specified `id`; + + - `skip.in('id', comment)` — browser with specified `id` and show `comment` in the report; + + - `skip.in(/some RegExp/)` — browser with `id` which matches `/some RegExp/`; + + - `skip.in(/some RegExp/, comment)` — browser with `id` which matches `/some RegExp/` + and show `comment` in the report; + + - `skip.in(['id1', /RegExp1/, ...])` — multiple browsers; + + - `skip.in(['id1', /RegExp1/, ...], comment)` — multiple browsers and show `comment` in the report. + + To skip all tests in suite you can use `skip.in(/.*/)`. + + All browsers from subsequent calls to `.skip.in` are added to the skip list: + + ```js + suite + .skip.in('id1') + .skip.in(/RegExp1/); + ``` + + is equivalent to + + ```js + suite.skip.in([ + 'id1', + /RegExp1/ + ]); + ``` + +* ~`skip([browser])`~ — _deprecated_. +Works the same way as `skip.in`, except to skip all tests you can also write `skip()`. + +* `skip.notIn([browser])` — skip all tests and nested suites for all browsers, +except ones in the arguments. Accepts same arguments as `skip.in`. + +To skip test silently, use `only.in` function. This way, skipped browsers will not appear in the report. + +* `only.in([browser])` — run all tests and nested suites in specified browsers: + + - `only.in('id')` — browser with specified `id`; + + - `only.in(/some RegExp/)` — browser `id` which matches `/some RegExp/`; + + - `only.in('id1', /RegExp1/, ...)` — multiple browsers, also accepts an array as argument. + +* ~`browsers([browser])`~ — _deprecated_. Use `only.in` instead. + +* `only.notIn([browser])` — run all tests and nested suites in all browsers, except +ones in the arguments. Accepts same arguments as `only.in`. + +For example: +```js +suite.only.in(['chrome', 'firefox']); +suite.only.notIn(/ie/, 'opera'); +``` ## Nested suites @@ -178,7 +205,7 @@ browser, even if URL was not changed. ```js gemini.suite('parent', function(parent) { parent.setUrl('/some/path') - .setCaptureElements('.selector1', '.selector2'); + .setCaptureElements('.selector1', '.selector2') .capture('state'); gemini.suite('first child', function(child) { @@ -192,7 +219,7 @@ gemini.suite('parent', function(parent) { child.setCaptureElements('.next-selector') .capture('third state', function(actions, elements) { // ... - }) + }); gemini.suite('grandchild', function(grandchild) { //child suites can have own childs @@ -204,7 +231,7 @@ gemini.suite('parent', function(parent) { gemini.suite('third child', function(child) { //this suite uses completely different URL and set of elements child.setUrl('/some/another/path') - .setCaptureElements('.different-selector'); + .setCaptureElements('.different-selector') .capture('fifth state'); }); }); @@ -218,30 +245,30 @@ and next step is always executed after previous one has completed. In the following list `element` can be either CSS selector or result of a `find` call: -* `click(element)` – mouse click at the center of the element. +* `click(element)` — mouse click at the center of the element. -* `doubleClick(element)` – mouse double click at the center of the element. +* `doubleClick(element)` — mouse double click at the center of the element. -* `mouseDown(element, [button])` – press a mouse button at the center of the - element. Possible button values are: 0 – left, 1 – middle, 2 – right. By +* `mouseDown(element, [button])` — press a mouse button at the center of the + element. Possible button values are: 0 — left, 1 — middle, 2 — right. By default, left button is used. -* `mouseUp([element], [button])` – release previously pressed mouse button. If +* `mouseUp([element], [button])` — release previously pressed mouse button. If element is specified, move mouse to element and release then. -* `mouseMove(element, [offset])` – move mouse to the given element. Offset is +* `mouseMove(element, [offset])` — move mouse to the given element. Offset is specified relatively to the top left corner of the element. If not specified, mouse will be moved to the center of the element. -* `dragAndDrop(element, dragTo)` – drag `element` to other `dragTo` element. +* `dragAndDrop(element, dragTo)` — drag `element` to other `dragTo` element. -* `flick(speed, swipe)` - flick starting anywhere on the screen using +* `flick(speed, swipe)` — flick starting anywhere on the screen using `speed.x` and `speed.y` speed. -* `flick(offsets, speed, element)` - flick element with starting point at its +* `flick(offsets, speed, element)` — flick element with starting point at its center by `offsets.x` and `offset.y` offsets. -* `executeJS(function(window))` – run specified function in a browser. The +* `executeJS(function(window))` — run specified function in a browser. The argument of a function is the browser's `window` object: ```js @@ -253,25 +280,27 @@ call: Note that function is executed in a browser context, so any references to outer scope of callback won't work. -* `wait(milliseconds)` – wait for specified amount of time before next action. + :warning: `window.scrollTo` does not work in Opera@12.16 (see [details](https://github.com/operasoftware/operaprestodriver/issues/108)). + +* `wait(milliseconds)` — wait for specified amount of time before next action. If it is the last action in sequence, delay the screenshot for this amount of time. -* `waitForElementToShow(selector, [timeout])` - waits until element, matched +* `waitForElementToShow(selector, [timeout])` — waits until element, matched by `selector` will become visible. Fails if element does not appear after `timeout` milliseconds (1000 by default). -* `waitForElementToHide(selector, [timeout])` - waits until element, matched +* `waitForElementToHide(selector, [timeout])` — waits until element, matched by `selector` will become invisible or will be completely removed from DOM. Fails if element still visible after `timeout` milliseconds (1000 by default). -* `waitForJSCondition(function(window), timeout)` - waits until specified +* `waitForJSCondition(function(window), timeout)` — waits until specified function return `true`. Function will be executed in browser context, so any references to outer scope won't work. Fails if after `timeout` milliseconds function still returns `false` (1000 by default). -* `sendKeys([element], keys)` - send a series of keyboard strokes to the +* `sendKeys([element], keys)` — send a series of keyboard strokes to the specified element or currently active element on a page. You can send a special key using one of the provided constants, i.e: @@ -292,14 +321,37 @@ Full list of special keys (there are shortcuts for commonly used keys): `DIVIDE`, `F1`, `F2`, `F3`, `F4`, `F5`, `F6`, `F7`, `F8`, `F9`, `F10`, `F11`, `F12`, `COMMAND` ⇔ `META`, `ZENKAKU_HANKAKU`. -* `sendFile(element, path)` – send file to the specified `input[type=file]` +* `sendFile(element, path)` — send file to the specified `input[type=file]` element. `path` must exist at local system (the one which `gemini` is executed on). -* `focus(element)` – set a focus to a specified element. +* `focus(element)` — set a focus to a specified element. + +* `setWindowSize(width, height)` — change browser window dimensions. :warning: You can't set specific resolutions for browser Opera or mobile platforms. They use only full-screen resolution. + +* `tap(element)` — tap specified element on touch enabled device. + +* `changeOrientation()` — change orientation on touch enabled device (from `PORTRAIT` to `LANDSCAPE` and vice versa). :warning: Does not work on mobile emulation. -* `setWindowSize(width, height)` – change browser window dimensions. :warning: You can't set specific resolutions for browser Opera or mobile platforms. They use only full-screen resolution. +## Passing a context to tests -* `tap(element)` - tap specified element on touch enabled device. +Add `system.ctx` field to your configuration file: + +```js +module.exports = { + // ... + system: { + ctx: { + foo: 'bar' + } + } +}; +``` + +`ctx` will be available in tests via `gemini.ctx` method: + +```js +console.log(gemini.ctx); // {foo: 'bar'} +``` -* `changeOrientation()` – change orientation on touch enabled device (from `PORTRAIT` to `LANDSCAPE` and vice versa). :warning: Does not work on mobile emulation. +**Recommendation**: use `ctx` in your tests in favor of global variables. diff --git a/lib/browser-pool.js b/lib/browser-pool.js new file mode 100644 index 000000000..5481d8d5d --- /dev/null +++ b/lib/browser-pool.js @@ -0,0 +1,40 @@ +'use strict'; + +const {BrowserPool, Calibrator} = require('gemini-core'); +const Browser = require('./browser'); +const Events = require('./constants/events'); + +exports.create = function(config, emitter) { + const calibrator = new Calibrator(); + + const BrowserManager = { + create: (id) => Browser.create(config.forBrowser(id)), + + start: (browser) => browser.launch(calibrator), + onStart: (browser) => emitter.emitAndWait(Events.START_BROWSER, browser), + + onQuit: (browser) => emitter.emitAndWait(Events.STOP_BROWSER, browser), + quit: (browser) => browser.quit() + }; + + const configAdapter = { + forBrowser: (id) => { + const browserConfig = config.forBrowser(id); + return { + parallelLimit: browserConfig.sessionsPerBrowser, + sessionUseLimit: browserConfig.suitesPerSession + }; + }, + + getBrowserIds: () => config.getBrowserIds(), + + get system() { + return config.system; + } + }; + + return BrowserPool.create(BrowserManager, { + logNamespace: 'gemini', + config: configAdapter + }); +}; diff --git a/lib/browser-pool/basic-pool.js b/lib/browser-pool/basic-pool.js deleted file mode 100644 index d77711473..000000000 --- a/lib/browser-pool/basic-pool.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; -var util = require('util'), - Browser = require('../browser'), - Pool = require('./pool'), - signalHandler = require('../signal-handler'), - _ = require('lodash'), - Q = require('q'); - -var activeSessions = {}; - -/** - * @constructor - * @extends BasicPool - * @param {Config} config - * @param {Calibrator} calibrator - */ -function BasicPool(config, calibrator) { - this._config = config; - this._calibrator = calibrator; -} - -util.inherits(BasicPool, Pool); - -Pool.prototype.getBrowser = function(id) { - var _this = this, - browser = Browser.create(this._config.forBrowser(id)), - launchPromise = browser.launch(this._calibrator); - - activeSessions[browser.id] = { - browser: browser, - launchPromise: launchPromise - }; - - return launchPromise - .then(browser.reset.bind(browser)) - .thenResolve(browser) - .fail(function(e) { - return _this.freeBrowser(browser) - .then(function() { - return Q.reject(e); - }); - }); -}; - -Pool.prototype.freeBrowser = function(browser) { - delete activeSessions[browser.id]; - return browser.quit(); -}; - -signalHandler.on('exit', function() { - console.log('Killing browsers...'); - return _(activeSessions) - .map(function(session) { - var quit_ = session.browser.quit.bind(session.browser); - return Q.when(session.launchPromise, quit_); - }) - .thru(Q.all) - .value(); -}); - -module.exports = BasicPool; diff --git a/lib/browser-pool/caching-pool.js b/lib/browser-pool/caching-pool.js deleted file mode 100644 index 2af5c4274..000000000 --- a/lib/browser-pool/caching-pool.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; -var q = require('q'), - util = require('util'), - Pool = require('./pool'), - LimitedUseSet = require('./limited-use-set'), - log = require('debug')('gemini:pool:caching'); - -/** - * @constructor - * @extends BasicPool - * @param {BasicPool} underlyingPool - */ -function CachingPool(config, underlyingPool) { - this.underlyingPool = underlyingPool; - this._caches = {}; - var _this = this, - freeBrowser = underlyingPool.freeBrowser.bind(underlyingPool); - - config.getBrowserIds().forEach(function(id) { - var browserConfig = config.forBrowser(id); - // browser does not get put in a set on first usages, so if - // we want to limit it usage to N times, we must set N-1 limit - // for the set. - _this._caches[id] = new LimitedUseSet(browserConfig.suitesPerSession - 1, freeBrowser); - }); -} - -util.inherits(CachingPool, Pool); - -CachingPool.prototype.getBrowser = function(id) { - log('request for %s', id); - var browser = this._caches[id].pop(); - if (!browser) { - log('no cached browser, requesting new'); - return this.underlyingPool.getBrowser(id); - } - - log('has cached browser %o', browser); - return browser.reset() - .fail(function(e) { - var reject = q.reject.bind(null, e); - return this.underlyingPool.freeBrowser(browser) - .then(reject, reject); - }.bind(this)) - .thenResolve(browser); -}; - -/** - * Free browser - * @param {Browser} browser session instance - * @param {Object} [options] - advanced options - * @param {Boolean} [options.noMoreRequests] - flag which indicates that browser - * should be really freed or put into sessions cache - * @returns {Promise} - */ -CachingPool.prototype.freeBrowser = function(browser, options) { - log('free %o', browser); - const shouldBeFreed = options && options.noMoreRequests; - return shouldBeFreed - ? this.underlyingPool.freeBrowser(browser) - : this._caches[browser.id].push(browser); -}; - -CachingPool.prototype.cancel = function() { - log('cancel'); - this.underlyingPool.cancel(); -}; - -module.exports = CachingPool; diff --git a/lib/browser-pool/index.js b/lib/browser-pool/index.js deleted file mode 100644 index e622a0ad4..000000000 --- a/lib/browser-pool/index.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -var _ = require('lodash'), - BasicPool = require('./basic-pool'), - LimitedPool = require('./limited-pool'), - PerBrowserLimitedPool = require('./per-browser-limited-pool'), - CachingPool = require('./caching-pool'), - Calibrator = require('../calibrator'); - -/** - * @param {Config} config - * @returns {BasicPool} - */ -exports.create = function(config) { - var calibrator = new Calibrator(), - pool = new BasicPool(config, calibrator); - - pool = new CachingPool(config, pool); - pool = new PerBrowserLimitedPool(config, pool); - - if (_.isFinite(config.system.parallelLimit)) { - pool = new LimitedPool(config.system.parallelLimit, pool); - } - - return pool; -}; - -exports.CancelledError = LimitedPool.CancelledError; diff --git a/lib/browser-pool/limited-pool.js b/lib/browser-pool/limited-pool.js deleted file mode 100644 index ccdad07f7..000000000 --- a/lib/browser-pool/limited-pool.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict'; -var util = require('util'), - Pool = require('./pool'), - q = require('q'), - log = require('debug')('gemini:pool:limited'); - -/** - * @constructor - * @extends BasicPool - * @param {Number} limit - * @param {BasicPool} underlyingPool - */ -function LimitedPool(limit, underlyingPool) { - this.underlyingPool = underlyingPool; - this._limit = limit; - this._launched = 0; - this._requests = 0; - this._deferQueue = []; -} - -util.inherits(LimitedPool, Pool); - -LimitedPool.prototype.getBrowser = function(id) { - log('get browser %s (launched %d, limit %d)', id, this._launched, this._limit); - - ++this._requests; - return this._getBrowser(id).catch((e) => { - --this._requests; - return q.reject(e); - }); -}; - -LimitedPool.prototype._getBrowser = function(id) { - if (this._canLaunchBrowser) { - log('can launch one more'); - this._launched++; - return this._newBrowser(id); - } - - log('queuing the request'); - const defer = q.defer(); - this._deferQueue.unshift({id, defer}); - - log('queue length: %d', this._deferQueue.length); - return defer.promise; -}; - -Object.defineProperty(LimitedPool.prototype, '_canLaunchBrowser', { - get: function() { - return this._launched < this._limit; - } -}); - -/** - * @param {String} id - * @returns {Promise.} - */ -LimitedPool.prototype._newBrowser = function(id) { - log('launching new browser', id); - return this.underlyingPool.getBrowser(id) - .fail(function(e) { - this._launchNextBrowser(); - return q.reject(e); - }.bind(this)); -}; - -LimitedPool.prototype.freeBrowser = function(browser) { - log('free browser', browser); - --this._requests; - return this.underlyingPool.freeBrowser(browser, {noMoreRequests: this._launched > this._requests}) - .fin(this._launchNextBrowser.bind(this)); -}; - -/** - * @returns {Boolean} - */ -LimitedPool.prototype._launchNextBrowser = function() { - var queued = this._deferQueue.pop(); - if (queued) { - log('has queued requests'); - log('remaining queue length: %d', this._deferQueue.length); - this._newBrowser(queued.id) - .then(queued.defer.resolve, queued.defer.reject); - } else { - this._launched--; - } -}; - -LimitedPool.prototype.cancel = function() { - log('cancel'); - this._deferQueue.forEach(function(entry) { - entry.defer.reject(new CancelledError()); - }); - - this._deferQueue.length = 0; - this.underlyingPool.cancel(); -}; - -function CancelledError() { - this.name = 'CancelledError'; - this.message = 'Browser request was cancelled'; - Error.captureStackTrace(this, CancelledError); -} - -util.inherits(CancelledError, Error); - -module.exports = exports = LimitedPool; -exports.CancelledError = CancelledError; diff --git a/lib/browser-pool/limited-use-set.js b/lib/browser-pool/limited-use-set.js deleted file mode 100644 index 7d925a451..000000000 --- a/lib/browser-pool/limited-use-set.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; -var q = require('q'), - log = require('debug')('gemini:pool:limited-use-set'); - -/** - * Set implementation which allows to get and put an object - * there only limited amout of times. After limit is reached - * attempt to put an object there causes the object to be finalized. - * - * @constructor - * @param {Number} useLimit number of times object can be popped from set - * before finalizing. - * @param {Function} finalize callback which will be called when value in - * set needs to be finalized. - */ -function LimitedUseSet(useLimit, finalize) { - this._useCounts = new WeakMap(); - this._useLimit = useLimit; - this._finalize = finalize; - this._objects = []; -} - -LimitedUseSet.prototype.push = function(value) { - log('push', value); - if (this._isOverLimit(value)) { - log('over limit, finalizing'); - return this._finalize(value); - } - log('under limit'); - this._objects.push(value); - return q(); -}; - -LimitedUseSet.prototype._isOverLimit = function(value) { - if (this._useLimit === 0) { - return true; - } - return this._useCounts.has(value) && this._useCounts.get(value) >= this._useLimit; -}; - -LimitedUseSet.prototype.pop = function() { - if (this._objects.length === 0) { - return null; - } - var result = this._objects.pop(), - useCount = this._useCounts.get(result) || 0; - log('popping %o', result); - log('previous use count %d', useCount); - this._useCounts.set(result, useCount + 1); - return result; -}; - -module.exports = LimitedUseSet; diff --git a/lib/browser-pool/per-browser-limited-pool.js b/lib/browser-pool/per-browser-limited-pool.js deleted file mode 100644 index abe4402b7..000000000 --- a/lib/browser-pool/per-browser-limited-pool.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -var util = require('util'), - _ = require('lodash'), - Pool = require('./pool'), - LimitedPool = require('./limited-pool'), - log = require('debug')('gemini:pool:per-browser-limited'); - -function PerBrowserLimitedPool(config, underlyingPool) { - var browserPools = {}; - config.getBrowserIds().forEach(function(id) { - var browserConfig = config.forBrowser(id); - browserPools[id] = new LimitedPool(browserConfig.sessionsPerBrowser, underlyingPool); - }); - this._browserPools = browserPools; -} - -util.inherits(PerBrowserLimitedPool, Pool); - -PerBrowserLimitedPool.prototype.getBrowser = function(id) { - log('request %s', id); - return this._browserPools[id].getBrowser(id); -}; - -PerBrowserLimitedPool.prototype.freeBrowser = function(browser) { - log('free %o', browser); - return this._browserPools[browser.id].freeBrowser(browser); -}; - -PerBrowserLimitedPool.prototype.cancel = function() { - log('cancel'); - - _.each(this._browserPools, function(pool) { - pool.cancel(); - }); -}; - -module.exports = PerBrowserLimitedPool; diff --git a/lib/browser-pool/pool.js b/lib/browser-pool/pool.js deleted file mode 100644 index 4f4c81bf2..000000000 --- a/lib/browser-pool/pool.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -var q = require('q'); -/** - * @constructor - */ -function BasicPool() { -} - -/** - * @param {String} id - * @returns {Promise.} - */ -BasicPool.prototype.getBrowser = function(id) { -}; - -/** - * @param {Browser} browser - * @returns {Promise} - */ -BasicPool.prototype.freeBrowser = function(browser) { - return q.resolve(); -}; - -BasicPool.prototype.cancel = function() { -}; - -module.exports = BasicPool; diff --git a/lib/browser/browser.js b/lib/browser/browser.js index 1fc366c02..00b0cbc54 100644 --- a/lib/browser/browser.js +++ b/lib/browser/browser.js @@ -1,26 +1,35 @@ 'use strict'; -var wd = require('wd'), - _ = require('lodash'), - Camera = require('./camera'); +const _ = require('lodash'); +const Promise = require('bluebird'); +const {browser: {Camera}} = require('gemini-core'); +const wd = require('./wd-bluebird'); module.exports = class Browser { constructor(config) { this.config = config; this.id = config.id; this._wd = wd.promiseRemote(config.gridUrl); - this._camera = new Camera(this._wd, config.screenshotMode); + this._camera = Camera.create(config.screenshotMode, () => this._takeScreenshot()); this.sessionId = null; - this._calibration = null; } captureViewportImage(page) { - return this._camera.captureViewportImage(page); + return Promise.delay(this.config.screenshotDelay) + .then(() => this._camera.captureViewportImage(page)); } serialize() { - const props = ['id', 'gridUrl', 'httpTimeout', 'screenshotMode', 'compositeImage']; + const props = [ + 'id', + 'gridUrl', + 'httpTimeout', + 'screenshotMode', + 'screenshotDelay', + 'compositeImage', + 'orientation' + ]; return { config: _.pick(this.config, props), @@ -30,7 +39,11 @@ module.exports = class Browser { } scrollBy(x, y) { - return this._camera.scroll(x, y); + return this._wd.execute(`window.scrollBy(${x},${y})`); + } + + toString() { + return `${this.id}[${this.sessionId}]`; } _setCalibration(calibration) { @@ -42,15 +55,41 @@ module.exports = class Browser { return this._configureHttp(this.config.httpTimeout); } - _setSessionRequestTimeout() { - const sessionRequestTimeout = _.isNull(this.config.sessionRequestTimeout) - ? this.config.httpTimeout - : this.config.sessionRequestTimeout; + _configureHttp(timeout) { + return this._wd.configureHttp({retries: 'never', timeout}); + } - return this._configureHttp(sessionRequestTimeout); + _takeScreenshot() { + return this._tryScreenshotMethod('_takeScreenshotWithCurrentContext') + .catch((originalError) => { + return this._tryScreenshotMethod('_takeScreenshotWithNativeContext') + .catch(() => { + // if _takeScreenshotWithNativeContext fails too, the original error + // most likely was not related to the different Appium contexts and + // it is more useful to report it instead of second one + return Promise.reject(originalError); + }); + }); } - _configureHttp(timeout) { - return this._wd.configureHttp({retries: 'never', timeout}); + _tryScreenshotMethod(method) { + return this[method]() + .then((screenshot) => { + this._takeScreenshot = this[method]; + return screenshot; + }); + } + + _takeScreenshotWithCurrentContext() { + return this._wd.takeScreenshot(); + } + + _takeScreenshotWithNativeContext() { + return this._wd.currentContext() + .then((oldContext) => { + return this._wd.context('NATIVE_APP') + .then(() => this._takeScreenshotWithCurrentContext()) + .finally(() =>this._wd.context(oldContext)); + }); } }; diff --git a/lib/browser/camera.js b/lib/browser/camera.js deleted file mode 100644 index e9086e7b5..000000000 --- a/lib/browser/camera.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -var Image = require('../image'), - inherit = require('inherit'), - q = require('q'), - _ = require('lodash'), - util = require('./util'); - -module.exports = inherit({ - __constructor: function(wdRemote, screenshotMode) { - this._wdRemote = wdRemote; - this._screenshotMode = screenshotMode; - }, - - calibrate: function(calibration) { - this._calibration = calibration; - }, - - captureViewportImage: function(page) { - var _this = this; - return this._tryScreenshotMethod('_takeScreenshot', page) - .fail(function(originalError) { - return _this._tryScreenshotMethod('_takeScreenshotWithNativeContext', page) - .fail(function() { - // if _takeScreenshotWithNativeContext fails too, the original error - // most likely was not related to the different Appium contexts and - // it is more useful to report it instead of second one - return q.reject(originalError); - }); - }); - }, - - scroll: function(x, y) { - return this._wdRemote.execute(`window.scrollBy(${x},${y})`); - }, - - _tryScreenshotMethod: function(method, page) { - var _this = this; - return this[method](page) - .then(function(screenshot) { - _this.captureViewportImage = _this[method]; - return screenshot; - }); - }, - - _takeScreenshot: function(page) { - var _this = this; - return this._wdRemote.takeScreenshot() - .then(function(base64) { - var image = Image.fromBase64(base64); - return _this._applyCalibration(image); - }) - .then(function(image) { - return _this._cropToViewport(image, page); - }); - }, - - _takeScreenshotWithNativeContext: function(page) { - var _this = this; - return this._wdRemote.currentContext() - .then(function(oldContext) { - return _this._wdRemote.context('NATIVE_APP') - .then(_this._takeScreenshot.bind(_this, page)) - .fin(function() { - return _this._wdRemote.context(oldContext); - }); - }); - }, - - _applyCalibration: function(image) { - if (!this._calibration) { - return image; - } - - return image.crop({ - left: this._calibration.left, - top: this._calibration.top, - width: image.getSize().width - this._calibration.left, - height: image.getSize().height - this._calibration.top - }); - }, - - _cropToViewport: function(image, page) { - if (!page) { - return image; - } - - const isFullPage = util.isFullPage(image, page, this._screenshotMode); - let cropArea = _.clone(page.viewport); - - if (this._screenshotMode === 'viewport' || !isFullPage) { - cropArea = _.extend(cropArea, { - top: 0, - left: 0 - }); - } - - return image.crop(cropArea, {scaleFactor: page.pixelRatio}); - } -}); diff --git a/lib/browser/client-bridge.js b/lib/browser/client-bridge.js deleted file mode 100644 index 41e0ac011..000000000 --- a/lib/browser/client-bridge.js +++ /dev/null @@ -1,82 +0,0 @@ -'use strict'; - -var util = require('util'), - q = require('q'), - - StateError = require('../errors/state-error'), - - NO_CLIENT_FUNC = 'ERRNOFUNC'; - -/** - * @param {Browser} browser - * @param {String} script - * @constructor - */ -function ClientBridge(browser, script) { - this._browser = browser; - this._script = script; -} - -/** - * @param {String} name - * @param {Array} [args] - */ -ClientBridge.prototype.call = function(name, args) { - args = args || []; - return this._callCommand(this._clientMethodCommand(name, args), true); -}; - -/** - * @param {String} command - * @param {Boolean} shouldInject - */ -ClientBridge.prototype._callCommand = function(command, injectAllowed) { - var _this = this; - return this._browser.evalScript(command) - .then(function(result) { - if (!result || !result.error) { - return q.resolve(result); - } - - if (result.error !== NO_CLIENT_FUNC) { - return q.reject(new StateError(result.message)); - } - - if (injectAllowed) { - return _this._inject() - .then(function() { - return _this._callCommand(command, false); - }); - } - return q.reject(new StateError('Unable to inject gemini client script')); - }); -}; - -/** - * @param {String} name - * @param {Array} args - */ -ClientBridge.prototype._clientMethodCommand = function(name, args) { - var call = util.format('__gemini.%s(%s)', - name, - args.map(JSON.stringify).join(', ') - ); - return this._guardClientCall(call); -}; - -/** - * @param {String} call - */ -ClientBridge.prototype._guardClientCall = function(call) { - return util.format( - 'typeof __gemini !== "undefined"? %s : {error: "%s"}', - call, - NO_CLIENT_FUNC - ); -}; - -ClientBridge.prototype._inject = function() { - return this._browser.injectScript(this._script); -}; - -module.exports = ClientBridge; diff --git a/lib/browser/client-bridge/client-bridge-decorator.js b/lib/browser/client-bridge/client-bridge-decorator.js new file mode 100644 index 000000000..7c19c1a92 --- /dev/null +++ b/lib/browser/client-bridge/client-bridge-decorator.js @@ -0,0 +1,24 @@ +'use strict'; + +const Promise = require('bluebird'); +const {errors: {ClientBridgeError}} = require('gemini-core'); +const StateError = require('../../errors/state-error'); + +module.exports = class ClientBridgeDecorator { + static create(clientBridge) { + return new ClientBridgeDecorator(clientBridge); + } + + constructor(clientBridge) { + this._clientBridge = clientBridge; + } + + call(name, args) { + return this._clientBridge.call(name, args) + .catch((e) => { + e = e instanceof ClientBridgeError ? new StateError(e.message) : e; + + return Promise.reject(e); + }); + } +}; diff --git a/lib/browser/client-bridge/index.js b/lib/browser/client-bridge/index.js new file mode 100644 index 000000000..42776012a --- /dev/null +++ b/lib/browser/client-bridge/index.js @@ -0,0 +1,9 @@ +'use strict'; + +const {clientBridge} = require('gemini-core'); +const ClientBridgeDecorator = require('./client-bridge-decorator'); + +exports.build = (browser, opts) => { + return clientBridge.build(browser, opts) + .then((clientBridge) => ClientBridgeDecorator.create(clientBridge)); +}; diff --git a/lib/browser/client-scripts/gemini.calibrate.js b/lib/browser/client-scripts/gemini.calibrate.js deleted file mode 100644 index 45a4bdaf8..000000000 --- a/lib/browser/client-scripts/gemini.calibrate.js +++ /dev/null @@ -1,52 +0,0 @@ -(function(window) { - 'use strict'; - - // HACK: ie8 does not need to reset the body border, - // while any other browser does. - // This hack is obsolete in standards mode, but - // calibration script is executed on about:blank - // which is in quirks mode. - // Needs to find a proper way to open calibration - // page in standards mode. - function needsResetBorder() { - return !/MSIE 8\.0/.test(navigator.userAgent); - } - - function resetZoom() { - var meta = document.createElement('meta'); - meta.name = 'viewport'; - meta.content = 'width=device-width,initial-scale=1.0,user-scalable=no'; - document.getElementsByTagName('head')[0].appendChild(meta); - } - - function createPattern() { - var bodyStyle = document.body.style; - bodyStyle.margin = 0; - bodyStyle.padding = 0; - - if (needsResetBorder()) { - bodyStyle.border = 0; - } - - bodyStyle.backgroundColor = '#96fa00'; - } - - function getBrowserFeatures() { - var features = { - hasCSS3Selectors: true, - pixelRatio: window.devicePixelRatio, - innerWidth: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth - }; - try { - document.querySelector('body:nth-child(1)'); - } catch (e) { - features.hasCSS3Selectors = false; - } - - return features; - } - - resetZoom(); - createPattern(); - return getBrowserFeatures(); -}(window)); diff --git a/lib/browser/client-scripts/gemini.coverage.js b/lib/browser/client-scripts/gemini.coverage.js deleted file mode 100644 index fdeefb9cd..000000000 --- a/lib/browser/client-scripts/gemini.coverage.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict'; - -var util = require('./util'), - coverageLevel = require('../../coverage-level'), - rect = require('./rect'), - query = require('./query'); - -exports.collectCoverage = function collectCoverage(rect) { - var coverage = {}, - sheets = document.styleSheets; - for (var i = 0; i < sheets.length; i++) { - var href = sheets[i].href, - rules = getRules(sheets[i]); - - if (rules.ignored) { - coverage[href] = rules; - continue; - } - var ctx = { - // media rule counter - // coverage for media rules is stored by its index within stylesheet - media: -1, - href: href, - coverage: coverage - }; - for (var r = 0; r < rules.length; r++) { - coverageForRule(rules[r], rect, ctx); - } - } - - return coverage; -}; - -function getRules(styleSheet) { - try { - return styleSheet.cssRules || styleSheet.rules; - } catch (e) { - if (e.name === 'SecurityError') { - return { - ignored: true, - message: 'Unable to read stylesheet rules due to the same origin policy' - }; - } - throw e; - } -} - -function coverageForRule(rule, area, ctx) { - if (rule.cssRules || rule.styleSheet) { - if (rule.conditionText) { - ctx.media++; - if (!window.matchMedia(rule.conditionText).matches) { - return; - } - } - - var rules = rule.cssRules || rule.styleSheet.cssRules; - for (var r = 0; r < rules.length; r++) { - coverageForRule(rules[r], area, ctx); - } - - return; - } - - if (!rule.selectorText) { - return; - } - - util.each(rule.selectorText.split(','), function(selector) { - selector = selector.trim(); - var coverage = coverageLevel.NONE, - matches = query.all(selector); - - var re = /:{1,2}(?:after|before|first-letter|first-line|selection)(:{1,2}\w+)?$/; - // if selector contains pseudo-elements cut it off and try to find element without it - if (matches.length === 0 && re.test(selector)) { - var newSelector = selector.replace(re, '$1').trim(); - - if (newSelector.length > 0) { - matches = query.all(newSelector); - } - } - - if (matches.length > 0) { - for (var match = 0; match < matches.length; match++) { - var newCoverage = coverageForElem(matches[match], area); - coverage = coverageLevel.merge(coverage, newCoverage); - } - } - - var byURL = ctx.coverage[ctx.href] = ctx.coverage[ctx.href] || {}; - if (rule.parentRule && rule.parentRule.conditionText) { - selector = '?' + ctx.media + ':' + selector; - } - - byURL[selector] = coverageLevel.merge(byURL[selector], coverage); - }); -} - -function coverageForElem(elem, captureRect) { - var elemRect = rect.getAbsoluteClientRect(elem); - if (captureRect.rectInside(elemRect)) { - return coverageLevel.FULL; - } else if (captureRect.rectIntersects(elemRect)) { - return coverageLevel.PARTIAL; - } - return coverageLevel.NONE; -} diff --git a/lib/browser/client-scripts/gemini.js b/lib/browser/client-scripts/gemini.js deleted file mode 100644 index 001120de1..000000000 --- a/lib/browser/client-scripts/gemini.js +++ /dev/null @@ -1,237 +0,0 @@ -/*jshint browserify:true*/ -'use strict'; - -var util = require('./util'), - rect = require('./rect'), - query = require('./query'), - Rect = rect.Rect; - -if (typeof window === 'undefined') { - global.__gemini = exports; -} else { - window.__gemini = exports; -} - -exports.query = query; - -// Terminology -// - clientRect - the result of calling getBoundingClientRect of the element -// - extRect - clientRect + outline + box shadow -// - elementCaptureRect - sum of extRects of the element and its pseudo-elements -// - captureRect - sum of all elementCaptureRect for each captureSelectors - -exports.prepareScreenshot = function prepareScreenshot(selectors, opts) { - opts = opts || {}; - try { - return prepareScreenshotUnsafe(selectors, opts); - } catch (e) { - return { - error: 'JS', - message: e.stack || e.message - }; - } -}; - -function prepareScreenshotUnsafe(selectors, opts) { - var rect = getCaptureRect(selectors); - if (rect.error) { - return rect; - } - - var viewportHeight = document.documentElement.clientHeight, - viewportWidth = document.documentElement.clientWidth, - documentHeight = document.documentElement.scrollHeight, - documentWidth = document.documentElement.scrollWidth, - coverage, - viewPort = new Rect({ - left: util.getScrollLeft(), - top: util.getScrollTop(), - width: viewportWidth, - height: viewportHeight - }), - pixelRatio = opts.usePixelRatio === false? 1 : window.devicePixelRatio; - - if (!viewPort.rectInside(rect)) { - window.scrollTo(rect.left, rect.top); - } - - if (opts.coverage) { - coverage = require('./gemini.coverage').collectCoverage(rect); - } - - return { - captureArea: rect.serialize(), - ignoreAreas: findIgnoreAreas(opts.ignoreSelectors), - viewport: { - top: util.getScrollTop(), - left: util.getScrollLeft(), - width: Math.round(viewportWidth), - height: Math.round(viewportHeight) - }, - documentHeight: Math.round(documentHeight), - documentWidth: Math.round(documentWidth), - coverage: coverage, - canHaveCaret: isEditable(document.activeElement), - pixelRatio: pixelRatio - }; -} - -exports.resetZoom = function() { - var meta = query.first('meta[name="viewport"]'); - if (!meta) { - meta = document.createElement('meta'); - meta.name = 'viewport'; - query.first('head').appendChild(meta); - } - meta.content = 'width=device-width,initial-scale=1.0,user-scalable=no'; -}; - -function getCaptureRect(selectors) { - var element, elementRect, rect; - for (var i = 0; i < selectors.length; i++) { - element = query.first(selectors[i]); - if (!element) { - return { - error: 'NOTFOUND', - message: 'Could not find element with css selector specified in setCaptureElements: ' + selectors[i], - selector: selectors[i] - }; - } - - elementRect = getElementCaptureRect(element); - if (elementRect) { - rect = rect? rect.merge(elementRect) : elementRect; - } - } - - return rect? rect.round() : { - error: 'HIDDEN', - message: 'Area with css selector : ' + selectors + ' is hidden', - selector: selectors - }; -} - -function findIgnoreAreas(selectors) { - var result = []; - util.each(selectors, function(selector) { - var element = query.first(selector); - if (element) { - var rect = getElementCaptureRect(element); - if (rect) { - result.push(rect.round().serialize()); - } - } - }); - - return result; -} - -function isHidden(css, clientRect) { - return css.display === 'none' || - css.visibility === 'hidden' || - css.opacity < 0.0001 || - clientRect.width < 0.0001 || - clientRect.height < 0.0001; -} - -function getElementCaptureRect(element) { - var pseudo = [':before', ':after'], - css = window.getComputedStyle(element), - clientRect = rect.getAbsoluteClientRect(element); - - if (isHidden(css, clientRect)) { - return null; - } - - var elementRect = getExtRect(css, clientRect); - - util.each(pseudo, function(pseudoEl) { - css = window.getComputedStyle(element, pseudoEl); - elementRect = elementRect.merge(getExtRect(css, clientRect)); - }); - - return elementRect; -} - -function getExtRect(css, clientRect) { - var shadows = parseBoxShadow(css.boxShadow), - outline = parseInt(css.outlineWidth, 10); - - if (isNaN(outline)) { - outline = 0; - } - - return adjustRect(clientRect, shadows, outline); -} - -function parseBoxShadow(value) { - value = value || ''; - var regex = /[-+]?\d*\.?\d+px/g, - values = value.split(','), - results = [], - match; - - util.each(values, function(value) { - if ((match = value.match(regex))) { - results.push({ - offsetX: parseFloat(match[0]), - offsetY: parseFloat(match[1]) || 0, - blurRadius: parseFloat(match[2]) || 0, - spreadRadius: parseFloat(match[3]) || 0, - inset: value.indexOf('inset') !== -1 - }); - } - }); - return results; -} - -function adjustRect(rect, shadows, outline) { - var shadowRect = calculateShadowRect(rect, shadows), - outlineRect = calculateOutlineRect(rect, outline); - return shadowRect.merge(outlineRect); -} - -function calculateOutlineRect(rect, outline) { - return new Rect({ - top: Math.max(0, rect.top - outline), - left: Math.max(0, rect.left - outline), - bottom: rect.bottom + outline, - right: rect.right + outline - }); -} - -function calculateShadowRect(rect, shadows) { - var extent = calculateShadowExtent(shadows); - return new Rect({ - left: Math.max(0, rect.left + extent.left), - top: Math.max(0, rect.top + extent.top), - width: rect.width - extent.left + extent.right, - height: rect.height - extent.top + extent.bottom - }); -} - -function calculateShadowExtent(shadows) { - var result = {top: 0, left: 0, right: 0, bottom: 0}; - - util.each(shadows, function(shadow) { - if (shadow.inset) { - //skip inset shadows - return; - } - - var blurAndSpread = shadow.spreadRadius + shadow.blurRadius; - result.left = Math.min(shadow.offsetX - blurAndSpread, result.left); - result.right = Math.max(shadow.offsetX + blurAndSpread, result.right); - result.top = Math.min(shadow.offsetY - blurAndSpread, result.top); - result.bottom = Math.max(shadow.offsetY + blurAndSpread, result.bottom); - }); - return result; -} - -function isEditable(element) { - if (!element) { - return false; - } - return /^(input|textarea)$/i.test(element.tagName) || - element.isContentEditable; -} diff --git a/lib/browser/client-scripts/query.native.js b/lib/browser/client-scripts/query.native.js deleted file mode 100644 index f41e8afdf..000000000 --- a/lib/browser/client-scripts/query.native.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -exports.first = function(selector) { - return document.querySelector(selector); -}; - -exports.all = function(selector) { - return document.querySelectorAll(selector); -}; diff --git a/lib/browser/client-scripts/query.sizzle.js b/lib/browser/client-scripts/query.sizzle.js deleted file mode 100644 index 460964b94..000000000 --- a/lib/browser/client-scripts/query.sizzle.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; -/*jshint newcap:false*/ -var Sizzle = require('sizzle'); - -exports.first = function(selector) { - var elems = Sizzle(selector.trim() + ':first'); - return elems.length > 0? elems[0] : null; -}; - -exports.all = function(selector) { - return Sizzle(selector); -}; diff --git a/lib/browser/client-scripts/rect.js b/lib/browser/client-scripts/rect.js deleted file mode 100644 index 4413ea4c2..000000000 --- a/lib/browser/client-scripts/rect.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict'; - -var util = require('./util'); - -function Rect(data) { - this.top = data.top; - this.left = data.left; - - if ('width' in data && 'height' in data) { - this.width = data.width; - this.height = data.height; - this.bottom = data.bottom || this.top + this.height; - this.right = data.right || this.left + this.width; - } else if ('bottom' in data && 'right' in data) { - this.bottom = data.bottom; - this.right = data.right; - this.width = data.right - data.left; - this.height = data.bottom - data.top; - } else { - throw new Error('Not enough data for the rect construction'); - } -} - -Rect.prototype = { - constructor: Rect, - merge: function(otherRect) { - return new Rect({ - left: Math.min(this.left, otherRect.left), - top: Math.min(this.top, otherRect.top), - bottom: Math.max(this.bottom, otherRect.bottom), - right: Math.max(this.right, otherRect.right) - }); - }, - - translate: function(x, y) { - return new Rect({ - top: this.top + y, - left: this.left + x, - width: this.width, - height: this.height - }); - }, - - pointInside: function(x, y) { - return x >= this.left && x <= this.right && - y >= this.top && y <= this.bottom; - }, - - rectInside: function(rect) { - return util.every(rect._keyPoints(), function(point) { - return this.pointInside(point[0], point[1]); - }, this); - }, - - rectIntersects: function(other) { - return this._anyPointInside(other._keyPoints()) || - other._anyPointInside(this._keyPoints()); - }, - - round: function() { - return new Rect({ - top: Math.floor(this.top), - left: Math.floor(this.left), - right: Math.ceil(this.right), - bottom: Math.ceil(this.bottom) - }); - }, - - serialize: function() { - return { - top: this.top, - left: this.left, - width: this.width, - height: this.height - }; - }, - - _anyPointInside: function(points) { - return util.some(points, function(point) { - return this.pointInside(point[0], point[1]); - }, this); - }, - - _keyPoints: function() { - return [ - [this.left, this.top], - [this.left, this.bottom], - [this.right, this.top], - [this.right, this.bottom] - ]; - } -}; - -exports.Rect = Rect; -exports.getAbsoluteClientRect = function getAbsoluteClientRect(element) { - var clientRect = new Rect(element.getBoundingClientRect()); - return clientRect.translate(util.getScrollLeft(), util.getScrollTop()); -}; diff --git a/lib/browser/client-scripts/util.js b/lib/browser/client-scripts/util.js deleted file mode 100644 index 8cccb9515..000000000 --- a/lib/browser/client-scripts/util.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; -exports.each = arrayUtil(Array.prototype.forEach, myForEach); -exports.some = arrayUtil(Array.prototype.some, mySome); -exports.every = arrayUtil(Array.prototype.every, myEvery); - -function arrayUtil(nativeFunc, shimFunc) { - return nativeFunc? contextify(nativeFunc) : shimFunc; -} - -/** - * Makes function f to accept context as a - * first argument - */ -function contextify(f) { - return function(ctx) { - var rest = Array.prototype.slice.call(arguments, 1); - return f.apply(ctx, rest); - }; -} - -function myForEach(array, cb, context) { - for (var i = 0; i < array.length; i++) { - cb.call(context, array[i], i, array); - } -} - -function mySome(array, cb, context) { - for (var i = 0; i < array.length; i++) { - if (cb.call(context, array[i], i, array)) { - return true; - } - } - return false; -} - -function myEvery(array, cb, context) { - for (var i = 0; i < array.length; i++) { - if (!cb.call(context, array[i], i, array)) { - return false; - } - } - return true; -} - -exports.getScrollTop = function() { - if (typeof window.pageYOffset !== 'undefined') { - return window.pageYOffset; - } - - return document.documentElement.scrollTop; -}; - -exports.getScrollLeft = function() { - if (typeof window.pageXOffset !== 'undefined') { - return window.pageXOffset; - } - - return document.documentElement.scrollLeft; -}; diff --git a/lib/browser/existing-browser.js b/lib/browser/existing-browser.js index c7aace43d..ad36325ff 100644 --- a/lib/browser/existing-browser.js +++ b/lib/browser/existing-browser.js @@ -1,6 +1,6 @@ 'use strict'; -var Browser = require('./browser'); +const Browser = require('./browser'); module.exports = class ExistingBrowser extends Browser { static fromObject(serializedObject) { @@ -22,6 +22,6 @@ module.exports = class ExistingBrowser extends Browser { attach() { return this._setHttpTimeout() .then(() => this._wd.attach(this.sessionId)) - .thenResolve(this); + .then(() => this); } }; diff --git a/lib/browser/new-browser.js b/lib/browser/new-browser.js index cf8855175..ecf03aea2 100644 --- a/lib/browser/new-browser.js +++ b/lib/browser/new-browser.js @@ -1,44 +1,36 @@ 'use strict'; -var path = require('path'), - util = require('util'), - debug = require('debug'), - _ = require('lodash'), - q = require('q'), - chalk = require('chalk'), - polyfillService = require('polyfill-service'), - browserify = require('browserify'), +const debug = require('debug'); +const chalk = require('chalk'); +const _ = require('lodash'); +const Promise = require('bluebird'); +const striptags = require('striptags'); - Browser = require('./browser'), - ClientBridge = require('./client-bridge'), +const Browser = require('./browser'); +const ClientBridge = require('./client-bridge'); - GeminiError = require('../errors/gemini-error'), - WdErrors = require('../constants/wd-errors'), +const GeminiError = require('../errors/gemini-error'); +const WdErrors = require('../constants/wd-errors'); - OPERA_NOT_SUPPORTED = 'Not supported in OperaDriver yet'; +const OPERA_NOT_SUPPORTED = 'Not supported in OperaDriver yet'; module.exports = class NewBrowser extends Browser { constructor(config) { super(config); - this.log = debug('gemini:browser:' + this.id); + this.log = debug(`gemini:browser: ${this.id}`); + const wdLog = debug(`gemini:webdriver: ${this.id}`); - var wdLog = debug('gemini:webdriver:' + this.id); - - this._wd.on('connection', function(code, message, error) { - wdLog('Error: code %d, %s', code, message); - }); - - this._wd.on('status', function(info) { - wdLog(info); - }); - this._wd.on('command', function(eventType, command, response) { + this._wd.on('connection', (code, message) => wdLog(`Error: code ${code}, ${message}`)); + this._wd.on('status', (info) => wdLog(info)); + this._wd.on('command', (eventType, command, response) => { if (eventType === 'RESPONSE' && command === 'takeScreenshot()') { response = ''; } if (typeof response !== 'string') { response = JSON.stringify(response); } + wdLog(chalk.cyan(eventType), command, chalk.grey(response || '')); }); @@ -48,7 +40,7 @@ module.exports = class NewBrowser extends Browser { 'waitFor', 'moveTo', 'click', - 'doubleClick', + 'doubleclick', 'buttonDown', 'buttonUp', 'keys', @@ -58,23 +50,43 @@ module.exports = class NewBrowser extends Browser { 'execute', 'setWindowSize', 'getWindowSize', - 'getOrientation', - 'setOrientation' + // 'setOrientation' and 'getOrientation' work only in context 'NATIVE_APP' with 'appium' below 1.5.x + {name: 'getOrientation', context: 'NATIVE_APP'}, + {name: 'setOrientation', context: 'NATIVE_APP'} ]); } _exposeWdApi(methods) { - var _this = this; - methods.forEach(function(method) { - _this[method] = function() { - return _this._wd[method].apply(_this._wd, arguments); - }; - }); + methods + .map((method) => _.isPlainObject(method) ? method : {name: method}) + .forEach((method) => this[method.name] = this._exposeWdMethod(method)); + } + + _exposeWdMethod(method) { + return function() { + return method.context + ? this._applyWdMethodInContext(method.name, method.context, arguments) + : this._applyWdMethod(method.name, arguments); + }; + } + + _applyWdMethodInContext(method, context, args) { + return this._wd.currentContext() + .then((originalContext) => { + return this._wd.context(context) + .then(() => this._applyWdMethod(method, args)) + .finally(() => this._wd.context(originalContext)); + }); + } + + _applyWdMethod(method, args) { + return this._wd[method].apply(this._wd, args); } launch(calibrator) { return this.initSession() .then(() => this._setDefaultSize()) + .then(() => this._setDefaultOrientation()) .then(() => { // maximize is required, because default // windows size in phantomjs can prevent @@ -91,12 +103,11 @@ module.exports = class NewBrowser extends Browser { return calibrator.calibrate(this) .then((calibration) => this._setCalibration(calibration)); }) - .then(() => this._buildPolyfills()) .then(() => this.buildScripts()) .then(() => this.chooseLocator()) .catch((e) => { if (e.code === 'ECONNREFUSED') { - return q.reject(new GeminiError( + return Promise.reject(new GeminiError( `Unable to connect to ${this.config.gridUrl}.`, 'Make sure that URL in config file is correct and selenium\nserver is running.' )); @@ -104,16 +115,42 @@ module.exports = class NewBrowser extends Browser { const error = new GeminiError(`Cannot launch browser ${this.id}:\n${e.message}.`); + if (e.data) { + error.message += '\nReason: ' + this._parseHtmlBody(e.data); + } + error.browserId = this.id; error.sessionId = this.sessionId; // selenium does not provide a way to distinguish different reasons of failure - return q.reject(error); + return Promise.reject(error); }); } + _parseHtmlBody(html) { + const body = html.match(//i); + + if (!body) { + return html; + } + + const rawText = striptags(body[0]); + + return rawText + ? (rawText).replace(/\s+/g, ' ').trim() + : html; + } + + _setSessionTimeout(timeout) { + if (_.isNull(timeout)) { + timeout = this.config.httpTimeout; + } + + return this._configureHttp(timeout); + } + initSession() { - return this._setSessionRequestTimeout() + return this._setSessionTimeout(this.config.sessionRequestTimeout) .then(() => this._wd.init(this.capabilities)) .spread((sessionId) => { this.sessionId = sessionId; @@ -123,65 +160,55 @@ module.exports = class NewBrowser extends Browser { } _setDefaultSize() { - var size = this.config.windowSize; + const size = this.config.windowSize; + if (!size) { return; } + return this._wd.setWindowSize(size.width, size.height) - .fail(function(e) { + .catch((e) => { // Its the only reliable way to detect not supported operation // in legacy operadriver. - var message = e.cause && e.cause.value && e.cause.value.message; + const message = _.get(e, 'cause.value.message'); + if (message === OPERA_NOT_SUPPORTED) { console.warn(chalk.yellow('WARNING!')); console.warn('Legacy Opera Driver does not support window resizing'); console.warn('windowSize setting will be ignored.'); return; } - return q.reject(e); + + return Promise.reject(e); }); } - _buildPolyfills() { - /*jshint evil:true*/ - //polyfills are needed for older browsers, namely, IE8 - - var _this = this; - return _this._wd.eval('navigator.userAgent') - .then(function(ua) { - return polyfillService.getPolyfillString({ - uaString: ua, - minify: true, - features: { - 'getComputedStyle': {flags: ['gated']}, - 'matchMedia': {flags: ['gated']}, - 'document.querySelector': {flags: ['gated']}, - 'String.prototype.trim': {flags: ['gated']} - } - }); - }) - .then(function(polyfill) { - _this._polyfill = polyfill; - }); + _setDefaultOrientation() { + const orientation = this.config.orientation; + + if (!orientation) { + return; + } + + return this._wd.setOrientation(orientation); } openRelative(relativeURL) { - return this.open(this.config.getAbsoluteUrl(relativeURL)); + return this.open(this.config.getAbsoluteUrl(relativeURL), {resetZoom: true}); } // Zoom reset should be skipped before calibration cause we're unable to build client scripts before // calibration done. Reset will be executed as 1 of calibration steps. open(url, params) { params = _.defaults(params || {}, { - resetZoom: true + resetZoom: false }); - var _this = this; return this._wd.get(url) - .then(function(result) { + .then((url) => { return params.resetZoom - ? _this._clientBridge.call('resetZoom').thenResolve(result) - : result; + ? this._clientBridge.call('resetZoom').then(() => url) + : url; }); } @@ -190,45 +217,24 @@ module.exports = class NewBrowser extends Browser { } evalScript(script) { - /*jshint evil:true*/ return this._wd.eval(script); } buildScripts() { - var script = browserify({ - entries: './gemini', - basedir: path.join(__dirname, 'client-scripts') - }); - - if (!this.config.system.coverage.enabled) { - script.exclude('./gemini.coverage'); - } + return ClientBridge.build(this, {calibration: this._calibration, coverage: this._coverageEnabled, supportDeprecated: true}) + .then((clientBridge) => this._clientBridge = clientBridge); + } - script.transform({sourcemap: false, global: true}, 'uglifyify'); - var queryLib = this._needsSizzle? './query.sizzle.js' : './query.native.js'; - script.transform({ - aliases: { - './query': {relative: queryLib} - }, - verbose: false - }, 'aliasify'); - - var _this = this; - - return q.nfcall(script.bundle.bind(script)) - .then(function(buf) { - var scripts = _this._polyfill + '\n' + buf.toString(); - _this._clientBridge = new ClientBridge(_this, scripts); - return scripts; - }); + get _coverageEnabled() { + return this.config.system.coverage.enabled; } - get _needsSizzle() { - return this._calibration && !this._calibration.hasCSS3Selectors; + get _needsCompatLib() { + return this._calibration && this._calibration.needsCompatLib; } chooseLocator() { - this.findElement = this._needsSizzle? this._findElementScript : this._findElementWd; + this.findElement = this._needsCompatLib ? this._findElementScript : this._findElementWd; } reset() { @@ -236,7 +242,7 @@ module.exports = class NewBrowser extends Browser { return this.evalScript('document.body') .then(body => this._wd.moveTo(body, 0, 0)) .catch(e => { - return q.reject(_.extend(e || {}, { + return Promise.reject(_.extend(e || {}, { browserId: this.id, sessionId: this.sessionId })); @@ -264,59 +270,61 @@ module.exports = class NewBrowser extends Browser { } _maximize() { - var _this = this; - return _this._wd.windowHandle() - .then(function(handle) { - return _this._wd.maximize(handle); - }); + return this._wd.windowHandle() + .then((handle) => this._wd.maximize(handle)); } - findElement(selector) { + findElement() { throw new Error('findElement is called before appropriate locator is chosen'); } _findElementWd(selector) { return this._wd.elementByCssSelector(selector) - .fail(function(error) { + .catch((error) => { if (error.status === WdErrors.ELEMENT_NOT_FOUND) { error.selector = selector; } - return q.reject(error); + return Promise.reject(error); }); } _findElementScript(selector) { - return this._clientBridge.call('query.first', [selector]) - .then(function(element) { + return this._clientBridge.call('queryFirst', [selector]) + .then((element) => { if (element) { return element; } - var error = new Error('Unable to find element'); + const error = new Error('Unable to find element'); error.status = WdErrors.ELEMENT_NOT_FOUND; error.selector = selector; - return q.reject(error); + + return Promise.reject(error); }); } prepareScreenshot(selectors, opts) { opts = _.extend(opts, { - usePixelRatio: this._calibration? this._calibration.usePixelRatio : true + usePixelRatio: this._calibration ? this._calibration.usePixelRatio : true, + coverage: this._coverageEnabled }); - return this._clientBridge.call('prepareScreenshot', [selectors, opts || {}]); + + return this._clientBridge.call('prepareScreenshot', [selectors, opts]); } quit() { if (!this.sessionId) { - return q(); + return Promise.resolve(); } - return this._wd.quit() + return this._setSessionTimeout(this.config.sessionQuitTimeout) + .then(() => this._wd.quit()) .then(() => this.log('kill browser %o', this)) - .catch((err) => console.warn(err)); + .then(() => this._setHttpTimeout()) + .catch((err) => this.log(err)); } inspect() { - return util.format('[%s (%s)]', this.id, this.sessionId); + return `[${this.id} (${this.sessionId})]`; } }; diff --git a/lib/browser/util.js b/lib/browser/util.js deleted file mode 100644 index af3c6316a..000000000 --- a/lib/browser/util.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -exports.isFullPage = (image, page, screenshotMode) => { - switch (screenshotMode) { - case 'fullpage': return true; - case 'viewport': return false; - case 'auto': return compareDimensions(image, page); - } -}; - -/** - * @param {Image} image - PngImg wrapper - * @param {Object} page - capture meta information object - * @returns {boolean} - * @private - */ -function compareDimensions(image, page) { - const pixelRatio = page.pixelRatio; - const documentWidth = page.documentWidth * pixelRatio; - const documentHeight = page.documentHeight * pixelRatio; - const imageSize = image.getSize(); - - return imageSize.height >= documentHeight && imageSize.width >= documentWidth; -} diff --git a/lib/browser/wd-bluebird.js b/lib/browser/wd-bluebird.js new file mode 100644 index 000000000..05e82c896 --- /dev/null +++ b/lib/browser/wd-bluebird.js @@ -0,0 +1,44 @@ +'use strict'; +const wd = require('wd'); +const _ = require('lodash'); +const Promise = require('bluebird'); +const EventEmitter = require('events').EventEmitter; + +function isPromised(methodName) { + if (Object.prototype[methodName]) { + return false; + } + + if (EventEmitter.prototype[methodName]) { + return false; + } + + return true; +} + +function wrap(propertyName, original) { + if (_.isFunction(original[propertyName])) { + if (isPromised(propertyName)) { + return wrapPromised(propertyName, original); + } + + return original[propertyName].bind(original); + } + return original[propertyName]; +} + +function wrapPromised(methodName, original) { + return function() { + return Promise.resolve(original[methodName].apply(original, arguments)); + }; +} + +exports.promiseRemote = (gridUrl) => { + const remote = wd.promiseRemote(gridUrl); + const bluebirdRemote = {}; + + for (let prop in remote) { + bluebirdRemote[prop] = wrap(prop, remote); + } + return bluebirdRemote; +}; diff --git a/lib/calibrator.js b/lib/calibrator.js deleted file mode 100644 index 5a2e21a11..000000000 --- a/lib/calibrator.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; -var q = require('q'), - fs = require('fs'), - path = require('path'), - _ = require('lodash'), - - GeminiError = require('./errors/gemini-error'), - looksSame = require('looks-same'), - clientScriptCalibrate = fs.readFileSync(path.join(__dirname, 'browser', 'client-scripts', 'gemini.calibrate.min.js'), 'utf8'), - DIRECTION = {FORWARD: 'forward', REVERSE: 'reverse'}; - -/** - * @constructor - */ -function Calibrator() { - this._cache = {}; -} - -/** - * @param {Browser} browser - * @returns {Promise.} - */ -Calibrator.prototype.calibrate = function(browser) { - var _this = this; - if (this._cache[browser.id]) { - return q(this._cache[browser.id]); - } - return browser.open('about:blank', {resetZoom: false}) - .then(function() { - return browser.evalScript(clientScriptCalibrate); - }) - .then(function(features) { - return [features, browser.captureViewportImage()]; - }) - .spread(function(features, image) { - var innerWidth = features.innerWidth, - hasPixelRatio = !!(features.pixelRatio && features.pixelRatio > 1.0), - imageFeatures = _this._analyzeImage(image, {calculateColorLength: hasPixelRatio}); - - if (!imageFeatures) { - return q.reject(new GeminiError( - 'Could not calibrate. This could be due to calibration page has failed to open properly' - )); - } - - _.extend(features, { - top: imageFeatures.viewportStart.y, - left: imageFeatures.viewportStart.x, - usePixelRatio: hasPixelRatio && imageFeatures.colorLength > innerWidth - }); - - _this._cache[browser.id] = features; - return features; - }); -}; - -Calibrator.prototype._analyzeImage = function(image, params) { - var imageHeight = image.getSize().height; - - for (var y = 0; y < imageHeight; y++) { - var result = analyzeRow(y, image, params); - - if (result) { - return result; - } - } - - return null; -}; - -function analyzeRow(row, image, params) { - params = params || {}; - - var markerStart = findMarkerInRow(row, image, DIRECTION.FORWARD); - - if (markerStart === -1) { - return null; - } - - if (!params.calculateColorLength) { - return {viewportStart: {x: markerStart, y: row}}; - } - - var markerEnd = findMarkerInRow(row, image, DIRECTION.REVERSE), - colorLength = markerEnd - markerStart + 1; - - return {viewportStart: {x: markerStart, y: row}, colorLength: colorLength}; -} - -function findMarkerInRow(row, image, searchDirection) { - var imageWidth = image.getSize().width, - searchColor = {R: 148, G: 250, B: 0}; - - if (searchDirection === DIRECTION.REVERSE) { - return searchReverse_(); - } else { - return searchForward_(); - } - - function searchForward_() { - for (var x = 0; x < imageWidth; x++) { - if (compare_(x)) { - return x; - } - } - return -1; - } - - function searchReverse_() { - for (var x = imageWidth - 1; x >= 0; x--) { - if (compare_(x)) { - return x; - } - } - return -1; - } - - function compare_(x) { - var color = pickRGB(image.getRGBA(x, row)); - return looksSame.colors(color, searchColor); - } -} - -function pickRGB(rgba) { - return { - R: rgba.r, - G: rgba.g, - B: rgba.b - }; -} - -/** - * @typedef {Object} CalibrationResult - * @property {Number} top - * @property {Number} left - * @property {Number} right - * @property {Number} bottom - */ - -module.exports = Calibrator; diff --git a/lib/capture-session.js b/lib/capture-session.js new file mode 100644 index 000000000..6444e2509 --- /dev/null +++ b/lib/capture-session.js @@ -0,0 +1,67 @@ +'use strict'; + +const _ = require('lodash'); +const Promise = require('bluebird'); +const debug = require('debug'); + +const ActionsBuilder = require('./tests-api/actions-builder'); +const Browser = require('./browser'); +const {temp, ScreenShooter} = require('gemini-core'); + +module.exports = class CaptureSession { + static create(browser) { + return new CaptureSession(browser); + } + + static fromObject(serializedSession) { + return Browser.fromObject(serializedSession.browser) + .then((browser) => new CaptureSession(browser)); + } + + constructor(browser) { + this.browser = browser; + this.log = debug('gemini:capture:' + this.browser.id); + + this._postActions = []; + + this._screenShooter = ScreenShooter.create(browser); + } + + runActions(actions) { + this.log('run actions'); + return Promise.mapSeries(actions, (a) => a(this.browser, ActionsBuilder.create(this._postActions))); + } + + prepareScreenshot(state) { + this.log('capture "%s" in %o', state.fullName, this.browser); + return this.browser.prepareScreenshot(state.captureSelectors, {ignoreSelectors: state.ignoreSelectors}); + } + + capture(page) { + return this._screenShooter.capture(page) + .catch((e) => this.extendWithPageScreenshot(e).thenThrow(e)) + .then((image) => ({image, canHaveCaret: page.canHaveCaret})); + } + + runPostActions() { + return Promise.mapSeries(this._postActions.reverse(), (a) => a(this.browser)); + } + + extendWithPageScreenshot(obj) { + const path = temp.path({suffix: '.png'}); + + return this.browser.captureViewportImage() + .then((screenImage) => [screenImage.getSize(), screenImage.save(path)]) + .spread((size) => { + obj.img = {path, size}; + }) + .catch(_.noop) + .then(() => obj); + } + + serialize() { + return { + browser: this.browser.serialize() + }; + } +}; diff --git a/lib/capture-session/coord-validator/errors/height-viewport-error.js b/lib/capture-session/coord-validator/errors/height-viewport-error.js deleted file mode 100644 index 1578980b3..000000000 --- a/lib/capture-session/coord-validator/errors/height-viewport-error.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -/** - * Height of the element is larger than viewport - */ -module.exports = class HeightViewportError extends Error { - constructor(message) { - super(message); - - this.name = this.constructor.name; - } -}; diff --git a/lib/capture-session/coord-validator/errors/offset-viewport-error.js b/lib/capture-session/coord-validator/errors/offset-viewport-error.js deleted file mode 100644 index aaac0550b..000000000 --- a/lib/capture-session/coord-validator/errors/offset-viewport-error.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -/** - * Position of an element is outside of a viewport left, top or right bounds - */ -module.exports = class OffsetViewportError extends Error { - constructor(message) { - super(message); - - this.name = this.constructor.name; - } -}; diff --git a/lib/capture-session/coord-validator/index.js b/lib/capture-session/coord-validator/index.js deleted file mode 100644 index 10b9c552c..000000000 --- a/lib/capture-session/coord-validator/index.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -const debug = require('debug'); -const HeightViewportError = require('./errors/height-viewport-error'); -const OffsetViewportError = require('./errors/offset-viewport-error'); - -const isOutsideOfViewport = (viewport, cropArea) => - cropArea.top < 0 || cropArea.left < 0 || cropArea.left + cropArea.width > viewport.width; - -module.exports = class CoordValidator { - static create(browser) { - return new CoordValidator(browser); - } - - /** - * @param {Browser} browser session instance - */ - constructor(browser) { - this._log = debug('gemini:coord-validator:' + browser.id); - } - - /** - * Validates compatibility of viewport and crop area coordinates - * @param {Object} viewport - * @param {Object} cropArea - */ - validate(viewport, cropArea) { - this._log('viewport size', viewport); - this._log('crop area', cropArea); - - if (isOutsideOfViewport(viewport, cropArea)) { - return this._reportOffsetViewportError(); - } - - if (cropArea.height > viewport.height) { - return this._reportHeightViewportError(viewport, cropArea); - } - } - - /** - * Reports error if crop area is outside of viewport - * @returns {Object} - * @private - */ - _reportOffsetViewportError() { - this._log('crop area is outside of the viewport left, top or right bounds'); - - const message = `Can not capture the specified region of the viewport. - Position of the region is outside of the viewport left, top or right bounds. - Check that elements: - - does not overflows the document - - does not overflows browser viewport - Alternatively, you can increase browser window size using - "setWindowSize" or "windowSize" option in the config file.`; - - throw new OffsetViewportError(message); - } - - /** - * This case is handled specially because of Opera 12 browser. - * Problem, described in error message occurs there much more often then - * for other browsers and has different workaround - * @param {Object} viewport - * @param {Object} cropArea - crop area - * @returns {Object} - * @private - */ - _reportHeightViewportError(viewport, cropArea) { - this._log('crop area bottom bound is outside of the viewport height'); - - const message = `Can not capture the specified region of the viewport. - The region bottom bound is outside of the viewport height. - Alternatively, you can test such cases by setting "true" value to option "compositeImage" in the config file. - Element position: ${cropArea.left}, ${cropArea.top}; size: ${cropArea.width}, ${cropArea.height}. - Viewport size: ${viewport.width}, ${viewport.height}.`; - - throw new HeightViewportError(message); - } -}; diff --git a/lib/capture-session/index.js b/lib/capture-session/index.js deleted file mode 100644 index 8ac727987..000000000 --- a/lib/capture-session/index.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; - -const inherit = require('inherit'); -const _ = require('lodash'); -const debug = require('debug'); -const promiseUtil = require('q-promise-utils'); -const ActionsBuilder = require('../tests-api/actions-builder'); -const Browser = require('../browser'); -const temp = require('../temp'); -const StateError = require('../errors/state-error'); -const Viewport = require('./viewport'); -const HeightViewportError = require('./coord-validator/errors/height-viewport-error'); - -var CaptureSession = inherit({ - /** - * @param {Browser} browser session instance - * @constructor - */ - __constructor: function(browser) { - this.browser = browser; - this.log = debug('gemini:capture:' + this.browser.id); - - this._postActions = []; - }, - - runActions: function(actions) { - this.log('run actions'); - return promiseUtil.sequence(actions, this.browser, new ActionsBuilder(this._postActions)); - }, - - prepareScreenshot: function(state, opts) { - opts = _.extend({}, opts, { - ignoreSelectors: state.ignoreSelectors - }); - - this.log('capture "%s" in %o', state.fullName, this.browser); - return this.browser.prepareScreenshot(state.captureSelectors, opts); - }, - - capture: function(page) { - return this.browser.captureViewportImage(page) - .then((screenImage) => { - const viewport = page.viewport; - const pixelRatio = page.pixelRatio; - - return this._cropImage(Viewport.create(viewport, screenImage, pixelRatio), page); - }); - }, - - runPostActions: function() { - return promiseUtil.sequence(this._postActions.reverse(), this.browser); - }, - - extendWithPageScreenshot: function(obj) { - const path = temp.path({suffix: '.png'}); - - return this.browser.captureViewportImage() - .then((screenImage) => screenImage.save(path)) - .then(() => (obj.imagePath = path)) - .catch(_.noop) - .thenResolve(obj); - }, - - serialize: function() { - return { - browser: this.browser.serialize() - }; - }, - - _cropImage: function(viewport, page) { - this.log('capture data:', page); - - const captureArea = page.captureArea; - - try { - viewport.validate(captureArea, this.browser); - } catch (e) { - return e instanceof HeightViewportError && this.browser.config.compositeImage - ? this._extendImage(viewport, page) - : this._handleValidateImageError(e, viewport); - } - - viewport.ignoreAreas(page.ignoreAreas); - - return viewport.crop(captureArea) - .then((image) => ({image, canHaveCaret: page.canHaveCaret})); - }, - - _handleValidateImageError: function(e, viewport) { - const path = temp.path({suffix: '.png'}); - const error = new StateError(e.message); - - return viewport.save(path) - .then(() => error.imagePath = path) - .thenReject(error); - }, - - _extendImage: function(viewport, page) { - const scrollHeight = Math.min( - viewport.getVerticalOverflow(page.captureArea), - page.viewport.height - ); - - return this.browser - .scrollBy(0, scrollHeight) - .then(() => { - page.viewport.top += scrollHeight; - return this.browser.captureViewportImage(page); - }) - .then((newImage) => viewport.extendBy(scrollHeight, newImage)) - .then(() => this._cropImage(viewport, page)); - } -}, { - fromObject: function(serializedSession) { - return Browser.fromObject(serializedSession.browser) - .then((browser) => new CaptureSession(browser)); - } -}); - -module.exports = CaptureSession; diff --git a/lib/capture-session/viewport.js b/lib/capture-session/viewport.js deleted file mode 100644 index 86ed86fbf..000000000 --- a/lib/capture-session/viewport.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -const _ = require('lodash'); - -const CoordValidator = require('./coord-validator'); - -module.exports = class Viewport { - static create(viewport, image, pixelRatio) { - return new Viewport(viewport, image, pixelRatio); - } - - constructor(viewport, image, pixelRatio) { - this._viewport = _.clone(viewport); - this._image = image; - this._pixelRatio = pixelRatio; - } - - validate(captureArea, browser) { - CoordValidator.create(browser).validate(this._viewport, captureArea); - } - - ignoreAreas(areas) { - areas.forEach((area) => { - this._image.clear(this._transformToViewportOrigin(area), {scaleFactor: this._pixelRatio}); - }); - } - - crop(captureArea) { - return this._image.crop(this._transformToViewportOrigin(captureArea), {scaleFactor: this._pixelRatio}); - } - - _transformToViewportOrigin(area) { - return _.extend({}, area, { - top: area.top - this._viewport.top, - left: area.left - this._viewport.left - }); - } - - save(path) { - return this._image.save(path); - } - - extendBy(scrollHeight, newImage) { - const newImageSize = newImage.getSize(); - const physicalScrollHeight = scrollHeight * this._pixelRatio; - - this._viewport.height += scrollHeight; - - return newImage.crop({ - left: 0, - top: newImageSize.height - physicalScrollHeight, - width: newImageSize.width, - height: physicalScrollHeight - }) - .then((croppedImage) => this._image.join(croppedImage)); - } - - getVerticalOverflow(captureArea) { - return captureArea.height - this._viewport.height; - } -}; diff --git a/lib/cli/deprecations.js b/lib/cli/deprecations.js index 80533d4fb..9b8d9fcde 100644 --- a/lib/cli/deprecations.js +++ b/lib/cli/deprecations.js @@ -28,18 +28,17 @@ exports.checkForDeprecations = function() { }; function checkForRemovedOptions() { - _.each(REMOVED_OPTIONS_REPLACEMENTS, function(replacement, option) { - if (_.contains(process.argv, option)) { + _.forEach(REMOVED_OPTIONS_REPLACEMENTS, function(replacement, option) { + if (_.includes(process.argv, option)) { throw new GeminiError( - util.format('Option %s is removed', option), - 'Instead use ' + replacement + util.format('Option %s is removed. Instead use %s', option, replacement) ); } }); } function checkForRemovedEnvVars() { - _.each(REMOVED_ENV_REPLACEMENTS, function(replacement, option) { + _.forEach(REMOVED_ENV_REPLACEMENTS, function(replacement, option) { if (option in process.env) { console.warn( 'WARNING: %s env var is not longer used. Use %s instead', diff --git a/lib/cli/index.js b/lib/cli/index.js index 19c274e2a..61a1e5c32 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -1,97 +1,148 @@ 'use strict'; -var pkg = require('../../package.json'), - program = require('commander'), - q = require('q'), - handleErrors = require('./errors').handleErrors, - handleUncaughtExceptions = require('./errors').handleUncaughtExceptions, - Gemini = require('../gemini'), - checkForDeprecations = require('./deprecations').checkForDeprecations; - -exports.run = function() { +const _ = require('lodash'); +const {Command} = require('commander'); + +const Events = require('../constants/events'); +const Gemini = require('../gemini'); +const pkg = require('../../package.json'); +const {checkForDeprecations} = require('./deprecations'); +const {handleErrors, handleUncaughtExceptions} = require('./errors'); + +let exitCode; + +exports.run = () => { + const program = new Command(); + program .version(pkg.version) + .allowUnknownOption() + .option('-c, --config ', 'config file'); + + const configPath = preparseOption(program, 'config'); + const gemini = mkGemini(configPath); + + program .option('-b, --browser ', 'run test only in specified browser', collect) - .option('-c, --config ', 'config file') + .option('-s, --set ', 'set to run', collect) .option('--grep ', 'run only suites matching the pattern', RegExp); program.command('update [paths...]') - .allowUnknownOption(true) + .allowUnknownOption() .option('--diff', 'update only screenshots with diff') .option('--new', 'save only new screenshots') .description('update the changed screenshots or gather if they doesn\'t exist') - .action(function(paths, options) { - runGemini('update', paths, options).done(); - }); + .action((paths, options) => mkRunFn(gemini, 'update', program)(paths, options).done()); program.command('test [paths...]') - .allowUnknownOption(true) - .option('-r, --reporter ', 'test reporter', collect) + .allowUnknownOption() + .option('-r, --reporter ', 'test result reporter (flat by default)', collect) .description('run tests') - .action(function(paths, options) { - runGemini('test', paths, options) - .done(); - }); - - program.on('--help', function() { - console.log(' Overriding config'); - console.log(' To override any config option use full option path converted to --kebab-case'); + .on('--help', () => { + console.log(' Reporters:'); + console.log(' flat console reporter'); + console.log(' vflat verbose console reporter'); + console.log(''); + }) + .action((paths, options) => mkRunFn(gemini, 'test', program)(paths, options).done()); + + program.command('list ') + .description(`Use 'list browsers' or 'list sets' to get all available browsers or sets.`) + .action((key) => logOptionFromConfig(key, gemini)); + + program.on('--help', () => { + console.log(''); + console.log(' Overriding config:'); + console.log(''); + console.log(' To override any config option use full option path converted to --kebab-case.'); console.log(''); console.log(' Examples:'); console.log(' gemini test --system-debug true'); console.log(' gemini update --root-url http://example.com'); - console.log(' gemini test --browsers-ie8-window-size 1024x768'); + console.log(' gemini test --browsers-ie-8-window-size 1024x768'); console.log(''); console.log(' You can also use environment variables converted to snake_case with'); - console.log(' gemini_ prefix'); + console.log(' gemini_ prefix.'); console.log(''); console.log(' Examples:'); console.log(' gemini_system_debug=true gemini test'); console.log(' gemini_root_url=http://example.com gemini update'); console.log(' gemini_browsers_ie8_window_size=1024x768 gemini test'); console.log(''); - console.log(' If both cli flag and env var are used, cli flag takes precedence') ; + console.log(' If both cli flag and env var are used, cli flag takes precedence.') ; + console.log(' For more information see https://gemini-testing.github.io/doc/config.html') ; + console.log(''); }); + gemini.extendCli(program); + program.parse(process.argv); }; -function collect(newValue, array) { - array = array || []; - return array.concat(newValue); +function preparseOption(program, option) { + // do not display any help, do not exit + const configFileParser = Object.create(program); + configFileParser.options = [].concat(program.options); + configFileParser.option('-h, --help'); + + configFileParser.parse(process.argv); + return configFileParser[option]; } -function runGemini(method, paths, options) { - options = options || {}; +function mkGemini(configPath) { + checkForDeprecations(); - handleUncaughtExceptions(); + const gemini = new Gemini(configPath, {cli: true, env: true}); + gemini.on(Events.INTERRUPT, (data) => exitCode = data.exitCode); - return q.fcall(function() { - checkForDeprecations(); - return new Gemini(program.config, {cli: true, env: true}); - }) - .then(function(gemini) { - return gemini[method](paths, { - reporters: options.reporter || ['flat'], - grep: program.grep, - browsers: program.browser, - diff: options.diff, - new: options.new - }); - }) - .then(function(stats) { - if (stats.failed > 0 || stats.errored > 0) { - return 2; - } - return 0; + return gemini; +} + +function mkRunFn(gemini, method, globalOpts) { + return (paths, opts = {}) => { + handleUncaughtExceptions(); + + return gemini[method](paths, { + sets: globalOpts.set, + reporters: parseReporterOptions(opts), + grep: globalOpts.grep, + browsers: globalOpts.browser, + diff: opts.diff, + new: opts.new }) - .fail(handleErrors) + .then((stats) => stats.failed > 0 ? 2 : 0) + .catch(handleErrors) .then(exit); + }; } -function exit(code) { - process.on('exit', function() { - process.exit(code); +function logOptionFromConfig(key, {config}) { + const data = { + sets: _.keys(config.sets).join(', '), + browsers: config.getBrowserIds().join(', ') + }; + + console.log(data[key] || `Cannot list option ${key}. Available options are: sets, browsers`); +} + +function collect(newValue, array = []) { + return array.concat(newValue); +} + +function parseReporterOptions(options) { + if (!options.reporter) { + return [{name: 'flat'}]; + } + + return options.reporter.map(function(name) { + return { + name, + path: options[`${name}ReporterPath`] + }; }); } + +function exit(code) { + process.on('exit', () => process.exit(exitCode || code)); +} diff --git a/lib/config/browser-config.js b/lib/config/browser-config.js index 4ee8c0cb2..f35979654 100644 --- a/lib/config/browser-config.js +++ b/lib/config/browser-config.js @@ -1,6 +1,7 @@ 'use strict'; var path = require('path'), + url = require('url'), _ = require('lodash'); function BrowserConfig(id, systemOptions, browserOptions) { @@ -18,10 +19,8 @@ BrowserConfig.prototype.getScreenshotPath = function(suite, state) { }; BrowserConfig.prototype.getAbsoluteUrl = function(relUrl) { - return [ - this.rootUrl.replace(/\/$/, ''), - relUrl.replace(/^\//, '') - ].join('/'); + const rootUrl = this.rootUrl.endsWith('/') ? this.rootUrl : `${this.rootUrl}/`; + return url.resolve(rootUrl, relUrl); }; function getPathForSuite(suite) { diff --git a/lib/config/browser-options.js b/lib/config/browser-options.js index cd2a8b078..4dd6437e7 100644 --- a/lib/config/browser-options.js +++ b/lib/config/browser-options.js @@ -1,90 +1,107 @@ 'use strict'; -var _ = require('lodash'), - GeminiError = require('../errors/gemini-error'), - util = require('./util'), - - option = require('gemini-configparser').option, - is = util.is, - assertNonNegative = util.assertNonNegative, - resolveWithProjectRoot = util.resolveWithProjectRoot, - booleanOption = util.booleanOption, - positiveIntegerOption = util.positiveIntegerOption; - -function getTopLevel() { - var defaults = { + +const _ = require('lodash'); +const url = require('url'); + +const option = require('gemini-configparser').option; +const GeminiError = require('../errors/gemini-error'); +const util = require('./util'); + +const assertNonNegative = util.assertNonNegative; +const booleanOption = util.booleanOption; +const is = util.is; +const positiveIntegerOption = util.positiveIntegerOption; +const resolveWithProjectRoot = util.resolveWithProjectRoot; + +const isOptionalObject = (value) => value === null || _.isPlainObject(value); + +const getTopLevel = () => { + const defaults = { gridUrl: 'http://localhost:4444/wd/hub', calibrate: true, httpTimeout: 'default', sessionRequestTimeout: null, + sessionQuitTimeout: null, screenshotsDir: 'gemini/screens', tolerance: 2.3, + antialiasingTolerance: 0, + compareOpts: { + shouldCluster: false, + clustersSize: 10, + stopOnFirstFail: false + }, + buildDiffOpts: { + ignoreAntialiasing: true, + ignoreCaret: true + }, sessionsPerBrowser: 1, suitesPerSession: Infinity, windowSize: null, retry: 0, screenshotMode: 'auto', - compositeImage: false + compositeImage: false, + screenshotDelay: 0, + orientation: null }; - function provideDefault(key) { - return defaults[key]; - } + const provideDefault = (key) => defaults[key]; return buildBrowserOptions(provideDefault, { desiredCapabilities: option({ defaultValue: null, parseEnv: JSON.parse, parseCli: JSON.parse, - validate: function(value) { + validate: (value) => { if (!isOptionalObject(value)) { throw new GeminiError('Top-level desiredCapabilities should be null or object'); } } }) }); -} +}; + +const provideTopLevelDefault = (name) => { + return (config) => { + const value = config[name]; + + if (_.isUndefined(value)) { + throw new GeminiError(`${name} should be set at top level or per-browser option`); + } -function getPerBrowser() { + return value; + }; +}; + +const getPerBrowser = () => { return buildBrowserOptions(provideTopLevelDefault, { desiredCapabilities: option({ parseEnv: JSON.parse, parseCli: JSON.parse, defaultValue: null, - validate: function(value, config) { + validate: (value, config) => { if (value === null && config.desiredCapabilities === null) { throw new GeminiError('Browser must have desired capabilities set'); - } - - if (!isOptionalObject(value)) { + } else if (!isOptionalObject(value)) { throw new GeminiError('desiredCapabilities should be null or object'); } }, - map: function(value, config) { - return _.extend({}, config.desiredCapabilities, value); - } + map: (value, config) => _.extend({}, config.desiredCapabilities, value) }) }); -} +}; -function isOptionalObject(value) { - return value === null || _.isPlainObject(value); -} - -function provideTopLevelDefault(name) { - return function(config) { - var value = config[name]; - if (_.isUndefined(value)) { - throw new GeminiError(name + ' should be set at top level or per-browser option'); - } - return value; - }; -} +const parseTimeout = (value) => value === 'default' ? value : +value; function buildBrowserOptions(defaultFactory, extra) { return _.extend(extra, { rootUrl: option({ validate: is('string'), - defaultValue: defaultFactory('rootUrl') + defaultValue: defaultFactory('rootUrl'), + map: (value, config) => { + return config.rootUrl && !value.match(/^https?:\/\//) + ? url.resolve(config.rootUrl, value.replace(/^\//, '')) + : value; + } }), gridUrl: option({ @@ -97,7 +114,7 @@ function buildBrowserOptions(defaultFactory, extra) { httpTimeout: option({ parseEnv: parseTimeout, parseCli: parseTimeout, - validate: function(value) { + validate: (value) => { if (value === 'default') { return; } @@ -118,6 +135,18 @@ function buildBrowserOptions(defaultFactory, extra) { defaultValue: defaultFactory('sessionRequestTimeout') }), + sessionQuitTimeout: option({ + parseEnv: Number, + parseCli: Number, + validate: (value) => { + if (_.isNull(value)) { + return; + } + assertNonNegative(value, 'sessionQuitTimeout'); + }, + defaultValue: defaultFactory('sessionQuitTimeout') + }), + screenshotsDir: option({ validate: is('string'), defaultValue: defaultFactory('screenshotsDir'), @@ -131,40 +160,40 @@ function buildBrowserOptions(defaultFactory, extra) { validate: is('number') }), + antialiasingTolerance: option({ + defaultValue: defaultFactory('antialiasingTolerance'), + parseEnv: Number, + parseCli: Number, + validate: is('number') + }), + windowSize: option({ defaultValue: defaultFactory('windowSize'), - validate: function(value) { + validate: (value) => { if (_.isObject(value) && _.isNumber(value.width) && _.isNumber(value.height)) { return; - } - - if (value === null) { + } else if (value === null) { //null is valid value for this option, skip any other checks return; - } - - if (!_.isString(value)) { + } else if (!_.isString(value)) { throw new GeminiError('"windowSize" must be string or null'); - } - - if (!/^\d+x\d+$/.test(value)) { + } else if (!/^\d+x\d+$/.test(value)) { throw new GeminiError('"windowSize" should have form of x (i.e. 1600x1200)'); } }, - map: function(value) { + map: (value) => { if (value === null) { return null; - } - - if (_.isObject(value)) { + } else if (_.isObject(value)) { // object with "width" and "height" numeric properties // which does not needs mapping. Any other object won't // pass validation. return value; } - var size = value.split('x'); + const size = value.split('x'); + return { width: parseInt(size[0], 10), height: parseInt(size[1], 10) @@ -179,7 +208,7 @@ function buildBrowserOptions(defaultFactory, extra) { defaultValue: defaultFactory('retry'), parseEnv: Number, parseCli: Number, - validate: function(value) { + validate: (value) => { is('number')(value); if (value < 0) { throw new GeminiError('"retry" must be non-negative'); @@ -189,7 +218,7 @@ function buildBrowserOptions(defaultFactory, extra) { screenshotMode: option({ defaultValue: defaultFactory('screenshotMode'), - validate: function(value) { + validate: (value) => { is('string')(value); if (!_.includes(['fullpage', 'viewport', 'auto'], value)) { throw new GeminiError('"screenshotMode" must be one of "fullpage", "viewport" or "auto"'); @@ -197,12 +226,52 @@ function buildBrowserOptions(defaultFactory, extra) { } }), - compositeImage: booleanOption(defaultFactory('compositeImage')) - }); -} + screenshotDelay: option({ + defaultValue: defaultFactory('screenshotDelay'), + parseEnv: Number, + parseCli: Number, + validate: (value) => { + assertNonNegative(value, 'screenshotDelay'); + } + }), + + compositeImage: booleanOption(defaultFactory('compositeImage')), -function parseTimeout(value) { - return value === 'default'? value : Number(value); + compareOpts: option({ + defaultValue: defaultFactory('compareOpts'), + parseEnv: JSON.parse, + parseCli: JSON.parse, + validate: (value) => { + if (!isOptionalObject(value)) { + throw new GeminiError('CompareOpts should be object'); + } + } + }), + + buildDiffOpts: option({ + defaultValue: defaultFactory('buildDiffOpts'), + parseEnv: JSON.parse, + parseCli: JSON.parse, + validate: (value) => { + if (!isOptionalObject(value)) { + throw new GeminiError('buildDiffOpts should be object'); + } + } + }), + + orientation: option({ + defaultValue: defaultFactory('orientation'), + validate: (value) => { + if (_.isNull(value)) { + return; + } + is('string', 'orientation')(value); + if (value !== 'landscape' && value !== 'portrait') { + throw new Error('"orientation" must be "landscape" or "portrait"'); + } + } + }) + }); } exports.getTopLevel = getTopLevel; diff --git a/lib/config/config-reader.js b/lib/config/config-reader.js index 54b1b47f5..3607ee732 100644 --- a/lib/config/config-reader.js +++ b/lib/config/config-reader.js @@ -16,19 +16,19 @@ exports.read = (filePath) => { function getDefaultConfig() { var configFile = _.find(fs.readdirSync('./'), function(file) { - return /^\.gemini(\.conf)?\.(yml|js|json)$/.test(file); - }); + return /^\.gemini(\.conf)?\.(yml|js|json)$/.test(file); + }); if (!configFile) { throw new GeminiError('No config found'); } - return path.resolve(configFile); + return configFile; } function requireModule(file) { try { - return require(file); + return require(path.resolve(file)); } catch (e) { if (e.code === 'MODULE_NOT_FOUND') { throw new GeminiError('Config file does not exist: ' + file); diff --git a/lib/config/index.js b/lib/config/index.js index f250b678d..4c563dec2 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -7,6 +7,8 @@ var path = require('path'), parseOptions = require('./options'); +const log = require('debug')('gemini:config'); + /** * @param {Object|String} config config object or path to config file * @param {Object} allowOverrides @@ -19,21 +21,23 @@ function Config(config, allowOverrides) { cli: false }); - var env = allowOverrides.env? process.env : {}, - argv = allowOverrides.cli? process.argv : []; + var env = allowOverrides.env ? process.env : {}, + argv = allowOverrides.cli ? process.argv : []; if (!config || _.isString(config)) { config = readConfig(config); } - var parsed = parseOptions({ options: config, env: env, argv: argv }); + log(JSON.stringify(parsed, null, 4)); + this.system = parsed.system; this.sets = parsed.sets; + this._configs = _.mapValues(parsed.browsers, function(data, id) { return new BrowserConfig(id, this.system, data); }.bind(this)); @@ -51,9 +55,11 @@ Config.prototype.isCoverageEnabled = function() { return this.system.coverage.enabled; }; +Config.readRawConfig = readConfig; + function readConfig(filePath) { var config = configReader.read(filePath), - configDir = filePath? path.dirname(filePath) : process.cwd(); + configDir = filePath ? path.dirname(filePath) : process.cwd(); if (_.has(config, 'system.projectRoot')) { config.system.projectRoot = path.resolve(configDir, config.system.projectRoot); diff --git a/lib/config/options.js b/lib/config/options.js index 6e96a6f3a..865e7d27d 100644 --- a/lib/config/options.js +++ b/lib/config/options.js @@ -1,21 +1,25 @@ 'use strict'; -var path = require('path'), - configparser = require('gemini-configparser'), - _ = require('lodash'), - GeminiError = require('../errors/gemini-error'), - util = require('./util'), - - browserOptions = require('./browser-options'), - - is = util.is, - anyObject = util.anyObject, - resolveWithProjectRoot = util.resolveWithProjectRoot, - booleanOption = util.booleanOption, - positiveIntegerOption = util.positiveIntegerOption, - root = configparser.root, - section = configparser.section, - option = configparser.option, - map = configparser.map; + +const os = require('os'); +const path = require('path'); +const configparser = require('gemini-configparser'); +const _ = require('lodash'); +const GeminiError = require('../errors/gemini-error'); +const util = require('./util'); + +const browserOptions = require('./browser-options'); +const coreOptions = require('gemini-core').config.options; +const ENV_PREFIX = `${require('../../package').name}_`; + +const is = util.is; +const anyObject = util.anyObject; +const resolveWithProjectRoot = util.resolveWithProjectRoot; +const booleanOption = util.booleanOption; +const positiveIntegerOption = util.positiveIntegerOption; +const root = configparser.root; +const section = configparser.section; +const option = configparser.option; +const map = configparser.map; module.exports = root( section(_.extend(browserOptions.getTopLevel(), { @@ -28,9 +32,7 @@ module.exports = root( sourceRoot: option({ validate: is('string'), map: resolveWithProjectRoot, - defaultValue: function(config) { - return config.system.projectRoot; - } + defaultValue: (config) => config.system.projectRoot }), tempDir: option({ @@ -44,9 +46,11 @@ module.exports = root( parallelLimit: positiveIntegerOption(Infinity), + workers: positiveIntegerOption(os.cpus().length), + diffColor: option({ defaultValue: '#ff00ff', - validate: function(value) { + validate: (value) => { if (typeof value !== 'string') { throw new GeminiError('Field "diffColor" must be string'); } @@ -59,9 +63,19 @@ module.exports = root( coverage: section({ enabled: booleanOption(false), + map: option({ + defaultValue: () => { + return (url, rootUrl) => url.replace(rootUrl, '').replace(/^\//, ''); + }, + validate: (value) => { + if (!_.isFunction(value)) { + throw new GeminiError('"coverage.map" must be a function'); + } + } + }), exclude: option({ defaultValue: [], - validate: function(value) { + validate: (value) => { if (!_.isArray(value)) { throw new GeminiError('"coverage.exclude" must be an array'); } @@ -72,44 +86,28 @@ module.exports = root( } }), html: booleanOption(true) - }) - }), + }), - sets: map(section({ - files: option({ - defaultValue: 'gemini', - validate: function(value) { - if (!_.isArray(value) && !_.isString(value)) { - throw new GeminiError('"sets.files" must be an array or string'); + exclude: option({ + defaultValue: [], + validate: (value) => { + if (_.isString(value)) { + return; } - if (_.isArray(value) && !_.every(value, _.isString)) { - throw new GeminiError('"sets.files" must be an array of strings'); + if (!_.every(value, _.isString)) { + throw new GeminiError('"exclude" must be an array of strings'); } }, - map: function(val) { - return _.isString(val)? [val] : val; - } + map: (value) => [].concat(value) }), - browsers: option({ - defaultValue: function(config) { - return _.keys(config.browsers); - }, - validate: function(value, config) { - if (!_.isArray(value)) { - throw new GeminiError('"sets.browsers" must be an array'); - } - var unknownBrowsers = _.difference(value, _.keys(config.browsers)); - if (!_.isEmpty(unknownBrowsers)) { - throw new GeminiError('Unknown browsers for "sets.browsers": ' + unknownBrowsers.join(', ')); - } - } - }) - }), { - all: {} // Use `all` set with default values if no set specified in config + ctx: anyObject() }), + sets: coreOptions.sets, + browsers: map(section(browserOptions.getPerBrowser())) - })) + })), + {envPrefix: ENV_PREFIX} ); diff --git a/lib/config/util.js b/lib/config/util.js index 18d6bb1cf..2ad5f17c8 100644 --- a/lib/config/util.js +++ b/lib/config/util.js @@ -48,6 +48,14 @@ function parseBoolean(value) { } } +function parsePrimitive(str) { + try { + return JSON.parse(str); + } catch (error) { + throw new GeminiError('a value must be a primitive type'); + } +} + function positiveIntegerOption(defaultValue) { return option({ parseEnv: Number, @@ -70,7 +78,10 @@ function positiveIntegerOption(defaultValue) { } function anyObject() { - return map(option({})); + return map(option({ + parseEnv: parsePrimitive, + parseCli: parsePrimitive + })); } exports.is = is; diff --git a/lib/constants/runner-events.js b/lib/constants/events.js similarity index 66% rename from lib/constants/runner-events.js rename to lib/constants/events.js index dc15f4f4c..7507a335e 100644 --- a/lib/constants/runner-events.js +++ b/lib/constants/events.js @@ -1,15 +1,17 @@ 'use strict'; module.exports = { + CLI: 'cli', + INIT: 'init', + + AFTER_TESTS_READ: 'afterTestsRead', + START_RUNNER: 'startRunner', END_RUNNER: 'endRunner', BEGIN: 'begin', END: 'end', - BEGIN_SESSION: 'beginSession', - END_SESSION: 'endSession', - RETRY: 'retry', START_BROWSER: 'startBrowser', @@ -23,9 +25,13 @@ module.exports = { END_STATE: 'endState', INFO: 'info', - WARNING: 'warning', ERROR: 'err', // unable to call it `error` because `error` handling is a special case for EventEmitter - END_TEST: 'endTest', - CAPTURE: 'capture' + TEST_RESULT: 'testResult', + UPDATE_RESULT: 'updateResult', + + BEFORE_FILE_READ: 'beforeFileRead', + AFTER_FILE_READ: 'afterFileRead', + + INTERRUPT: 'interrupt' }; diff --git a/lib/coverage-level.js b/lib/coverage-level.js deleted file mode 100644 index ad46dfde2..000000000 --- a/lib/coverage-level.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -exports.FULL = 'full'; -exports.PARTIAL = 'partial'; -exports.NONE = 'none'; - -exports.merge = function(oldValue, newValue) { - oldValue = oldValue || exports.NONE; - if (oldValue === exports.FULL || newValue === exports.FULL) { - return exports.FULL; - } - - if (oldValue === exports.PARTIAL || newValue === exports.PARTIAL) { - return exports.PARTIAL; - } - - return exports.NONE; -}; diff --git a/lib/coverage.js b/lib/coverage.js index 95a31d2e1..42a52c61a 100644 --- a/lib/coverage.js +++ b/lib/coverage.js @@ -3,20 +3,19 @@ var inherit = require('inherit'), _ = require('lodash'), path = require('path'), - fs = require('fs'), url = require('url'), - q = require('q'), + Promise = require('bluebird'), chalk = require('chalk'), - qfs = require('q-io/fs'), - http = require('q-io/http'), + fs = require('fs-extra'), + fetch = require('node-fetch'), css = require('css'), - minimatch = require('minimatch'), + mm = require('micromatch'), coverage = require('gemini-coverage').api, - coverageLevel = require('./coverage-level'), + {coverage: {coverageLevel}} = require('gemini-core'), SourceMapConsumer = require('source-map').SourceMapConsumer; -module.exports = inherit({ +const Coverage = module.exports = inherit({ __constructor: function(config) { this.config = config; this.byURL = {}; @@ -26,16 +25,16 @@ module.exports = inherit({ }, addStatsForBrowser: function(stats, browserId) { - _.each(stats, function(coverage, url) { + _.forEach(stats, function(coverage, url) { if (coverage.ignored) { this._warnInnacurate(url, coverage.message); return; } this.byURL[url] = this.byURL[url] || { - sourceFile: this._urlToFilePath(url, this.config.forBrowser(browserId).rootUrl), + sourceFile: this._urlToFilePath(url, browserId), coverage: {} }; - _.assign(this.byURL[url].coverage, coverage, coverageLevel.merge); + _.assignWith(this.byURL[url].coverage, coverage, coverageLevel.merge); }.bind(this)); }, @@ -48,23 +47,26 @@ module.exports = inherit({ this._warned[url] = true; }, - _urlToFilePath: function(url, rootUrl) { - var relPath = url.replace(rootUrl, '').replace(/^\//, ''); - return path.resolve(this.config.system.sourceRoot, relPath); + _urlToFilePath: function(url, browserId) { + const config = this.config; + const rootUrl = config.forBrowser(browserId).rootUrl; + const relPath = config.system.coverage.map(url, rootUrl); + + return path.resolve(config.system.sourceRoot, relPath); }, processStats: function() { var _this = this; - return qfs.makeDirectory(this.covDir) - .fail(function(err) { + return fs.mkdirsAsync(this.covDir) + .catch(function(err) { // ignoring the fail if directory already exists. if (err.code !== 'EEXIST') { - return q.reject(err); + return Promise.reject(err); } }) .then(function() { - return q.all(Object.keys(_this.byURL).map(function(url) { + return Promise.all(Object.keys(_this.byURL).map(function(url) { return _this.processCSS(url); })) .then(function() { @@ -100,7 +102,7 @@ module.exports = inherit({ return readUrlOrFile(url, cssPath) .then(function(content) { var ast = css.parse(content); - return q.all([ + return Promise.all([ ast, content, _this.getSourceMap(ast, cssPath, url) @@ -131,9 +133,9 @@ module.exports = inherit({ return; } - var base64Prefix = 'data:application/json;base64,'; - if (_.contains(sourceMapUrl, base64Prefix)) { - var base64Str = sourceMapUrl.split(base64Prefix)[1], + var base64Prefix = /^data:application\/json;(?:charset=utf-8;)?base64,/; + if (base64Prefix.test(sourceMapUrl)) { + var base64Str = sourceMapUrl.replace(base64Prefix, ''), sourceMapStr = new Buffer(base64Str, 'base64').toString('utf8'); return new SourceMapConsumer(JSON.parse(sourceMapStr)); } @@ -142,9 +144,9 @@ module.exports = inherit({ url.resolve(cssUrl, sourceMapUrl), path.resolve(path.dirname(cssPath), sourceMapUrl) ) - .fail(function(err) { + .catch(function(err) { if (err.code !== 'ENOENT') { - return q.reject(err); + return Promise.reject(err); } }) .then(function(map) { @@ -193,7 +195,7 @@ module.exports = inherit({ // much benefit considering only one async call can be executed to guarantee the calling order. src = path.relative( this.config.system.sourceRoot, - fs.realpathSync(sourceStart.source? + fs.realpathSync(sourceStart.source ? path.resolve(opts.docDir, sourceStart.source) : opts.filePath) ), @@ -224,15 +226,16 @@ module.exports = inherit({ fileExcluded: function(path) { return this.config.system.coverage.exclude.some(function(excludePattern) { - return minimatch(path, excludePattern, {matchBase: true}); + return mm.isMatch(path, excludePattern, {matchBase: true}); }); }, writeStatsJson: function(data) { - return qfs.write( + return fs.writeFileAsync( path.join(this.covDir, 'coverage.json'), - JSON.stringify(data, null, 4) - ).thenResolve(data); + JSON.stringify(data, null, 4), + 'utf8' + ).then(() => data); }, prepareOutputStats: function() { @@ -276,6 +279,10 @@ module.exports = inherit({ percent: Math.round(stat.covered / stat.total * 100) }; } +}, { + create: function(config) { + return new Coverage(config); + } }); function getPosition(originalPos, file, map) { @@ -302,15 +309,17 @@ function getPosition(originalPos, file, map) { } function readUrlOrFile(url, file) { - return http.read({url: url}) - .fail(function(err) { - return qfs.read(file); - }) - .then(function(content) { - return content + ''; + return readUrl() + .catch(function() { + return fs.readFileAsync(file, 'utf8'); }); } +function readUrl(url) { + return Promise.resolve(fetch(url)) + .then((res) => res.text()); +} + function coverageToType(coverage) { switch (coverage) { case coverageLevel.FULL: diff --git a/lib/errors/cancelled-error.js b/lib/errors/cancelled-error.js new file mode 100644 index 000000000..450b5cc17 --- /dev/null +++ b/lib/errors/cancelled-error.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = class CancelledError extends Error { + constructor() { + super('Browser request was cancelled'); + this.name = 'CancelledError'; + } +}; diff --git a/lib/errors/gemini-error.js b/lib/errors/gemini-error.js index 9771411ca..f2dca1862 100644 --- a/lib/errors/gemini-error.js +++ b/lib/errors/gemini-error.js @@ -1,16 +1,10 @@ 'use strict'; -/** - * Special type of error that intended to be reported - * to user. Will not print stack trace by default. - */ -function GeminiError(message, advice) { - Error.captureStackTrace(this, GeminiError); - this.name = 'GeminiError'; - this.message = message; - this.advice = advice; -} -GeminiError.prototype = Object.create(Error.prototype); -GeminiError.prototype.constructor = GeminiError; +module.exports = class GeminiError extends Error { + constructor(message, advice) { + super(message); -module.exports = GeminiError; + this.name = 'GeminiError'; + this.advice = advice; + } +}; diff --git a/lib/errors/no-ref-image-error.js b/lib/errors/no-ref-image-error.js index a4c42cb25..0ad044a52 100644 --- a/lib/errors/no-ref-image-error.js +++ b/lib/errors/no-ref-image-error.js @@ -1,22 +1,14 @@ 'use strict'; -var inherit = require('inherit'), - StateError = require('./state-error'); +const StateError = require('./state-error'); -var NoRefImageError = inherit(StateError, { - /** - * @constructor - * @param {String} refImagePath - * @param {StateResult} result - */ - __constructor: function(refImagePath, currentPath) { - this.name = 'NoRefImageError'; - this.message = 'Can not find reference image at ' + refImagePath + '.\n' + - 'Run `gemini update` command to capture all reference images.'; +module.exports = class NoRefImageError extends StateError { + constructor(refImg = {}, currImg = {}) { + super(`Can not find reference image at ${refImg.path}.\n` + + 'Run `gemini update` command to capture all reference images.'); - this.currentPath = currentPath; - this.refImagePath = refImagePath; + this.name = 'NoRefImageError'; + this.refImg = refImg; + this.currImg = currImg; } -}); - -module.exports = NoRefImageError; +}; diff --git a/lib/errors/state-error.js b/lib/errors/state-error.js index a5c3af4f3..4e9c19c5a 100644 --- a/lib/errors/state-error.js +++ b/lib/errors/state-error.js @@ -4,14 +4,12 @@ * Non-fatal error, occurred during state run. * Fails only single state, not the whole app. */ -function StateError(message, originalError) { - Error.captureStackTrace(this, StateError); - this.name = 'StateError'; - this.message = message; - this.originalError = originalError; -} -StateError.prototype = Object.create(Error.prototype); -StateError.prototype.constructor = StateError; +module.exports = class StateError extends Error { + constructor(message, originalError) { + super(message); -module.exports = StateError; + this.name = 'StateError'; + this.originalError = originalError; + } +}; diff --git a/lib/errors/utils.js b/lib/errors/utils.js index 494ae3326..bf87a0ea4 100644 --- a/lib/errors/utils.js +++ b/lib/errors/utils.js @@ -7,7 +7,7 @@ const StateError = require('./state-error'); exports.fromPlainObject = e => { if (e.name === 'NoRefImageError') { - return new NoRefImageError(e.refImagePath, e.currentPath); + return new NoRefImageError(e.refImg, e.currImg); } if (e.name === 'StateError') { return new StateError(e.message); @@ -17,6 +17,7 @@ exports.fromPlainObject = e => { exports.cloneError = (e) => { const clone = new e.constructor(e.message); + clone.stack = e.stack; return _.extend(clone, e); }; diff --git a/lib/fail-collector.js b/lib/fail-collector.js deleted file mode 100644 index 346a25ba0..000000000 --- a/lib/fail-collector.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; - -var q = require('q'), - format = require('util').format, - inherit = require('inherit'), - _ = require('lodash'), - EventEmitter = require('events').EventEmitter, - RunnerEvents = require('./constants/runner-events'), - NoRefImageError = require('./errors/no-ref-image-error'); - -var FailCollector = inherit(EventEmitter, { - __constructor: function(config) { - this._config = config; - this._retriesPerformed = 0; - this._failedSuites = {}; - }, - - tryToSubmitStateResult: function(candidate) { - if (!candidate.hasOwnProperty('equal') || candidate.equal === true) { - return false; - } - return this.tryToSubmitError(candidate); - }, - - tryToSubmitError: function(candidate) { - if (candidate instanceof NoRefImageError) { - return false; - } - - FailCollector._validate(candidate); - - if (this._isNeedToSubmit(candidate)) { - this._submitForRetry(candidate); - return true; - } - return false; - }, - - retry: function(retryFunc) { - var failedSuites = this._flatFailedSuites(); - - this._failedSuites = {}; - this._retriesPerformed++; - - return failedSuites.length - ? retryFunc(failedSuites) - : q.resolve(); - }, - - _validate: function(retryCandidate) { - ['suite', 'browserId'].forEach(function(requiredField) { - if (!retryCandidate[requiredField]) { - throw new Error(format('Retry attempt failed. Missing required data: %s', requiredField)); - } - }); - }, - - _isNeedToSubmit: function(candidate) { - var retries = this._config.forBrowser(candidate.browserId).retry; - - return retries > this._retriesPerformed; - }, - - _submitForRetry: function(candidate) { - var suite = candidate.suite, - suiteInfo = this._failedSuites[suite.fullName]; - - if (!suiteInfo) { - this._failedSuites[suite.fullName] = { - suite: suite, - browsers: [candidate.browserId] - }; - } else { - suiteInfo.browsers = _.union(suiteInfo.browsers, [candidate.browserId]); - } - - this._emitRetry(candidate); - }, - - _emitRetry: function(candidate) { - this.emit(RunnerEvents.RETRY, _.extend(candidate, { - attempt: this._retriesPerformed, - retriesLeft: this._config.forBrowser(candidate.browserId).retry - this._retriesPerformed - })); - }, - - _flatFailedSuites: function() { - return _.map(this._failedSuites, function(failedSuiteInfo) { - return _.extend(failedSuiteInfo.suite, { - browsers: failedSuiteInfo.browsers - }); - }); - } -}, { - _validate: function(retryCandidate) { - ['suite', 'browserId'].forEach(function(requiredField) { - if (!retryCandidate[requiredField]) { - throw new Error(format('Retry attempt failed. Missing required data: %s', requiredField)); - } - }); - } -}); - -module.exports = FailCollector; diff --git a/lib/gemini.js b/lib/gemini.js index 0a430d0af..1e637f6fa 100644 --- a/lib/gemini.js +++ b/lib/gemini.js @@ -1,106 +1,149 @@ 'use strict'; -var Q = require('q'), - qDebugMode = require('q-debug-mode'), - QEmitter = require('qemitter'), - debug = require('debug'), - util = require('util'), - _ = require('lodash'), - chalk = require('chalk'), - Runner = require('./runner'), - StateProcessor = require('./state-processor'), - Config = require('./config'), - readTests = require('./test-reader'), - SuiteCollection = require('./suite-collection'), +const debug = require('debug'); +const chalk = require('chalk'); +const _ = require('lodash'); +const PassthroughEmitter = require('./passthrough-emitter'); +const Promise = require('bluebird'); +const pluginsLoader = require('plugins-loader'); +const gracefulFs = require('graceful-fs'); + +const Config = require('./config'); +const GeminiError = require('./errors/gemini-error'); +const readTests = require('./test-reader'); +const Runner = require('./runner'); +const Events = require('./constants/events'); +const StateProcessor = require('./state-processor'); +const SuiteCollection = require('./suite-collection'); +const {temp} = require('gemini-core'); + +const PREFIX = require('../package').name + '-'; + +Promise.promisifyAll(require('fs-extra')); + +// patch fs module prototype for preventing EMFILE error (too many open files) +gracefulFs.gracefulify(require('fs')); + +const parseBrowsers = (browsers) => { + return browsers && browsers.replace(/\s/g, '').split(','); +}; + +module.exports = class Gemini extends PassthroughEmitter { + static create(config, allowOverrides) { + return new Gemini(config, allowOverrides); + } - RunnnerStats = require('./stats'), - RunnerEvents = require('./constants/runner-events'), + static readRawConfig(filePath) { + return Config.readRawConfig(filePath); + } - GeminiError = require('./errors/gemini-error'), + constructor(config, allowOverrides) { + super(); - temp = require('./temp'); + this.config = new Config(config, allowOverrides); -// Hack for node@0.10 and lower -// Remove restriction for maximum open concurrent sockets -require('http').globalAgent.maxSockets = Infinity; + this.events = Events; + this.SuiteCollection = SuiteCollection; -function Gemini(config, allowOverrides) { - QEmitter.call(this); - this.config = new Config(config, allowOverrides); + setupLog(this.config.system.debug); + this._loadPlugins(); + } - setupLog(this.config.system.debug); + extendCli(parser) { + this.emit(Events.CLI, parser); + } - var _this = this; + getScreenshotPath(suite, stateName, browserId) { + return this.config.forBrowser(browserId).getScreenshotPath(suite, stateName); + } - require('./plugins').load(_this, this.config); + getBrowserCapabilites(browserId) { + return this.config.forBrowser(browserId).desiredCapabilities; + } - function run(stateProcessor, paths, options) { - if (!options) { - //if there are only two arguments, they are - //(stateProcessor, options) and paths are - //the default. - options = paths; - paths = undefined; + getValidBrowsers(browsers) { + return _.intersection(browsers, this.browserIds); + } + + checkUnknownBrowsers(browsers) { + const browsersFromConfig = this.browserIds; + const unknownBrowsers = _.difference(browsers, browsersFromConfig); + + if (unknownBrowsers.length) { + console.warn( + `${chalk.yellow('WARNING:')} Unknown browsers id: ${unknownBrowsers.join(', ')}.\n` + + `Use one of the browser ids specified in config file: ${browsersFromConfig.join(', ')}` + ); } - options = options || {}; - options.reporters = options.reporters || []; + } - temp.init(_this.config.system.tempDir); + get browserIds() { + return this.config.getBrowserIds(); + } - var runner = new Runner(_this.config, stateProcessor), - envBrowsers = process.env.GEMINI_BROWSERS - && process.env.GEMINI_BROWSERS.replace(/\s/g, '').split(','), - browsers = options.browsers || envBrowsers; + update(paths, options) { + return this._exec(() => this._run(StateProcessor.createScreenUpdater(this.config, options), paths, options)); + } - if (browsers) { - var browsersFromConfig = _this.browserIds, - validBrowsers = _.intersection(browsers, browsersFromConfig), - unknownBrowsers = _.difference(browsers, browsersFromConfig); + test(paths, options) { + return this._exec(() => this._run(StateProcessor.createTester(this.config), paths, options)); + } - if (unknownBrowsers.length) { - console.warn(util.format( - '%s Unknown browsers id: %s. Use one of the browser ids specified in config file: %s', - chalk.yellow('WARNING:'), unknownBrowsers.join(', '), browsersFromConfig.join(', ') - )); - } + readTests(paths, options = {}) { + return this._exec(() => this._readTests(paths, options)); + } - runner.setTestBrowsers(validBrowsers); - } + halt(err, timeout = 60000) { + this._runner.cancel(); - return getTests_(paths, options.grep) - .then(function(suiteCollection) { - return _this.emitAndWait(RunnerEvents.START_RUNNER, runner) - .thenResolve(suiteCollection); - }) - .then(function(suiteCollection) { - var suites = suiteCollection.allSuites(); + this._criticalError = new GeminiError(err); - options.reporters.forEach(_.partial(applyReporter, runner)); + if (timeout === 0) { + return; + } - var stats = new RunnnerStats(runner); + setTimeout(() => { + console.error(chalk.red('Forcing shutdown...')); + process.exit(1); + }, timeout).unref(); + } - return runner.run(suites) - .thenResolve(stats.get()); - }) - .then(notifyEndRunner, function(e) { - return notifyEndRunner().thenReject(e); + _exec(fn) { + return this._init() + .then(() => fn()) + .finally(() => { + if (this._criticalError) { + throw this._criticalError; + } }); + } - function getTests_(source, grep) { - return source instanceof SuiteCollection - ? Q.resolve(source) - : _this.readTests(source, grep); - } + _init() { + this._init = () => Promise.resolve(); // init only once + return this.emitAndWait(Events.INIT); + } - function notifyEndRunner(data) { - return _this.emitAndWait(RunnerEvents.END_RUNNER, runner, data).thenResolve(data); - } + _loadPlugins() { + pluginsLoader.load(this, this.config.system.plugins, PREFIX); } - this.readTests = function(paths, grep) { + _readTests(paths, options) { + options = _.assignIn(options, {paths}); + + return readTests(this, this.config, options) + .then((rootSuite) => { + if (options.grep) { + applyGrep_(options.grep, rootSuite); + } + + const suiteCollection = new SuiteCollection(rootSuite.children); + this.emit(Events.AFTER_TESTS_READ, {suiteCollection}); + return suiteCollection; + }); + function applyGrep_(grep, suite) { if (!suite.hasStates) { - _.clone(suite.children).forEach(function(child) { + _.clone(suite.children).forEach((child) => { applyGrep_(grep, child, suite); }); } else { @@ -113,69 +156,87 @@ function Gemini(config, allowOverrides) { suite.parent.removeChild(suite); } } + } - return readTests(paths, this.config) - .then(function(rootSuite) { - if (grep) { - applyGrep_(grep, rootSuite); - } + _run(stateProcessor, paths, options) { + if (!options) { + //if there are only two arguments, they are + //(stateProcessor, options) and paths are + //the default. + options = paths; + paths = undefined; + } + options = options || {}; + options.reporters = options.reporters || []; - return new SuiteCollection(rootSuite.children); - }); - }; - - this.update = function(paths, options) { - return run( - StateProcessor.createScreenUpdater(options), - paths, - options - ); - }; - - this.test = function(paths, options) { - return run( - StateProcessor.createTester(this.config), - paths, - options - ); - }; - - this.getScreenshotPath = function(suite, stateName, browserId) { - return this.config.forBrowser(browserId).getScreenshotPath(suite, stateName); - }; + temp.init(this.config.system.tempDir); - this.getBrowserCapabilites = function(browserId) { - return this.config.forBrowser(browserId).desiredCapabilities; - }; + const runner = this._runner = Runner.create(this.config, stateProcessor); + const envBrowsers = parseBrowsers(process.env.GEMINI_BROWSERS); + const envSkipBrowsers = parseBrowsers(process.env.GEMINI_SKIP_BROWSERS); - this.SuiteCollection = SuiteCollection; + options.browsers = options.browsers || envBrowsers; - Object.defineProperty(this, 'browserIds', { - enumerable: true, - get: function() { - return this.config.getBrowserIds(); + this._passThroughEvents(runner); + + // it is important to require signal handler here in order to guarantee subscribing to "INTERRUPT" event + require('./signal-handler').on(Events.INTERRUPT, (data) => { + this.emit(Events.INTERRUPT, data); + + runner.cancel(); + }); + + if (options.browsers) { + this.checkUnknownBrowsers(options.browsers); } - }); -} -// Gemini needs to inherit from QEmitter rather then -// EventEmmiter because it needs to allow `startRunner` -// event handler delay the execution of tests -util.inherits(Gemini, QEmitter); + const getTests = (source, options) => { + return source instanceof SuiteCollection + ? Promise.resolve(source) + : this._readTests(source, options); + }; + + return getTests(paths, options) + .then((suiteCollection) => { + this.checkUnknownBrowsers(envSkipBrowsers); + + const validSkippedBrowsers = this.getValidBrowsers(envSkipBrowsers); + + suiteCollection.skipBrowsers(validSkippedBrowsers); + options.reporters.forEach((reporter) => applyReporter(runner, reporter)); + + let testsStatistic; + runner.on(Events.END, (stats) => testsStatistic = stats); + + return runner.run(suiteCollection) + .then(() => testsStatistic); + }); + } + + _passThroughEvents(runner) { + this.passthroughEvent(runner, _.values(Events)); + } +}; function applyReporter(runner, reporter) { if (typeof reporter === 'string') { + reporter = {name: reporter}; + } + if (typeof reporter === 'object') { + const reporterPath = reporter.path; try { - reporter = require('./reporters/' + reporter); + reporter = require('./reporters/' + reporter.name); } catch (e) { if (e.code === 'MODULE_NOT_FOUND') { - throw new GeminiError('No such reporter: ' + reporter); + throw new GeminiError('No such reporter: ' + reporter.name); } throw e; } + + return reporter(runner, reporterPath); } if (typeof reporter !== 'function') { - throw new TypeError('Reporter must be a string or a function'); + throw new TypeError('Reporter must be a string, an object or a function'); } reporter(runner); @@ -183,9 +244,9 @@ function applyReporter(runner, reporter) { function setupLog(isDebug) { if (isDebug) { - qDebugMode(Q); + Promise.config({ + longStackTraces: true + }); debug.enable('gemini:*'); } } - -module.exports = Gemini; diff --git a/lib/image.js b/lib/image.js deleted file mode 100644 index 002421ca7..000000000 --- a/lib/image.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -const q = require('q'); -const looksSame = require('looks-same'); -const PngImg = require('png-img'); -const utils = require('png-img/utils'); - -class Image { - constructor(buffer) { - this._img = new PngImg(buffer); - } - - crop(rect, opts) { - rect = this._scale(rect, (opts || {}).scaleFactor); - const imageSize = this.getSize(); - this._img.crop( - Math.max(rect.left, 0), - Math.max(rect.top, 0), - Math.min(imageSize.width, rect.width), - Math.min(imageSize.height, rect.height) - ); - return q.resolve(this); - } - - getSize() { - return this._img.size(); - } - - getRGBA(x, y) { - return this._img.get(x, y); - } - - save(file) { - return q.ninvoke(this._img, 'save', file); - } - - clear(area, opts) { - area = this._scale(area, (opts || {}).scaleFactor); - this._img.fill( - area.left, - area.top, - area.width, - area.height, - '#000000' - ); - } - - join(newImage) { - const imageSize = this.getSize(); - this._img - .setSize(imageSize.width, imageSize.height + newImage.getSize().height) - .insert(newImage._img, 0, imageSize.height); - - return this; - } - - _scale(area, scaleFactor) { - scaleFactor = scaleFactor || 1; - return { - left: area.left * scaleFactor, - top: area.top * scaleFactor, - width: area.width * scaleFactor, - height: area.height * scaleFactor - }; - } - - static fromBase64(base64) { - return new Image(new Buffer(base64, 'base64')); - } - - static RGBToString(rgb) { - return utils.RGBToString(rgb); - } - - static compare(path1, path2, opts) { - opts = opts || {}; - const compareOptions = { - ignoreCaret: opts.canHaveCaret, - pixelRatio: opts.pixelRatio - }; - if ('tolerance' in opts) { - compareOptions.tolerance = opts.tolerance; - } - return q.nfcall(looksSame, path1, path2, compareOptions); - } - - static buildDiff(opts) { - const diffOptions = { - reference: opts.reference, - current: opts.current, - diff: opts.diff, - highlightColor: opts.diffColor - }; - if ('tolerance' in opts) { - diffOptions.tolerance = opts.tolerance; - } - return q.nfcall(looksSame.createDiff, diffOptions); - } -} - -module.exports = Image; diff --git a/lib/passthrough-emitter.js b/lib/passthrough-emitter.js new file mode 100644 index 000000000..090417d85 --- /dev/null +++ b/lib/passthrough-emitter.js @@ -0,0 +1,35 @@ +'use strict'; + +const _ = require('lodash'), + AsyncEmitter = require('gemini-core').events.AsyncEmitter; + +module.exports = class PassthroughEmitter extends AsyncEmitter { + // Allow to pass only one argument with event + emit(type, data) { + return super.emit(type, data); + } + + emitAndWait(type, data) { + return super.emitAndWait(type, data, {shouldWait: true}); + } + + /** + * Emit event emitted by emitter + * @param {EventEmitter} emitter + * @param {String|String[]} event or array of events to passthrough + */ + passthroughEvent(emitter, event) { + if (_.isArray(event)) { + event.forEach(this.passthroughEvent.bind(this, emitter)); + return; + } + + emitter.on(event, function(data, opts) { + if (opts && opts.shouldWait) { + return this.emitAndWait(event, data); + } else { + this.emit(event, data); + } + }.bind(this)); + } +}; diff --git a/lib/path-utils.js b/lib/path-utils.js deleted file mode 100644 index 00b24faff..000000000 --- a/lib/path-utils.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -var q = require('q'), - fs = require('q-io/fs'), - _ = require('lodash'); - -exports.expandPath = function expandPath(path, root) { - if (root && !fs.isAbsolute(path)) { - path = fs.join(root, path); - } - - return fs.stat(path) - .then(function(stat) { - if (!stat.isDirectory()) { - return [path]; - } - return fs.listTree(path, function(path) { - return fs.extension(path) === '.js'; - }); - }) - .fail(function(e) { - return []; - }) - .then(function(paths) { - return paths.map(fs.absolute.bind(fs)); - }); -}; - -exports.expandPaths = function expandPaths(paths, root) { - return _(paths) - .map(_.partial(exports.expandPath, _, root)) - .thru(q.all).value() - .then(_.flatten); -}; diff --git a/lib/plugins.js b/lib/plugins.js deleted file mode 100644 index 930ed8a8e..000000000 --- a/lib/plugins.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; -var _ = require('lodash'); -var prefix = 'gemini-'; - -module.exports = { - load: function(gemini, options) { - _.chain(options.system.plugins) - .pairs() - .map(function(pair) { - return {name: pair[0], opts: pair[1]}; - }) - .reject(function(plugin) { - return plugin.opts === false; - }) - .map(function(plugin) { - return { - name: _.startsWith(plugin.name, prefix)? plugin.name : prefix + plugin.name, - opts: plugin.opts === true? {} : plugin.opts - }; - }) - .forEach(function(plugin) { - require(plugin.name)(gemini, plugin.opts); - }) - .value(); - } -}; diff --git a/lib/reporters/flat-factory/flat-verbose.js b/lib/reporters/flat-factory/flat-verbose.js index 08d34c4f3..78ef910f9 100644 --- a/lib/reporters/flat-factory/flat-verbose.js +++ b/lib/reporters/flat-factory/flat-verbose.js @@ -1,19 +1,21 @@ 'use strict'; -var Flat = require('./flat'), - inherit = require('inherit'); +const _ = require('lodash'); +const chalk = require('chalk'); +const Flat = require('./flat'); -module.exports = inherit(Flat, { - _formatStateInfo: function(result) { - var tmpl = result.state - ? ' ${state} ${chalk.underline(name)} [${chalk.yellow(bId)}: ${chalk.blue(sId)}]' - : ' ${state} [${chalk.yellow(bId)}: ${chalk.blue(sId)}]'; +module.exports = class FlatVerbose extends Flat { + _formatStateInfo(result) { + const {suite, state, browserId, sessionId = 'unknown session id'} = result; + const suiteFullname = suite.path.join(' '); + const stateName = state ? `${chalk.underline(state.name)}` : ''; - return this._compile(tmpl, { - state: result.suite.path.join(' '), - name: result.state && result.state.name, - bId: result.browserId, - sId: result.sessionId || 'unknown session id' - }); + const session = suite.shouldSkip(browserId) + ? '' + : `: ${chalk.blue(sessionId)}`; + + const browserInfo = `[${chalk.yellow(browserId)}${session}]`; + + return _([suiteFullname, stateName, browserInfo]).compact().join(' '); } -}); +}; diff --git a/lib/reporters/flat-factory/flat.js b/lib/reporters/flat-factory/flat.js index 373fa0a94..f86380b9b 100644 --- a/lib/reporters/flat-factory/flat.js +++ b/lib/reporters/flat-factory/flat.js @@ -1,97 +1,87 @@ 'use strict'; -var inherit = require('inherit'), - _ = require('lodash'), - chalk = require('chalk'), - logger = require('../../utils').logger, - TestCounter = require('../utils/test-counter'), - - RunnerEvents = require('../../constants/runner-events'), - - ICON_SUCCESS = chalk.green('\u2713'), - ICON_FAIL = chalk.red('\u2718'), - ICON_WARN = chalk.bold.yellow('!'), - ICON_RETRY = chalk.yellow('⟳'); - -module.exports = inherit({ - __constructor: function() { - this._counter = new TestCounter(); - }, - - attachRunner: function(runner) { - runner.on(RunnerEvents.END_TEST, this._onEndTest.bind(this)); - runner.on(RunnerEvents.RETRY, this._onRetry.bind(this)); - runner.on(RunnerEvents.CAPTURE, this._onCapture.bind(this)); - runner.on(RunnerEvents.ERROR, this._onError.bind(this)); - runner.on(RunnerEvents.WARNING, this._onWarning.bind(this)); - runner.on(RunnerEvents.END, this._onEnd.bind(this)); - runner.on(RunnerEvents.INFO, this._onInfo.bind(this)); - runner.on(RunnerEvents.SKIP_STATE, this._onSkipState.bind(this)); - }, - - _compile: function(tmpl, data) { - return _.template(tmpl, { - imports: { - chalk: chalk - } - })(data); - }, - - _onEndTest: function(result) { - var handler = result.equal? this._onCapture : this._onError; - handler.call(this, result); - }, - - _onRetry: function(result) { - logger.log(ICON_RETRY + this._formatRetryInfo(result)); - this._logError(result); +const _ = require('lodash'); +const chalk = require('chalk'); + +const logger = require('../../utils').logger; + +const Events = require('../../constants/events'); + +const ICON_SUCCESS = chalk.green('✓'); +const ICON_NOT_UPDATED = chalk.gray('✓'); +const ICON_FAIL = chalk.red('✘'); +const ICON_WARN = chalk.bold.yellow('!'); +const ICON_RETRY = chalk.yellow('⟳'); + +module.exports = class Flat { + attachRunner(runner) { + runner.on(Events.TEST_RESULT, this._onTestResult.bind(this)); + runner.on(Events.UPDATE_RESULT, this._onUpdateResult.bind(this)); + runner.on(Events.RETRY, this._onRetry.bind(this)); + runner.on(Events.ERROR, this._onError.bind(this)); + runner.on(Events.END, this._onEnd.bind(this)); + runner.on(Events.INFO, this._onInfo.bind(this)); + runner.on(Events.SKIP_STATE, this._onSkipState.bind(this)); + } - this._counter.onRetry(result); - }, + _onTestResult(result) { + const handler = result.equal ? this._onPassed : this._onError; + handler.call(this, result); + } - _onCapture: function(result) { - logger.log(ICON_SUCCESS + this._formatStateInfo(result)); - this._counter.onPassed(result); - }, + _onUpdateResult(result) { + const handler = result.updated ? this._onUpdated : this._onNotUpdated; + handler.call(this, result); + } - _onError: function(result) { - logger.log(ICON_FAIL + this._formatStateInfo(result)); + _onRetry(result) { + logger.log(`${ICON_RETRY} ${this._formatRetryInfo(result)}`); this._logError(result); + } + + _onPassed(result) { + logger.log(`${ICON_SUCCESS} ${this._formatStateInfo(result)}`); + } - this._counter.onFailed(result); - }, + _onUpdated(result) { + logger.log(`${ICON_SUCCESS} ${this._formatStateInfo(result)}`); + } - _onWarning: function(result) { - logger.log(ICON_WARN + this._formatStateInfo(result)); - logger.warn(result.message); + _onNotUpdated(result) { + logger.log(`${ICON_NOT_UPDATED} ${this._formatStateInfo(result)}`); + } - this._counter.onSkipped(result); - }, + _onError(result) { + logger.log(`${ICON_FAIL} ${this._formatStateInfo(result)}`); + this._logError(result); + } - _onSkipState: function(result) { - logger.log(ICON_WARN + this._formatStateInfo(result) - + (result.suite.skipComment? chalk.yellow(' reason: ' + result.suite.skipComment) : '')); + _onSkipState(result) { + const skipReason = result.suite.skipComment + ? chalk.yellow('reason: ' + result.suite.skipComment) + : ''; - this._counter.onSkipped(result); - }, + logger.log(`${ICON_WARN} ${this._formatStateInfo(result)} ${skipReason}`); + } - _onInfo: function(result) { + _onInfo(result) { logger.warn(result.message); - }, - - _onEnd: function() { - var result = this._counter.getResult(); + } - logger.log('Total: %s Passed: %s Failed: %s Skipped: %s Retries: %s', - chalk.underline(result.total), - chalk.green(result.passed), - chalk.red(result.failed), - chalk.cyan(result.skipped), - chalk.cyan(result.retries) - ); - }, + _onEnd(result) { + const message = [ + 'Total: ' + chalk.underline(result.total), + result.updated && 'Updated: ' + chalk.green(result.updated), + 'Passed: ' + (result.updated && chalk.grey(result.passed) || chalk.green(result.passed)), + 'Failed: ' + chalk.red(result.failed), + 'Skipped: ' + chalk.cyan(result.skipped), + 'Retries: ' + chalk.cyan(result.retries) + ]; + + logger.log(_.compact(message).join(' ')); + } - _logError: function(result) { + _logError(result) { if (result.message) { logger.error(result.message); } @@ -99,26 +89,20 @@ module.exports = inherit({ if (result.originalError && result.originalError.stack) { logger.error(result.originalError.stack); } - }, - - _formatRetryInfo: function(result) { - var tmpl = '${stateInfo} will be retried. Retries left: ${chalk.yellow(retriesLeft)}'; - - return this._compile(tmpl, { - stateInfo: this._formatStateInfo(result), - retriesLeft: result.retriesLeft - }); - }, - - _formatStateInfo: function(result) { - var tmpl = result.state - ? ' ${state} ${chalk.underline(name)} [${chalk.yellow(id)}]' - : ' ${state} [${chalk.yellow(id)}]'; - - return this._compile(tmpl, { - state: result.suite.path.join(' '), - name: result.state && result.state.name, - id: result.browserId - }); } -}); + + _formatRetryInfo(result) { + const stateInfo = this._formatStateInfo(result); + const retriesLeft = result.retriesLeft; + + return `${stateInfo} will be retried. Retries left: ${chalk.yellow(retriesLeft)}`; + } + + _formatStateInfo(result) { + const suite = result.suite.path.join(' '); + const state = result.state && chalk.underline(result.state.name); + const browserId = `[${chalk.yellow(result.browserId)}]`; + + return _([suite, state, browserId]).compact().join(' '); + } +}; diff --git a/lib/reporters/flat-factory/index.js b/lib/reporters/flat-factory/index.js index 784b5122c..e6fbd44d8 100644 --- a/lib/reporters/flat-factory/index.js +++ b/lib/reporters/flat-factory/index.js @@ -1,16 +1,16 @@ 'use strict'; -var Flat = require('./flat'), - FlatVerbose = require('./flat-verbose'); +const Flat = require('./flat'); +const FlatVerbose = require('./flat-verbose'); + +const make = (Ctr) => { + return (runner) => { + const reporter = new Ctr(); + reporter.attachRunner(runner); + }; +}; module.exports = { mkFlat: make(Flat), mkFlatVerbose: make(FlatVerbose) }; - -function make(Ctr) { - return function(runner) { - var reporter = new Ctr(); - reporter.attachRunner(runner); - }; -} diff --git a/lib/reporters/html/index.js b/lib/reporters/html/index.js deleted file mode 100644 index 23e3b020c..000000000 --- a/lib/reporters/html/index.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; - -var path = require('path'), - - q = require('q'), - fs = require('q-io/fs'), - - view = require('./view'), - ViewModel = require('./view-model'), - lib = require('./lib'), - chalk = require('chalk'), - logger = require('../../utils').logger, - - RunnerEvents = require('../../constants/runner-events'); - -/** - * @param {String} srcPath - * @param {String} destPath - * @returns {Q} - */ -function copyImage(srcPath, destPath) { - return makeDirFor(destPath) - .then(fs.copy.bind(fs, srcPath, destPath)); -} - -/** - * @param {TestStateResult} result - * @param {String} destPath - * @returns {Q} - */ -function saveDiff(result, destPath) { - return makeDirFor(destPath) - .then(result.saveDiffTo.bind(result, destPath)); -} - -/** - * @param {String} destPath - */ -function makeDirFor(destPath) { - return fs.makeTree(path.dirname(destPath)); -} - -function prepareViewData(runner) { - var result = q.defer(), - model = new ViewModel(); - - runner.on(RunnerEvents.SKIP_STATE, model.addSkipped.bind(model)); - - runner.on(RunnerEvents.END_TEST, function(r) { - if (r.equal) { - model.addSuccess(r); - } else { - model.addFail(r); - } - }); - - runner.on(RunnerEvents.RETRY, model.addRetry.bind(model)); - - runner.on(RunnerEvents.ERROR, model.addError.bind(model)); - runner.on(RunnerEvents.WARNING, model.addWarning.bind(model)); - - runner.on(RunnerEvents.END, function() { - result.resolve(model.getResult()); - }); - - return result.promise; -} - -function logError(e) { - console.error(e.stack); -} - -function logPathToHtmlReport() { - const reportPath = `file://${path.resolve('gemini-report/index.html')}`; - - logger.log(`Your HTML report is here: ${chalk.yellow(reportPath)}`); -} - -function prepareImages(runner) { - var imagesReady = q.defer(), - queue = q(true); - - runner.on(RunnerEvents.WARNING, function(testResult) { - queue = queue.then(function() { - return copyImage(testResult.currentPath, lib.currentAbsolutePath(testResult)); - }); - }); - - runner.on(RunnerEvents.ERROR, function(testResult) { - queue = queue.then(function() { - return handleErrorEvent_(testResult); - }); - }); - - runner.on(RunnerEvents.RETRY, function(testResult) { - queue = queue.then(function() { - return testResult.hasOwnProperty('equal') - ? handleEndTestEvent_(testResult) - : handleErrorEvent_(testResult); - }); - }); - - runner.on(RunnerEvents.END_TEST, function(testResult) { - queue = queue.then(function() { - return handleEndTestEvent_(testResult); - }); - }); - - runner.on(RunnerEvents.END, function() { - logPathToHtmlReport(); - - queue.then(imagesReady.resolve, imagesReady.reject); - }); - - return imagesReady.promise; - - function handleEndTestEvent_(testResult) { - return q.all([ - copyImage(testResult.currentPath, lib.currentAbsolutePath(testResult)), - copyImage(testResult.referencePath, lib.referenceAbsolutePath(testResult)), - testResult.equal || saveDiff(testResult, lib.diffAbsolutePath(testResult)) - ]); - } - - function handleErrorEvent_(testResult) { - var src = testResult.imagePath || testResult.currentPath; - - return src && copyImage(src, lib.currentAbsolutePath(testResult)); - } -} - -module.exports = function htmlReporter(tester) { - q.all([ - prepareViewData(tester), - prepareImages(tester) - ]) - .spread(view.createHtml) - .then(view.save) - .fail(logError) - .done(); -}; diff --git a/lib/reporters/html/lib.js b/lib/reporters/html/lib.js deleted file mode 100644 index c5be856c8..000000000 --- a/lib/reporters/html/lib.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - path = require('path'), - - REPORT_OUT_DIR = 'gemini-report', - - referencePath = _.partial(createPath, 'ref'), - currentPath = _.partial(createPath, 'current'), - diffPath = _.partial(createPath, 'diff'), - - absolutePath = _.partial(path.resolve, REPORT_OUT_DIR); - -/** - * @param {String} kind - одно из значение 'ref', 'current', 'diff' - * @param {StateResult} result - * @returns {String} - */ -function createPath(kind, result) { - var retrySuffix = _.isUndefined(result.attempt)? '' : `_${result.attempt}`; - - var components = [].concat('images', result.suite.path, result.state.name, result.browserId + '~' + kind + retrySuffix + '.png'); - return path.join.apply(null, components); -} - -module.exports = { - REPORT_DIR: REPORT_OUT_DIR, - - referencePath: referencePath, - currentPath: currentPath, - diffPath: diffPath, - - referenceAbsolutePath: _.compose(absolutePath, referencePath), - currentAbsolutePath: _.compose(absolutePath, currentPath), - diffAbsolutePath: _.compose(absolutePath, diffPath) -}; diff --git a/lib/reporters/html/static/report.css b/lib/reporters/html/static/report.css deleted file mode 100644 index c86756c3d..000000000 --- a/lib/reporters/html/static/report.css +++ /dev/null @@ -1,235 +0,0 @@ -.report { - font: 14px Helvetica Neue, Arial, sans-serif; -} - -.summary__key { - font-weight: bold; - display: inline; -} - -.summary__key::after { - content: ':'; -} - -.summary__key_has-fails { - color: #c00; -} - -.summary__value { - margin-left: 5px; - margin-right: 20px; - display: inline; -} - -.button { - background: #fff; - border: 1px solid #ccc; - border-radius: 2px; - outline: 0; -} - -.button:hover { - border-color: #555; -} - -.button.pressed, -.button:active { - background: #eee; -} - -.image-box { - padding: 5px; - border: 1px solid #ccc; - background: #c9c9c9; -} - -.image-box__image { - padding: 0 5px; - display: inline-block; - vertical-align: top; -} - -.image-box_warning.image-box { - background-color: #ffe0b2; -} - -.image-box_warning .reason { - background: none; - border: none; -} - -.section__title { - font-weight: bold; - cursor: pointer; - - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.section__title:before, .meta-info__switcher:before { - display: inline-block; - margin-right: 2px; - vertical-align: middle; - content: '\25bc'; - color: black; -} - -.section_status_success > .section__title { - color: #038035; -} - -.section_status_fail > .section__title { - color: #c00; -} - -.section_status_warning > .section__title { - color: #f6a828; -} - -.section_status_skip > .section__title, -.section_status_skip > .section__title:hover { - color: #ccc; - cursor: default; -} - -.section_status_skip > .section__title::before { - content: none; -} - -.section__title:hover { - color: #2D3E50; -} - -.section__body { - padding-left: 15px; -} - -.section__body_guided { - border-left: 1px dotted #ccc; -} - -.section_collapsed .section__body { - display: none; -} - -.section_collapsed .section__title:before, -.meta-info_collapsed .meta-info__switcher:before { - -webkit-transform: rotate(-90deg); - -moz-transform: rotate(-90deg); - -ms-transform: rotate(-90deg); - -o-transform: rotate(-90deg); - transform: rotate(-90deg); -} - -.reason { - background: #f6f5f3; - border: 1px solid #ccc; - padding: 5px; - font: 12px Consolas, Monaco, monospace; -} - -.state-button { - position: relative; - height: 22px; - display: inline-block; - box-shadow: 0 0 1px #000; - border: 1px solid #fff; - outline: none; - background: #fff; - cursor: pointer; -} - -.cswitcher__item, .tab-switcher__button { - width: 22px; -} - -.cswitcher__item_selected.cswitcher__item::before { - content: ''; - position: absolute; - top: 0; - left: 0; - background: rgba(4, 4, 4, 0.3) no-repeat 3px 2px url('data:image/svg+xml;utf8,'); - height: 20px; - width: 20px; -} - -.cswitcher_color_1 { - background: #c9c9c9; -} - -.cswitcher_color_2 { - background: #d5ff09; -} - -.cswitcher_color_3 { - background-image: url('data:image/svg+xml;utf8,'); -} - -.collapsed { - display: none; -} - -.skipped__list { - margin: 10px 0; - font-weight: bold; - color: #ccc; -} - -a:link, -a:visited { - text-decoration: none; -} - -a:hover, -a:active { - text-decoration: underline; -} - -.tab__item { - display: none; -} - -.tab__item_active { - display: block; -} - -.tab-switcher, .cswitcher { - display: inline-block; - vertical-align: top; - padding: 5px; -} - -.cswitcher:before { - content: 'Background:'; - padding-right: 4px; -} - -.tab-switcher:before { - content: 'Attempts:'; - padding-right: 4px; -} - -.tab-switcher__button_active { - background: #ffeba0; -} - -.meta-info { - margin: 5px; -} - -.meta-info__switcher { - display: inline-block; - cursor: pointer; -} - -.meta-info__content { - margin: 5px 0; - background: #f6f5f3; - padding: 5px; -} - -.meta-info_collapsed .meta-info__content { - display: none; -} diff --git a/lib/reporters/html/static/report.js b/lib/reporters/html/static/report.js deleted file mode 100644 index d6be1a4d2..000000000 --- a/lib/reporters/html/static/report.js +++ /dev/null @@ -1,140 +0,0 @@ -(function() { - /*jshint browser:true*/ - 'use strict'; - - var forEach = Array.prototype.forEach, - filter = Array.prototype.filter; - - function expandAll() { - loadLazyImages(document, '.section_collapsed img'); - forEach.call(document.querySelectorAll('.section'), function(section) { - section.classList.remove('section_collapsed'); - }); - } - - function collapseAll() { - forEach.call(document.querySelectorAll('.section'), function(section) { - section.classList.add('section_collapsed'); - }); - } - - function expandErrors() { - loadLazyImages(document, '.section_status_fail > .section__body > .image-box img'); - loadLazyImages(document, '.section_status_warning > .section__body > .image-box img'); - forEach.call(document.querySelectorAll('.section'), function(section) { - if (section.classList.contains('section_status_fail') || - section.classList.contains('section_status_warning')) { - section.classList.remove('section_collapsed'); - } else { - section.classList.add('section_collapsed'); - } - }); - } - - function expandRetries() { - loadLazyImages(document, '.has-retries > .section__body > .image-box img'); - forEach.call(document.querySelectorAll('.section'), function(section) { - if (section.classList.contains('has-retries')) { - section.classList.remove('section_collapsed'); - } else { - section.classList.add('section_collapsed'); - } - }); - } - - function handleColorSwitch(target, sources) { - var imageBox = findClosest(target, 'image-box'); - - sources.forEach(function(item) { - item.classList.remove('cswitcher__item_selected'); - }); - forEach.call(imageBox.classList, function(cls) { - if (/cswitcher_color_\d+/.test(cls)) { - imageBox.classList.remove(cls); - } - }); - - target.classList.add('cswitcher__item_selected'); - imageBox.classList.add('cswitcher_color_' + target.dataset.id); - } - - function handleRetriesSwitch(target) { - var imageBox = target.closest('.image-box'); - - switch_(imageBox.querySelector('.tab'), 'tab__item_active'); - switch_(imageBox.querySelector('.tab-switcher'), 'tab-switcher__button_active'); - - function switch_(elem, selector) { - forEach.call(elem.children, function(item) { - item.classList.remove(selector); - - if (target.getAttribute('data-position') === item.getAttribute('data-position')) { - item.classList.add(selector); - } - }); - } - } - - function bodyClick(e) { - var target = e.target; - if (target.classList.contains('cswitcher__item')) { - handleColorSwitch( - target, - filter.call(target.parentNode.childNodes, function(node) { - return node.nodeType === Node.ELEMENT_NODE; - }) - ); - } - - if (target.classList.contains('tab-switcher__button')) { - handleRetriesSwitch(target); - } - - if (target.classList.contains('meta-info__switcher')) { - toggleMetaInfo(target); - } - } - - function toggleMetaInfo(target) { - target.closest('.meta-info').classList.toggle('meta-info_collapsed'); - } - - function findClosest(context, cls) { - while ((context = context.parentNode)) { - if (context.classList.contains(cls)) { - return context; - } - } - } - - function loadLazyImages(elem, selector) { - forEach.call(elem.querySelectorAll(selector), function(img) { - if (img.dataset.src && img.src !== img.dataset.src) { - img.src = img.dataset.src; - } - }); - } - - function showSkippedList() { - document.getElementById('showSkipped').classList.toggle('pressed'); - document.getElementById('skippedList').classList.toggle('collapsed'); - } - - document.addEventListener('DOMContentLoaded', function() { - document.getElementById('expandAll').addEventListener('click', expandAll); - document.getElementById('collapseAll').addEventListener('click', collapseAll); - document.getElementById('expandErrors').addEventListener('click', expandErrors); - document.getElementById('showSkipped').addEventListener('click', showSkippedList); - document.getElementById('showRetries').addEventListener('click', expandRetries); - document.body.addEventListener('click', bodyClick); - - forEach.call(document.querySelectorAll('.section'), function(section) { - section.querySelector('.section__title').addEventListener('click', function() { - loadLazyImages(section, ':scope > .section__body > .image-box img'); - section.classList.toggle('section_collapsed'); - }); - }); - }); - - expandErrors(); -}()); diff --git a/lib/reporters/html/templates/report.hbs b/lib/reporters/html/templates/report.hbs deleted file mode 100644 index e646172e9..000000000 --- a/lib/reporters/html/templates/report.hbs +++ /dev/null @@ -1,40 +0,0 @@ - - - - Gemini report - - - - -
-
Total Tests
{{total}}
-
Passed
{{passed}}
-
Failed
{{failed}}
-
Skipped
{{skipped}}
-
Retries
{{retries}}
-
- - - - - - - - - - {{#each suites}} - {{> suite}} - {{/each}} - - - - diff --git a/lib/reporters/html/templates/state.hbs b/lib/reporters/html/templates/state.hbs deleted file mode 100644 index 17625eb5b..000000000 --- a/lib/reporters/html/templates/state.hbs +++ /dev/null @@ -1,40 +0,0 @@ -
-
Meta-info
-
-
{{metaInfo}}
-
-
-{{#if error}} -
-
{{reason}}
- {{#if image}} - {{image "actual"}} - {{/if}} -
-{{/if}} -{{#if warning}} -
-
New image
- {{image "actual"}} -
{{reason}}
-
-{{/if}} -{{#if success}} -
- {{image "actual"}} -
-{{/if}} -{{#if fail}} -
-
Expected
- {{image "expected"}} -
-
-
Actual
- {{image "actual"}} -
-
-
Diff
- {{image "diff"}} -
-{{/if}} diff --git a/lib/reporters/html/templates/suite.hbs b/lib/reporters/html/templates/suite.hbs deleted file mode 100644 index 0917dc03f..000000000 --- a/lib/reporters/html/templates/suite.hbs +++ /dev/null @@ -1,57 +0,0 @@ -
-
{{name}}
-
- {{#each browsers}} -
- {{#if result.skipped}} - {{#if result.reason}} -
[skipped] {{result.name}}, reason: {{result.reason}}
- {{/if}} - {{#unless result.reason}} -
[skipped] {{result.name}}
- {{/unless}} - {{/if}} - {{#unless result.skipped}} -
{{name}}
-
-
-
- - - -
- {{#if retries}} -
- {{#each retries}} - - {{/each}} - -
- {{/if}} -
- {{#each retries}} -
- {{> state}} -
- {{/each}} - {{#with result}} -
- {{> state}} -
- {{/with}} -
-
-
- {{/unless}} -
- {{/each}} - - {{#each children}} - {{> suite}} - {{/each}} -
-
diff --git a/lib/reporters/html/view-model.js b/lib/reporters/html/view-model.js deleted file mode 100644 index 9904a7822..000000000 --- a/lib/reporters/html/view-model.js +++ /dev/null @@ -1,194 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - inherit = require('inherit'), - lib = require('./lib'), - TestCounter = require('../utils/test-counter'); - -var NO_STATE = 'NO_STATE'; - -module.exports = inherit({ - /** - * @constructor - */ - __constructor: function() { - this._tree = {name: 'root'}; - this._skips = []; - this._counter = new TestCounter(); - }, - - /** - * @param {StateResult} result - */ - addSkipped: function(result) { - this._addTestResult(result, { - skipped: true, - reason: result.suite.skipComment - }); - - var comment = result.suite.skipComment - && result.suite.skipComment.replace(/https?:\/\/[^\s]*/g, function(url) { - return '
' + url + ''; - }); - this._skips.push({suite: result.suite.fullName, browser: result.browserId, comment: comment}); - - this._counter.onSkipped(result); - }, - - /** - * @param {TestStateResult} result - */ - addSuccess: function(result) { - this._addTestResult(result, { - success: true, - actualPath: lib.currentPath(result), - expectedPath: lib.referencePath(result) - }); - - this._counter.onPassed(result); - }, - - /** - * @param {TestStateResult} result - */ - addFail: function(result) { - this._addTestResult(result, { - fail: true, - actualPath: lib.currentPath(result), - expectedPath: lib.referencePath(result), - diffPath: lib.diffPath(result) - }); - - this._counter.onFailed(result); - }, - - /** - * @param {ErrorStateResult} result - */ - addError: function(result) { - this._addTestResult(result, { - actualPath: result.state? lib.currentPath(result) : '', - error: true, - image: !!result.imagePath || !!result.currentPath, - reason: (result.stack || result.message || result || '') - }); - - this._counter.onFailed(result); - }, - - /** - * @param {WarningStateResult} result - */ - addWarning: function(result) { - this._addTestResult(result, { - warning: true, - actualPath: lib.currentPath(result), - reason: (result.message || '') - }); - - this._counter.onSkipped(result); - }, - - /** - * @param {ErrorStateResult|TestStateResult} result - */ - addRetry: function(result) { - if (result.hasOwnProperty('equal')) { - this.addFail(result); - } else { - this.addError(result); - } - - this._counter.onRetry(result); - }, - - /** - * @returns {ViewModelResult} - */ - getResult: function() { - return _.extend(this._counter.getResult(), { - skips: _.uniq(this._skips, JSON.stringify), - suites: this._tree.children - }); - }, - - _addTestResult: function(result, props) { - var metaInfo = result.state? _.clone(result.state.metaInfo) : {}; - - metaInfo.sessionId = result.sessionId || 'unknown session id'; - - var testResult = _.assign({ - name: result.browserId, - metaInfo: JSON.stringify(metaInfo, null, 4) || 'Meta info is not available' - }, props), - node = findOrCreate(this._tree, result.suite.path.concat(result.state? result.state.name : NO_STATE)); - - node.browsers = Array.isArray(node.browsers)? node.browsers : []; - - var existing = _.findIndex(node.browsers, {name: testResult.name}); - - if (existing === -1) { - node.browsers.push({name: testResult.name, result: testResult, retries: []}); - return; - } - - var stateInBrowser = node.browsers[existing], - retry = stateInBrowser.result; - - // Hack to avoid situations when `endTest` event is emitted several times for a state, for example, - // when a state passed, but was retried because of a failure of another state in this suite - if (retry.success && testResult.success) { - return; - } - - stateInBrowser.retries.push(retry); - stateInBrowser.result = testResult; - } -}, { - hasFails: function hasFails(node) { - return walk(node, hasFails, node.result && (node.result.error || node.result.fail)); - }, - - hasWarnings: function hasWarnings(node) { - return walk(node, hasWarnings, node.result && node.result.warning); - }, - - hasRetries: function hasRetries(node) { - return walk(node, hasRetries, node.retries && node.retries.length); - } -}); - -function walk(node, cb, condition) { - return ['children', 'browsers'].reduce(function(result, prop) { - var collection = node[prop]; - return result || Array.isArray(collection) && collection.some(cb); - }, condition); -} - -/** - * @param {Object} node - * @param {Array} statePath - * @returns {Object} - */ -function findOrCreate(node, statePath) { - if (statePath.length === 0) { - return node; - } - - node.children = Array.isArray(node.children)? node.children : []; - - var pathPart = statePath.shift(); - - if (pathPart === NO_STATE) { - return node; - } - - var child = _.find(node.children, {name: pathPart}); - - if (!child) { - child = {name: pathPart}; - node.children.push(child); - } - - return findOrCreate(child, statePath); -} diff --git a/lib/reporters/html/view.js b/lib/reporters/html/view.js deleted file mode 100644 index 48535eba6..000000000 --- a/lib/reporters/html/view.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - Handlebars = require('handlebars'), - q = require('q'), - fs = require('q-io/fs'), - path = require('path'), - - ViewModel = require('./view-model'), - REPORT_DIR = require('./lib').REPORT_DIR, - - makeOutFilePath = _.partial(path.join, REPORT_DIR); - -Handlebars.registerHelper('section-status', function() { - if (this.result && this.result.skipped) { - return 'section_status_skip'; - } - - if (ViewModel.hasFails(this)) { - return 'section_status_fail'; - } - - if (ViewModel.hasWarnings(this)) { - return 'section_status_warning'; - } - - return 'section_status_success'; -}); - -Handlebars.registerHelper('image-box-status', function() { - var result = this.result; - - if (result.error) { - return 'image-box_error'; - } - - if (result.warning) { - return 'image-box_warning'; - } - - return ''; -}); - -Handlebars.registerHelper('has-retries', function() { - return ViewModel.hasRetries(this)? 'has-retries' : ''; -}); - -Handlebars.registerHelper('has-fails', function() { - return this.failed > 0? 'summary__key_has-fails' : ''; -}); - -Handlebars.registerHelper('image', function(kind) { - return new Handlebars.SafeString(''); -}); - -Handlebars.registerHelper('inc', function(value) { - return parseInt(value) + 1; -}); - -function loadTemplate(name) { - return fs.read(path.join(__dirname, 'templates', name)); -} - -function copyToReportDir(fileName) { - return fs.copy(path.join(__dirname, 'static', fileName), makeOutFilePath(fileName)); -} - -module.exports = { - /** - * @param {ViewModelResult} model - * returns {Promise} - */ - createHtml: function(model) { - return q.all([ - loadTemplate('suite.hbs'), - loadTemplate('state.hbs'), - loadTemplate('report.hbs') - ]) - .spread(function(suiteTemplate, stateTemplate, reportTemplate) { - Handlebars.registerPartial('suite', suiteTemplate); - Handlebars.registerPartial('state', stateTemplate); - - return Handlebars.compile(reportTemplate, {preventIndent: true})(model); - }); - }, - - /** - * @param {String} html - * returns {Promise} - */ - save: function(html) { - return fs.makeTree(REPORT_DIR) - .then(function() { - return q.all([ - fs.write(makeOutFilePath('index.html'), html), - copyToReportDir('report.js'), - copyToReportDir('report.css') - ]); - }); - } -}; diff --git a/lib/reporters/utils/test-counter.js b/lib/reporters/utils/test-counter.js deleted file mode 100644 index d2dbb7712..000000000 --- a/lib/reporters/utils/test-counter.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - inherit = require('inherit'); - -var STATS = { - PASSED: 'passed', - FAILED: 'failed', - SKIPPED: 'skipped' -}; - -module.exports = inherit({ - __constructor: function() { - this._stats = {}; - }, - - onPassed: function(passed) { - this._addStat(STATS.PASSED, passed); - }, - - onFailed: function(failed) { - this._addStat(STATS.FAILED, failed); - }, - - onSkipped: function(skipped) { - this._addStat(STATS.SKIPPED, skipped); - }, - - onRetry: function(retried) { - var suiteStats = this._getSuiteStats(retried); - - suiteStats.retries++; - suiteStats.states = {}; - }, - - getResult: function() { - var result = { - total: 0, - passed: 0, - failed: 0, - skipped: 0, - retries: 0 - }; - - _.forEach(this._stats, function(suiteStats) { - result.retries += suiteStats.retries; - _.forEach(suiteStats.states, function(stateStatus) { - result.total++; - result[stateStatus]++; - }); - }); - - return result; - }, - - _addStat: function(stat, completed) { - var completedEntity = completed.state || completed.suite; - if (!completedEntity) { - return; - } - - var suiteStats = this._getSuiteStats(completed); - - suiteStats.states[completedEntity.name] = stat; - }, - - _getSuiteStats: function(completed) { - var key = this._buildSuiteKey(completed); - - if (!this._stats[key]) { - this._stats[key] = { - retries: 0, - states: {} - }; - } - - return this._stats[key]; - }, - - _buildSuiteKey: function(completed) { - return completed.suite.fullName + completed.browserId; - } -}); diff --git a/lib/runner/browser-runner/browser-agent.js b/lib/runner/browser-runner/browser-agent.js deleted file mode 100644 index 649711b48..000000000 --- a/lib/runner/browser-runner/browser-agent.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var inherit = require('inherit'); - -var BrowserAgent = inherit({ - __constructor: function(browserId, pool) { - this.browserId = browserId; - this._pool = pool; - }, - - getBrowser: function() { - return this._pool.getBrowser(this.browserId); - }, - - freeBrowser: function(browser) { - return this._pool.freeBrowser(browser); - } -}, { - create: function(browserId, pool) { - return new BrowserAgent(browserId, pool); - } -}); - -module.exports = BrowserAgent; diff --git a/lib/runner/browser-runner/index.js b/lib/runner/browser-runner/index.js index 4d400e8f9..357e7c750 100644 --- a/lib/runner/browser-runner/index.js +++ b/lib/runner/browser-runner/index.js @@ -1,100 +1,73 @@ 'use strict'; -var inherit = require('inherit'), - _ = require('lodash'), - q = require('q'), - BrowserAgent = require('./browser-agent'), - Runner = require('../runner'), - SuiteRunner = require('../suite-runner'), +const _ = require('lodash'); +const url = require('url'); +const path = require('path'); +const {BrowserAgent, promiseUtils} = require('gemini-core'); +const Runner = require('../runner'); +const SuiteRunner = require('../suite-runner'); +const Events = require('../../constants/events'); + +module.exports = class BrowserRunner extends Runner { + constructor(browserId, config, browserPool) { + super(); - promiseUtils = require('q-promise-utils'), - RunnerEvents = require('../../constants/runner-events'), - PrivateEvents = require('../private-events'), - pool = require('../../browser-pool'), - - log = require('debug')('gemini:runner'); - -var BrowserRunner = inherit(Runner, { - __constructor: function(browserId, config, browserPool) { this._browserId = browserId; - this._config = config; - this._browserAgent = BrowserAgent.create(browserId, browserPool); + this._config = config.forBrowser(browserId); + this._browserPool = browserPool; this._suiteRunners = []; - }, - - run: function(suites, stateProcessor) { - log('start browser %s', this._browserId); - this.emit(RunnerEvents.START_BROWSER, {browserId: this._browserId}); - return this._runSuites(suites, stateProcessor) - .fin(() => { - log('stop browser %s', this._browserId); - this.emit(RunnerEvents.STOP_BROWSER, {browserId: this._browserId}); - }); - }, - - cancel: function() { - this._runSuite = this._doNothing; - this._suiteRunners.forEach(function(runner) { - runner.cancel(); - }); - }, + } - _doNothing: function() { - return q.resolve(); - }, + static create(browserId, config, browserPool) { + return new BrowserRunner(browserId, config, browserPool); + } - _runSuites: function(suites, stateProcessor) { - var _this = this; + run(suiteCollection, stateProcessor) { + const suites = suiteCollection.clone().allSuites(); return _(suites) - .filter(function(suite) { - return _.contains(suite.browsers, _this._browserId); - }) - .map(function(suite) { - return _this._tryToRunSuite(suite, stateProcessor); + .filter((suite) => _.includes(suite.browsers, this._browserId)) + .map((suite) => { + if (suite.hasOwnProperty('url')) { + Object.defineProperty(suite, 'fullUrl', { + get: () => this._mkFullUrl(suite.url) + }); + } + + return this._runSuite(suite, stateProcessor); }) .thru(promiseUtils.waitForResults) .value(); - }, + } - _tryToRunSuite: function(suite, stateProcessor) { - var _this = this; + cancel() { + this._suiteRunners.forEach((runner) => runner.cancel()); + } - return _this._runSuite(suite, stateProcessor) - .fail(function(e) { - if (e instanceof pool.CancelledError) { - log('critical error %o in %s', e, _this._browserId); - return; - } + _mkFullUrl(suiteUrl) { + const rootUrl = this._config.rootUrl; + const urlObj = url.parse(rootUrl + '/' + suiteUrl); - return _this.emitAndWait(PrivateEvents.CRITICAL_ERROR, _.extend(e, { - suite: suite, - browserId: _this._browserId - })); - }); - }, + return path.resolve(path.normalize(urlObj.path)); + } - _runSuite: function(suite, stateProcessor) { - var runner = SuiteRunner.create(suite, this._browserAgent, this._config); + _runSuite(suite, stateProcessor) { + const browserAgent = BrowserAgent.create(this._browserId, this._browserPool); + const runner = SuiteRunner.create(suite, browserAgent, this._config); this.passthroughEvent(runner, [ - RunnerEvents.BEGIN_SUITE, - RunnerEvents.END_SUITE, - RunnerEvents.SKIP_STATE, - RunnerEvents.BEGIN_STATE, - RunnerEvents.END_STATE, - RunnerEvents.WARNING, - RunnerEvents.ERROR, - PrivateEvents.STATE_RESULT + Events.BEGIN_SUITE, + Events.END_SUITE, + Events.SKIP_STATE, + Events.BEGIN_STATE, + Events.END_STATE, + Events.TEST_RESULT, + Events.UPDATE_RESULT, + Events.ERROR, + Events.RETRY ]); this._suiteRunners.push(runner); return runner.run(stateProcessor); } -}, { - create: function(browserId, config, browserPool) { - return new BrowserRunner(browserId, config, browserPool); - } -}); - -module.exports = BrowserRunner; +}; diff --git a/lib/runner/index.js b/lib/runner/index.js index 4e32fc01f..ac62d8470 100644 --- a/lib/runner/index.js +++ b/lib/runner/index.js @@ -1,116 +1,115 @@ 'use strict'; -var _ = require('lodash'), - q = require('q'), - inherit = require('inherit'), - Runner = require('./runner'), - TestSessionRunner = require('./test-session-runner'), +const _ = require('lodash'); +const {promiseUtils} = require('gemini-core'); - FailCollector = require('../fail-collector'), +const pool = require('../browser-pool'); +const BrowserRunner = require('./browser-runner'); +const Events = require('../constants/events'); +const Coverage = require('../coverage'); +const Runner = require('./runner'); +const RunnerStats = require('../stats'); +const SuiteMonitor = require('../suite-monitor'); - Coverage = require('../coverage'), +module.exports = class TestsRunner extends Runner { + static create(config, stateProcessor) { + return new TestsRunner(config, stateProcessor); + } - RunnerEvents = require('../constants/runner-events'), - PrivateEvents = require('./private-events'); + constructor(config, stateProcessor) { + super(); -var TestsRunner = inherit(Runner, { - __constructor: function(config, stateProcessor) { this.config = config; + this.coverage = this.config.isCoverageEnabled() && Coverage.create(config); + this._stateProcessor = stateProcessor; - this._failCollector = new FailCollector(config); - this.coverage = this.config.isCoverageEnabled() && new Coverage(config); - - this.passthroughEvent(this._failCollector, RunnerEvents.RETRY); - }, - - setTestBrowsers: function(browsers) { - this._testBrowsers = browsers; - }, - - /** - * @param {Suite[]} suites - * @returns {*} - */ - run: function(suites) { - var _this = this; - - return q.fcall(function() { - _this.emit(RunnerEvents.BEGIN, { - config: _this.config, - totalStates: _.reduce(suites, function(result, suite) { - return result + suite.states.length; - }, 0), - browserIds: _this.config.getBrowserIds() + + this._stats = RunnerStats.create(); + this._stats.attachRunner(this); + + this._browserPool = pool.create(this.config, this); + + this._suiteMonitor = SuiteMonitor.create(this); + this.passthroughEvent(this._suiteMonitor, Events.END_SUITE); + + this._browserRunners = []; + } + + run(suiteCollection) { + return this.emitAndWait(Events.START_RUNNER, this) + .then(() => this.emit(Events.BEGIN, this._formatBeginEventData(suiteCollection))) + .then(() => this._stateProcessor.prepare(this)) + .then(() => !this._cancelled && this._runTests(suiteCollection)) + .then(() => this.coverage && this.coverage.processStats()) + .finally(() => { + this.emit(Events.END, this._stats.getResult()); + return this.emitAndWait(Events.END_RUNNER, this); }); - }).then(function() { - return _this._prepare(); - }) - .then(function() { - return _this._runTestSession(suites); - }) - .then(function() { - return _this.coverage && _this.coverage.processStats(); - }) - .fin(function() { - _this.emit(RunnerEvents.END); - }); - }, - - _runTestSession: function(suites) { - var sessionRunner = TestSessionRunner.create(this.config, this._testBrowsers); - - this.passthroughEvent(sessionRunner, [ - RunnerEvents.BEGIN_SESSION, - RunnerEvents.END_SESSION, - RunnerEvents.START_BROWSER, - RunnerEvents.STOP_BROWSER, - RunnerEvents.INFO, - RunnerEvents.BEGIN_SUITE, - RunnerEvents.END_SUITE, - RunnerEvents.SKIP_STATE, - RunnerEvents.BEGIN_STATE, - RunnerEvents.END_STATE, - RunnerEvents.WARNING + } + + _formatBeginEventData(suiteCollection) { + return { + suiteCollection, + config: this.config, + totalStates: _.sumBy(suiteCollection.allSuites(), (suite) => suite.states.length), + browserIds: this.config.getBrowserIds() + }; + } + + _runTests(suiteCollection) { + return _(this._getBrowsersToRun()) + .map((browserId) => this._runTestsInBrowser(suiteCollection, browserId)) + .thru(promiseUtils.waitForResults) + .value(); + } + + _getBrowsersToRun() { + const allBrowsers = this.config.getBrowserIds(); + const testBrowsers = this._testBrowsers; + + return testBrowsers ? _.intersection(testBrowsers, allBrowsers) : allBrowsers; + } + + _runTestsInBrowser(suiteCollection, browserId) { + const runner = BrowserRunner.create(browserId, this.config, this._browserPool); + + this.passthroughEvent(runner, [ + Events.RETRY, + Events.START_BROWSER, + Events.STOP_BROWSER, + Events.BEGIN_SUITE, + Events.SKIP_STATE, + Events.BEGIN_STATE, + Events.END_STATE, + Events.INFO, + Events.ERROR ]); - sessionRunner.on(RunnerEvents.ERROR, this._handleError.bind(this)); - sessionRunner.on(PrivateEvents.CRITICAL_ERROR, this._handleCriticalError.bind(this)); - sessionRunner.on(PrivateEvents.STATE_RESULT, this._handleStateResult.bind(this)); + runner.on(Events.END_SUITE, (data) => this._suiteMonitor.suiteFinished(data.suite, data.browserId)); - var _this = this; - return sessionRunner.run(suites, this._stateProcessor) - .then(function() { - return _this._failCollector.retry(_this._runTestSession.bind(_this)); - }); - }, + runner.on(Events.TEST_RESULT, (result) => this._handleResult(result, Events.TEST_RESULT)); + runner.on(Events.UPDATE_RESULT, (result) => this._handleResult(result, Events.UPDATE_RESULT)); - _prepare: function() { - return this._stateProcessor.prepare(this); - }, + this._browserRunners.push(runner); + return runner.run(suiteCollection, this._stateProcessor); + } - _handleStateResult: function(result) { + _handleResult(result, event) { + this._saveCoverage(result); + this.emit(event, result); + } + + _saveCoverage(data) { if (this.coverage) { - this.coverage.addStatsForBrowser(result.coverage, result.browserId); + this.coverage.addStatsForBrowser(data.coverage, data.browserId); } + } - if (!this._failCollector.tryToSubmitStateResult(result)) { - this.emit(this._stateProcessor.jobDoneEvent, result); - } - }, + cancel() { + this._cancelled = true; - _handleError: function(error) { - if (!this._failCollector.tryToSubmitError(error)) { - this.emit(RunnerEvents.ERROR, error); - } - }, + this._browserRunners.forEach((runner) => runner.cancel()); - _handleCriticalError: function(critical) { - if (!this._failCollector.tryToSubmitError(critical)) { - this.emit(RunnerEvents.ERROR, critical); - return q.reject(critical); - } - return q.resolve(); + this._browserPool.cancel(); } -}); - -module.exports = TestsRunner; +}; diff --git a/lib/runner/private-events.js b/lib/runner/private-events.js deleted file mode 100644 index 8457984d2..000000000 --- a/lib/runner/private-events.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -module.exports = { - STATE_RESULT: 'stateResult', - CRITICAL_ERROR: 'criticalError' -}; diff --git a/lib/runner/runner.js b/lib/runner/runner.js index dc31390d4..5dd60a738 100644 --- a/lib/runner/runner.js +++ b/lib/runner/runner.js @@ -1,42 +1,10 @@ 'use strict'; -var inherit = require('inherit'), - _ = require('lodash'), - QEmitter = require('qemitter'); +const PassthroughEmitter = require('../passthrough-emitter'); -var Runner = inherit(QEmitter, { - run: function(suites) { +module.exports = class Runner extends PassthroughEmitter { + run() { throw 'Not implemented'; - }, - - // Allow to pass only one argument with event - emit: function(type, data) { - return this.__base(type, data); - }, - - emitAndWait: function(type, data) { - return this.__base(type, data, {shouldWait: true}); - }, - - /** - * Emit event emitted by emitter - * @param {EventEmitter} emitter - * @param {String|String[]} event or array of events to passthrough - */ - passthroughEvent: function(emitter, event) { - if (_.isArray(event)) { - event.forEach(this.passthroughEvent.bind(this, emitter)); - return; - } - - emitter.on(event, function(data, opts) { - if (opts && opts.shouldWait) { - return this.emitAndWait(event, data); - } else { - this.emit(event, data); - } - }.bind(this)); } -}); +}; -module.exports = Runner; diff --git a/lib/runner/state-runner/disabled-state-runner.js b/lib/runner/state-runner/disabled-state-runner.js index 1b4db6347..7bc954ca0 100644 --- a/lib/runner/state-runner/disabled-state-runner.js +++ b/lib/runner/state-runner/disabled-state-runner.js @@ -1,13 +1,10 @@ 'use strict'; -var q = require('q'), - inherit = require('inherit'), - StateRunner = require('./state-runner'); +const Promise = require('bluebird'); +const StateRunner = require('./state-runner'); -var DisabledStateRunner = inherit(StateRunner, { - _capture: function() { - return q.resolve(); +module.exports = class DisabledStateRunner extends StateRunner { + _capture() { + return Promise.resolve(); } -}); - -module.exports = DisabledStateRunner; +}; diff --git a/lib/runner/state-runner/index.js b/lib/runner/state-runner/index.js index 70eab4fee..0e366fb33 100644 --- a/lib/runner/state-runner/index.js +++ b/lib/runner/state-runner/index.js @@ -1,13 +1,13 @@ 'use strict'; -var StateRunner = require('./state-runner'), - DisabledStateRunner = require('./disabled-state-runner'), - _ = require('lodash'); +const StateRunner = require('./state-runner'); +const DisabledStateRunner = require('./disabled-state-runner'); +const _ = require('lodash'); -exports.create = function(state, browserSession, config) { - if (!_.contains(state.browsers, browserSession.browser.id)) { +exports.create = (state, browserSession) => { + if (!_.includes(state.browsers, browserSession.browser.id)) { return new DisabledStateRunner(state, browserSession); } - return new StateRunner(state, browserSession, config); + return new StateRunner(state, browserSession); }; diff --git a/lib/runner/state-runner/state-runner.js b/lib/runner/state-runner/state-runner.js index 20fbb8b57..b18fac062 100644 --- a/lib/runner/state-runner/state-runner.js +++ b/lib/runner/state-runner/state-runner.js @@ -1,59 +1,42 @@ 'use strict'; -var inherit = require('inherit'), - _ = require('lodash'), - Runner = require('../runner'), +const _ = require('lodash'); - RunnerEvents = require('../../constants/runner-events'), - PrivateEvents = require('../private-events'); +const Runner = require('../runner'); +const Events = require('../../constants/events'); + +module.exports = class StateRunner extends Runner { + constructor(state, browserSession) { + super(); -var StateRunner = inherit(Runner, { - __constructor: function(state, browserSession, config) { this._state = state; this._browserSession = browserSession; - this._config = config; this._stateInfo = { suite: state.suite, state: state, browserId: browserSession.browser.id, sessionId: browserSession.browser.sessionId }; - }, - - run: function(stateProcessor) { - var _this = this; + } - _this.emit(RunnerEvents.BEGIN_STATE, this._stateInfo); + run(stateProcessor) { + this._emit(Events.BEGIN_STATE); - var session = this._browserSession; + const session = this._browserSession; return session.runActions(this._state.actions) - .then(function() { - return session.prepareScreenshot(_this._state, {coverage: _this._config.isCoverageEnabled()}); - }) - .fail(function(e) { - return session.extendWithPageScreenshot(e) - .thenReject(e); - }) - .then(function(page) { - return _this._capture(stateProcessor, page); - }) - .fail(function(e) { - _.extend(e, _this._stateInfo); - - return _this.emit(RunnerEvents.ERROR, e); - }) - .fin(function() { - _this.emit(RunnerEvents.END_STATE, _this._stateInfo); - }); - }, - - _capture: function(stateProcessor, page) { - return stateProcessor.exec(this._state, this._browserSession, page) - .then(function(result) { - this.emit(PrivateEvents.STATE_RESULT, _.extend(result, this._stateInfo)); - }.bind(this)); + .then(() => session.prepareScreenshot(this._state)) + .catch((e) => session.extendWithPageScreenshot(e).thenThrow(e)) + .then((page) => this._capture(stateProcessor, page)) + .catch((e) => this._emit(Events.ERROR, e)) + .finally(() => this._emit(Events.END_STATE)); } -}); -module.exports = StateRunner; + _emit(event, data) { + this.emit(event, _.extend(data || {}, this._stateInfo)); + } + + _capture(stateProcessor, page) { + return stateProcessor.exec(this._state, this._browserSession, page, this._emit.bind(this)); + } +}; diff --git a/lib/runner/suite-runner/index.js b/lib/runner/suite-runner/index.js index 047d6ca9e..81dbaffbc 100644 --- a/lib/runner/suite-runner/index.js +++ b/lib/runner/suite-runner/index.js @@ -1,18 +1,15 @@ 'use strict'; -var RegularSuiteRunner = require('./regular-suite-runner'), - SkippedSuiteRunner = require('./skipped-suite-runner'), - StatelessSuiteRunner = require('./stateless-suite-runner'), - suiteUtil = require('../../suite-util'); +const InsistentSuiteRunner = require('./insistent-suite-runner'); +const SkippedSuiteRunner = require('./skipped-suite-runner'); +const StatelessSuiteRunner = require('./stateless-suite-runner'); exports.create = function(suite, browserAgent, config) { if (!suite.hasStates) { return new StatelessSuiteRunner(suite, browserAgent); - } - - if (suiteUtil.shouldSkip(suite, browserAgent.browserId)) { + } else if (suite.shouldSkip(browserAgent.browserId)) { return new SkippedSuiteRunner(suite, browserAgent); + } else { + return new InsistentSuiteRunner(suite, browserAgent, config); } - - return new RegularSuiteRunner(suite, browserAgent, config); }; diff --git a/lib/runner/suite-runner/insistent-suite-runner.js b/lib/runner/suite-runner/insistent-suite-runner.js new file mode 100644 index 000000000..fab1feb30 --- /dev/null +++ b/lib/runner/suite-runner/insistent-suite-runner.js @@ -0,0 +1,100 @@ +'use strict'; + +const _ = require('lodash'); + +const SuiteRunner = require('./suite-runner'); +const RegularSuiteRunner = require('./regular-suite-runner'); +const SuiteCollection = require('../../suite-collection'); +const Events = require('../../constants/events'); +const NoRefImageError = require('../../errors/no-ref-image-error'); + +module.exports = class InsistentSuiteRunner extends SuiteRunner { + static create(suite, browserAgent, config) { + return new InsistentSuiteRunner(suite, browserAgent, config); + } + + constructor(suite, browserAgent, config) { + super(suite, browserAgent); + + this._config = config; + this._retriesPerformed = 0; + } + + _doRun(stateProcessor) { + this._suiteRunner = this._initSuiteRunner(); + this._statesToRetry = []; + + return this._suiteRunner.run(stateProcessor) + .then(() => this._retry(stateProcessor)); + } + + _initSuiteRunner() { + this._disablePassedStates(this._suite); + + const runner = RegularSuiteRunner.create(this._suite, this._browserAgent); + + this._handleEvent(runner, Events.ERROR, (e) => e instanceof NoRefImageError); + this._handleEvent(runner, Events.TEST_RESULT, (r) => r.equal); + + this.passthroughEvent(runner, [ + Events.BEGIN_STATE, + Events.SKIP_STATE, + Events.END_STATE, + Events.UPDATE_RESULT + ]); + + return runner; + } + + _handleEvent(runner, event, shouldPassthrough) { + runner.on(event, (data) => { + if (shouldPassthrough(data) || !this._submitForRetry(data)) { + this._emit(event, data); + } + }); + } + + _retry(stateProcessor) { + if (_.isEmpty(this._statesToRetry) || this._cancelled) { + return; + } + + ++this._retriesPerformed; + return this._doRun(stateProcessor); + } + + _disablePassedStates(suite) { + if (_.isEmpty(this._statesToRetry)) { + return; + } + + const browser = this._browserAgent.browserId; + const collection = new SuiteCollection([suite]); + suite.states.forEach((state) => collection.disable(suite, {state: state.name})); + this._statesToRetry.forEach((state) => collection.enable(suite, {state, browser})); + } + + _shouldRetry(data) { + if (typeof this._config.shouldRetry === 'function') { + return this._config.shouldRetry(data); + } + + return data.retriesLeft > 0; + } + + _submitForRetry(data) { + Object.assign(data, { + attempt: this._retriesPerformed, + retriesLeft: this._config.retry - this._retriesPerformed + }); + + if (!this._shouldRetry(data)) { + return false; + } + + this._statesToRetry = this._statesToRetry.concat(data.state.name); + + this._emit(Events.RETRY, data); + return true; + } +}; diff --git a/lib/runner/suite-runner/regular-suite-runner.js b/lib/runner/suite-runner/regular-suite-runner.js index e60e581cb..cf9e3a315 100644 --- a/lib/runner/suite-runner/regular-suite-runner.js +++ b/lib/runner/suite-runner/regular-suite-runner.js @@ -1,59 +1,58 @@ 'use strict'; -const inherit = require('inherit'); const _ = require('lodash'); -const q = require('q'); -const promiseUtils = require('q-promise-utils'); +const Promise = require('bluebird'); const CaptureSession = require('../../capture-session'); -const PrivateEvents = require('../private-events'); -const RunnerEvents = require('../../constants/runner-events'); +const Events = require('../../constants/events'); const SuiteRunner = require('./suite-runner'); const StateRunner = require('../state-runner'); const cloneError = require('../../errors/utils').cloneError; +const NoRefImageError = require('../../errors/no-ref-image-error'); -const RegularSuiteRunner = inherit(SuiteRunner, { - __constructor: function(suite, browserAgent, config) { - this.__base(suite, browserAgent); - this._config = config; +module.exports = class RegularSuiteRunner extends SuiteRunner { + static create(suite, browserAgent) { + return new RegularSuiteRunner(suite, browserAgent); + } + + constructor(suite, browserAgent) { + super(suite, browserAgent); this._session = null; - }, + this._brokenSession = false; + } - _doRun: function(stateProcessor) { + _doRun(stateProcessor) { return this._browserAgent.getBrowser() .then((browser) => this._initSession(browser)) .then(() => this._processStates(stateProcessor)) - .catch((e) => this._passErrorToStates(e)) - .fin(() => this._session && this._browserAgent.freeBrowser(this._session.browser)); - }, + .catch((e) => { + this._validateSession(e); - _initSession: function(browser) { - this._session = new CaptureSession(browser); - }, + return this._passErrorToStates(e); + }) + .finally(() => this._session + && this._browserAgent.freeBrowser(this._session.browser, {force: this._brokenSession})); + } - _passErrorToStates: function(e) { + _initSession(browser) { + this._session = CaptureSession.create(browser); + } + + _passErrorToStates(e) { return this._suite.states.map((state) => { - return this.emit(RunnerEvents.ERROR, _.extend(cloneError(e), { + return this.emit(Events.ERROR, _.extend(cloneError(e), { suite: state.suite, state: state, browserId: this._browserAgent.browserId })); }); - }, - - cancel: function() { - this._runStateInSession = this._doNothing; - }, - - _doNothing: function() { - return q.resolve(); - }, + } - _processStates: function(stateProcessor) { + _processStates(stateProcessor) { const browser = this._session.browser; return browser.openRelative(this._suite.url) @@ -62,48 +61,57 @@ const RegularSuiteRunner = inherit(SuiteRunner, { .then(() => this._runAfterActions(), this._keepPassedError(this._runAfterActions)) .then(() => this._runPostActions(), this._keepPassedError(this._runPostActions)) .catch((e) => { - return q.reject(_.extend(e, { + return Promise.reject(_.extend(e, { browserId: browser.id, sessionId: browser.sessionId })); }); - }, + } - _runBeforeActions: function() { + _runBeforeActions() { return this._session.runActions(this._suite.beforeActions); - }, + } - _runAfterActions: function() { + _runAfterActions() { return this._session.runActions(this._suite.afterActions); - }, + } - _runPostActions: function() { + _runPostActions() { return this._session.runPostActions(); - }, + } - _keepPassedError: function(fn) { - return (e) => q.when(fn.call(this)).fin(() => q.reject(e)); - }, + _keepPassedError(fn) { + return (e) => Promise.try(() => fn.call(this)) + .finally(() => Promise.reject(e)); + } - _runStates: function(stateProcessor) { - return promiseUtils.seqMap(this._suite.states, (state) => this._runStateInSession(state, stateProcessor)); - }, + _runStates(stateProcessor) { + return Promise.mapSeries(this._suite.states, (state) => this._runStateInSession(state, stateProcessor)); + } - _runStateInSession: function(state, stateProcessor) { - const runner = StateRunner.create(state, this._session, this._config); + _validateSession(error) { + if (!(error instanceof NoRefImageError)) { + this._brokenSession = true; + } + } + + _runStateInSession(state, stateProcessor) { + const runner = StateRunner.create(state, this._session); this.passthroughEvent(runner, [ - RunnerEvents.SKIP_STATE, - RunnerEvents.BEGIN_STATE, - RunnerEvents.END_STATE, - RunnerEvents.WARNING, - RunnerEvents.ERROR, - PrivateEvents.STATE_RESULT, - PrivateEvents.CRITICAL_ERROR + Events.SKIP_STATE, + Events.BEGIN_STATE, + Events.END_STATE, + Events.TEST_RESULT, + Events.UPDATE_RESULT ]); + runner.on(Events.ERROR, (e) => { + this._validateSession(e); + + this.emit(Events.ERROR, e); + }); + return runner.run(stateProcessor); } -}); - -module.exports = RegularSuiteRunner; +}; diff --git a/lib/runner/suite-runner/skipped-suite-runner.js b/lib/runner/suite-runner/skipped-suite-runner.js index 4c57ecdc6..b6de7a7c0 100644 --- a/lib/runner/suite-runner/skipped-suite-runner.js +++ b/lib/runner/suite-runner/skipped-suite-runner.js @@ -1,21 +1,21 @@ 'use strict'; -var q = require('q'), +var Promise = require('bluebird'), inherit = require('inherit'), SuiteRunner = require('./suite-runner'), - RunnerEvents = require('../../constants/runner-events'); + Events = require('../../constants/events'); var SkippedSuiteRunner = inherit(SuiteRunner, { _doRun: function() { this._suite.states.forEach(function(state) { - this.emit(RunnerEvents.SKIP_STATE, { + this.emit(Events.SKIP_STATE, { suite: this._suite, state: state, browserId: this._browserAgent.browserId }); }, this); - return q.resolve(); + return Promise.resolve(); } }); diff --git a/lib/runner/suite-runner/stateless-suite-runner.js b/lib/runner/suite-runner/stateless-suite-runner.js index 074d83690..6cb9e9832 100644 --- a/lib/runner/suite-runner/stateless-suite-runner.js +++ b/lib/runner/suite-runner/stateless-suite-runner.js @@ -1,12 +1,12 @@ 'use strict'; -var q = require('q'), +var Promise = require('bluebird'), SuiteRunner = require('./suite-runner'), inherit = require('inherit'); var StatelessSuiteRunner = inherit(SuiteRunner, { _doRun: function() { - return q.resolve(); + return Promise.resolve(); } }); diff --git a/lib/runner/suite-runner/suite-runner.js b/lib/runner/suite-runner/suite-runner.js index eca4e72b3..badbecaae 100644 --- a/lib/runner/suite-runner/suite-runner.js +++ b/lib/runner/suite-runner/suite-runner.js @@ -3,7 +3,7 @@ var _ = require('lodash'), inherit = require('inherit'), Runner = require('../runner'), - RunnerEvents = require('../../constants/runner-events'); + Events = require('../../constants/events'); var SuiteRunner = inherit(Runner, { __constructor: function(suite, browserAgent) { @@ -12,24 +12,32 @@ var SuiteRunner = inherit(Runner, { }, run: function(stateProcessor) { - var _this = this, - eventData = { - suite: this._suite, - browserId: this._browserAgent.browserId - }; + var _this = this; - this.emit(RunnerEvents.BEGIN_SUITE, eventData); + this._emit(Events.BEGIN_SUITE); return this._doRun(stateProcessor) - .fin(function() { - _this.emit(RunnerEvents.END_SUITE, eventData); + .finally(function() { + _this._emit(Events.END_SUITE); }); }, - _doRun: function(stateProcessor) { + _emit: function(event, data) { + data = data || {}; + this.emit(event, _.extend(data, { + suite: this._suite, + browserId: this._browserAgent.browserId + })); + }, + + _doRun: function() { throw new Error('Not implemented'); }, - cancel: _.noop + cancel: function() { + this._cancelled = true; + + this.emit = _.noop; + } }); module.exports = SuiteRunner; diff --git a/lib/runner/test-session-runner.js b/lib/runner/test-session-runner.js deleted file mode 100644 index e43571ec9..000000000 --- a/lib/runner/test-session-runner.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -var inherit = require('inherit'), - _ = require('lodash'), - q = require('q'), - Runner = require('./runner'), - BrowserRunner = require('./browser-runner'), - - promiseUtils = require('q-promise-utils'), - RunnerEvents = require('../constants/runner-events'), - PrivateEvents = require('./private-events'), - pool = require('../browser-pool'), - SuiteMonitor = require('../suite-monitor'); - -var TestSessionRunner = inherit(Runner, { - __constructor: function(config, testBrowsers) { - this.browserPool = pool.create(config); - - this.monitor = new SuiteMonitor(this); - this.passthroughEvent(this.monitor, RunnerEvents.END_SUITE); - - var allBrowsers = config.getBrowserIds(), - browsersToRun = testBrowsers? _.intersection(testBrowsers, allBrowsers) : allBrowsers; - - this._browserRunners = browsersToRun.map(function(browserId) { - return this._initBrowserRunner(browserId, config); - }, this); - }, - - _initBrowserRunner: function(browserId, config) { - var runner = BrowserRunner.create(browserId, config, this.browserPool); - this.passthroughEvent(runner, [ - RunnerEvents.START_BROWSER, - RunnerEvents.STOP_BROWSER, - RunnerEvents.INFO, - RunnerEvents.SKIP_STATE, - RunnerEvents.BEGIN_STATE, - RunnerEvents.END_STATE, - RunnerEvents.WARNING, - RunnerEvents.ERROR, - PrivateEvents.STATE_RESULT, - PrivateEvents.CRITICAL_ERROR - ]); - - this.passthroughEvent(runner, RunnerEvents.BEGIN_SUITE); - runner.on(RunnerEvents.END_SUITE, function(data) { - this.monitor.suiteFinished(data.suite, data.browserId); - }.bind(this)); - - return runner; - }, - - run: function(suites, stateProcessor) { - var _this = this; - - this.emit(RunnerEvents.BEGIN_SESSION); - - return _(this._browserRunners) - .map(function(runner) { - return this._runBrowserRunner(runner, suites, stateProcessor); - }.bind(this)) - .thru(promiseUtils.waitForResults) - .value() - .fin(function() { - _this.emit(RunnerEvents.END_SESSION); - }); - }, - - _runBrowserRunner: function(runner, suites, stateProcessor) { - return runner.run(suites, stateProcessor) - .fail(function(e) { - this._cancel(); - return q.reject(e); - }.bind(this)); - }, - - _cancel: function() { - this._browserRunners.forEach(function(runner) { - runner.cancel(); - }); - this.browserPool.cancel(); - } -}, { - create: function(config, testBrowsers) { - return new TestSessionRunner(config, testBrowsers); - } -}); - -module.exports = TestSessionRunner; diff --git a/lib/signal-handler.js b/lib/signal-handler.js index eea5b5e2c..c377bb4aa 100644 --- a/lib/signal-handler.js +++ b/lib/signal-handler.js @@ -1,30 +1,27 @@ 'use strict'; -var QEmitter = require('qemitter'), - signalHandler = new QEmitter(); +const EventEmitter = require('events').EventEmitter; +const Events = require('./constants/events'); +const logger = require('./utils').logger; -module.exports = signalHandler; +const signalHandler = module.exports = new EventEmitter(); -process.on('SIGHUP', notifyAndExit(1)); -process.on('SIGINT', notifyAndExit(2)); -process.on('SIGTERM', notifyAndExit(15)); +process.on('SIGHUP', handleSignal(1)); +process.on('SIGINT', handleSignal(2)); +process.on('SIGTERM', handleSignal(15)); -var callCount = 0; +let callCount = 0; -function notifyAndExit(signalNo) { - var exitCode = 128 + signalNo; +function handleSignal(signalNo) { + const exitCode = 128 + signalNo; - return function() { + return () => { if (callCount++ > 0) { - console.log('Force quit.'); + logger.warn('Force quit.'); process.exit(exitCode); } - signalHandler.emitAndWait('exit') - .then(function() { - console.log('Done.'); - process.exit(exitCode); - }) - .done(); + logger.warn('Cancelling...'); + signalHandler.emit(Events.INTERRUPT, {exitCode}); }; } diff --git a/lib/state-processor/capture-processor/capture-processor.js b/lib/state-processor/capture-processor/capture-processor.js index 20e2d8cf5..1689f769e 100644 --- a/lib/state-processor/capture-processor/capture-processor.js +++ b/lib/state-processor/capture-processor/capture-processor.js @@ -1,11 +1,65 @@ 'use strict'; +const _ = require('lodash'); +const utils = require('./utils'); +const {temp, Image} = require('gemini-core'); + module.exports = class CaptureProcessor { + static create() { + return new CaptureProcessor(); + } + + onReference(handler) { + this._onRefHandler = handler || _.noop; + return this; + } + + onNoReference(handler) { + this._onNoRefHandler = handler || _.noop; + return this; + } + + onEqual(handler) { + this._onEqualHandler = handler || _.noop; + return this; + } + + onDiff(handler) { + this._onDiffHandler = handler || _.noop; + return this; + } + exec(capture, opts) { - throw new Error('Not implemented'); + const {refImg} = opts; + + return utils.existsRef(refImg.path) + .then((isRefExists) => { + return isRefExists + ? this._onRefHandler(refImg) || this._compareImages(capture, opts) + : this._onNoRefHandler(refImg, capture); + }); } - postprocessResult(result) { - return result; + _compareImages(capture, opts) { + const {refImg} = opts; + const currImg = {path: temp.path({suffix: '.png'}), size: capture.image.getSize()}; + const imageCompareOpts = { + canHaveCaret: capture.canHaveCaret, + pixelRatio: opts.pixelRatio, + tolerance: opts.tolerance, + antialiasingTolerance: opts.antialiasingTolerance, + compareOpts: opts.compareOpts + }; + + return capture.image.save(currImg.path) + .then(() => Image.compare(currImg.path, refImg.path, imageCompareOpts)) + .then(({equal, diffBounds, diffClusters, metaInfo = {}}) => { + Object.assign(refImg, metaInfo.refImg); + const diffAreas = {diffBounds, diffClusters}; + + return equal + ? this._onEqualHandler(refImg, currImg) + : this._onDiffHandler(refImg, currImg, diffAreas); + }); } }; diff --git a/lib/state-processor/capture-processor/index.js b/lib/state-processor/capture-processor/index.js new file mode 100644 index 000000000..48753f5a6 --- /dev/null +++ b/lib/state-processor/capture-processor/index.js @@ -0,0 +1,65 @@ +'use strict'; + +const Promise = require('bluebird'); +const CaptureProcessor = require('./capture-processor'); +const utils = require('./utils'); +const NoRefImageError = require('../../errors/no-ref-image-error'); +const {temp} = require('gemini-core'); + +const throwNoRefError = (refImg, capture) => { + const currImg = {path: temp.path({suffix: '.png'}), size: capture.image.getSize()}; + + return capture.image.save(currImg.path) + .then(() => Promise.reject(new NoRefImageError(refImg, currImg))); +}; +const notUpdated = (refImg) => ({refImg, updated: false}); + +const saveRef = (refImg, capture) => { + refImg.size = capture.image.getSize(); + + return utils.saveRef(refImg.path, capture) + .then((updated) => ({refImg, updated})); +}; + +const updateRef = (refImg, currImg) => { + return utils.copyImg(currImg.path, refImg.path) + .then((updated) => { + if (updated) { + refImg.size = currImg.size; + } + + return {refImg, updated}; + }); +}; + +exports.create = (type) => { + if (type === 'tester') { + return CaptureProcessor.create() + .onReference() + .onNoReference(throwNoRefError) + .onEqual((refImg, currImg) => ({refImg, currImg, equal: true})) + .onDiff((refImg, currImg, {diffBounds, diffClusters}) => ({refImg, currImg, diffBounds, diffClusters, equal: false})); + } + + if (type === 'new-updater') { + return CaptureProcessor.create() + .onReference(notUpdated) + .onNoReference(saveRef); + } + + if (type === 'diff-updater') { + return CaptureProcessor.create() + .onReference() + .onNoReference(notUpdated) + .onEqual(notUpdated) + .onDiff(updateRef); + } + + if (type === 'meta-updater') { + return CaptureProcessor.create() + .onReference() + .onNoReference(saveRef) + .onEqual(notUpdated) + .onDiff(updateRef); + } +}; diff --git a/lib/state-processor/capture-processor/screen-updater/diff-screen-updater.js b/lib/state-processor/capture-processor/screen-updater/diff-screen-updater.js deleted file mode 100644 index c0754ac40..000000000 --- a/lib/state-processor/capture-processor/screen-updater/diff-screen-updater.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var fs = require('q-io/fs'), - temp = require('../../../temp'), - - Image = require('../../../image'), - ScreenUpdater = require('./screen-updater'); - -module.exports = class DiffScreenUpdater extends ScreenUpdater { - _processCapture(capture, opts, isRefExists) { - if (!isRefExists) { - return; - } - - var refPath = opts.refPath, - tmpPath = temp.path({suffix: '.png'}); - - return capture.image.save(tmpPath) - .then(function() { - return Image.compare(tmpPath, refPath, { - canHaveCaret: capture.canHaveCaret, - tolerance: opts.tolerance, - pixelRatio: opts.pixelRatio - }) - .then(function(isEqual) { - if (!isEqual) { - return fs.copy(tmpPath, refPath); - } - }); - }.bind(this)); - } -}; diff --git a/lib/state-processor/capture-processor/screen-updater/index.js b/lib/state-processor/capture-processor/screen-updater/index.js deleted file mode 100644 index 33a7d8a6c..000000000 --- a/lib/state-processor/capture-processor/screen-updater/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var DiffUpdater = require('./diff-screen-updater'), - NewUpdater = require('./new-screen-updater'), - MetaUpdater = require('./meta-screen-updater'); - -exports.create = function(opts) { - if (opts.diff && !opts.new) { - return new DiffUpdater(); - } - if (!opts.diff && opts.new) { - return new NewUpdater(); - } - return new MetaUpdater(); -}; diff --git a/lib/state-processor/capture-processor/screen-updater/meta-screen-updater.js b/lib/state-processor/capture-processor/screen-updater/meta-screen-updater.js deleted file mode 100644 index ee6a6995d..000000000 --- a/lib/state-processor/capture-processor/screen-updater/meta-screen-updater.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var ScreenUpdater = require('./screen-updater'), - DiffUpdater = require('./diff-screen-updater'), - NewUpdater = require('./new-screen-updater'), - - util = require('q-promise-utils'); - -module.exports = class MetaScreenUpdater extends ScreenUpdater { - constructor() { - super(); - - this._diffUpdater = new DiffUpdater(); - this._newUpdater = new NewUpdater(); - } - - _processCapture(capture, opts, isRefExists) { - return util.sequence([ - this._diffUpdater._processCapture.bind(this._diffUpdater, capture, opts, isRefExists), - this._newUpdater._processCapture.bind(this._newUpdater, capture, opts, isRefExists) - ]); - } -}; diff --git a/lib/state-processor/capture-processor/screen-updater/new-screen-updater.js b/lib/state-processor/capture-processor/screen-updater/new-screen-updater.js deleted file mode 100644 index 0ac0470b4..000000000 --- a/lib/state-processor/capture-processor/screen-updater/new-screen-updater.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var fs = require('q-io/fs'), - path = require('path'), - ScreenUpdater = require('./screen-updater'); - -module.exports = class NewScreenUpdater extends ScreenUpdater { - _processCapture(capture, opts, isRefExists) { - if (isRefExists) { - return; - } - - return fs.makeTree(path.dirname(opts.refPath)) - .then(function() { - return capture.image.save(opts.refPath); - }); - } -}; diff --git a/lib/state-processor/capture-processor/screen-updater/screen-updater.js b/lib/state-processor/capture-processor/screen-updater/screen-updater.js deleted file mode 100644 index 01d5674ba..000000000 --- a/lib/state-processor/capture-processor/screen-updater/screen-updater.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var fs = require('q-io/fs'), - CaptureProcessor = require('../capture-processor'); - -module.exports = class ScreenUpdater extends CaptureProcessor { - exec(capture, opts) { - var refPath = opts.refPath, - _this = this; - - return fs.exists(refPath) - .then(function(isRefExists) { - return _this._processCapture(capture, opts, isRefExists); - }) - .thenResolve({imagePath: refPath}); - } - - _processCapture() { - throw new Error('Not implemented'); - } -}; diff --git a/lib/state-processor/capture-processor/tester.js b/lib/state-processor/capture-processor/tester.js deleted file mode 100644 index 516f4dcfc..000000000 --- a/lib/state-processor/capture-processor/tester.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -var q = require('q'), - fs = require('q-io/fs'), - _ = require('lodash'), - temp = require('../../temp'), - - CaptureProcessor = require('./capture-processor'), - Image = require('../../image'), - NoRefImageError = require('../../errors/no-ref-image-error'); - -module.exports = class Tester extends CaptureProcessor { - static create(diffColor) { - return new Tester(diffColor); - } - - constructor(diffColor) { - super(); - - this._diffColor = diffColor; - } - - exec(capture, opts) { - var referencePath = opts.refPath, - tmpPath = temp.path({suffix: '.png'}); - - return capture.image.save(tmpPath) - .then(() => fs.exists(referencePath)) - .then(refExists => { - if (!refExists) { - return q.reject(new NoRefImageError(referencePath, tmpPath)); - } - }) - .then(() => { - return [tmpPath, Image.compare(tmpPath, referencePath, { - canHaveCaret: capture.canHaveCaret, - tolerance: opts.tolerance, - pixelRatio: opts.pixelRatio - })]; - }) - .spread((currentPath, equal) => { - return {referencePath, currentPath, equal}; - }); - } - - postprocessResult(result, opts) { - return _.extend(result, { - saveDiffTo: diffPath => { - return Image.buildDiff({ - reference: result.referencePath, - current: result.currentPath, - diff: diffPath, - diffColor: this._diffColor, - tolerance: opts.tolerance - }); - } - }); - } -}; diff --git a/lib/state-processor/capture-processor/utils.js b/lib/state-processor/capture-processor/utils.js new file mode 100644 index 000000000..3c40016e0 --- /dev/null +++ b/lib/state-processor/capture-processor/utils.js @@ -0,0 +1,19 @@ +'use strict'; + +const fs = require('fs-extra'); +const path = require('path'); + +exports.copyImg = (currPath, refPath) => fs.copyAsync(currPath, refPath) + .then(() => true) + .catch(() => false); + +exports.saveRef = (refPath, capture) => { + return fs.mkdirsAsync(path.dirname(refPath)) + .then(() => capture.image.save(refPath)) + .then(() => true) + .catch(() => false); +}; + +exports.existsRef = (refPath) => fs.accessAsync(refPath) + .then(() => true) + .catch(() => false); diff --git a/lib/state-processor/index.js b/lib/state-processor/index.js index 3a96e7fef..bb960645b 100644 --- a/lib/state-processor/index.js +++ b/lib/state-processor/index.js @@ -1,21 +1,14 @@ 'use strict'; -var StateProcessor = require('./state-processor'), - RunnerEvents = require('../constants/runner-events'); - -function create(captureProcessorName, jobDoneEvent, constructorArg) { - return new StateProcessor({ - module: require.resolve('./capture-processor/' + captureProcessorName), - constructorArg - }, jobDoneEvent); -} +const UpdateStateProcessor = require('./update-state-processor'); +const TestStateProcessor = require('./test-state-processor'); module.exports = { createTester: function(config) { - return create('tester', RunnerEvents.END_TEST, config.system.diffColor); + return new TestStateProcessor(config); }, - createScreenUpdater: function(options) { - return create('screen-updater', RunnerEvents.CAPTURE, options); + createScreenUpdater: function(config, options) { + return new UpdateStateProcessor(config, options); } }; diff --git a/lib/state-processor/job.js b/lib/state-processor/job.js index 387b75eee..6321a0597 100644 --- a/lib/state-processor/job.js +++ b/lib/state-processor/job.js @@ -1,16 +1,19 @@ 'use strict'; -var CaptureSession = require('../capture-session'), - temp = require('../temp'); +const CaptureProcessor = require('./capture-processor'); +const CaptureSession = require('../capture-session'); +const {temp} = require('gemini-core'); +const Promise = require('bluebird'); -module.exports = function(args, cb) { +Promise.promisifyAll(require('fs-extra')); + +module.exports = (args, cb) => { temp.attach(args.temp); - var captureProcessor = require(args.captureProcessorInfo.module) - .create(args.captureProcessorInfo.constructorArg); + const captureProcessor = CaptureProcessor.create(args.captureProcessorType); return CaptureSession.fromObject(args.browserSession) - .then(browserSession => browserSession.capture(args.page)) - .then(capture => captureProcessor.exec(capture, args.execOpts)) + .then((browserSession) => browserSession.capture(args.page)) + .then((capture) => captureProcessor.exec(capture, args.execOpts)) .then(cb.bind(null, null), cb); }; diff --git a/lib/state-processor/state-processor.js b/lib/state-processor/state-processor.js index 67f5dc916..96695a495 100644 --- a/lib/state-processor/state-processor.js +++ b/lib/state-processor/state-processor.js @@ -1,47 +1,50 @@ 'use strict'; -var _ = require('lodash'), - q = require('q'), - workerFarm = require('worker-farm'), - temp = require('../temp'), - RunnerEvents = require('../constants/runner-events'), - errorUtils = require('../errors/utils'); +const _ = require('lodash'); +const Promise = require('bluebird'); +const workerFarm = require('worker-farm'); -module.exports = class StateProcessor { - constructor(captureProcessorInfo, jobDoneEvent) { - this._captureProcessorInfo = captureProcessorInfo; - this._captureProcessor = require(captureProcessorInfo.module) - .create(captureProcessorInfo.constructorArg); +const {temp} = require('gemini-core'); +const Events = require('../constants/events'); +const errorUtils = require('../errors/utils'); - this.jobDoneEvent = jobDoneEvent; +module.exports = class StateProcessor { + constructor(captureProcessorType, maxConcurrentWorkers) { + this._captureProcessorType = captureProcessorType; + this._maxConcurrentWorkers = maxConcurrentWorkers; } prepare(emitter) { - this._workers = workerFarm(require.resolve('./job')); - emitter.on(RunnerEvents.END, () => workerFarm.end(this._workers)); + const workerFarmConfig = { + maxConcurrentWorkers: this._maxConcurrentWorkers + }; + this._workers = workerFarm(workerFarmConfig, require.resolve('./job')); + emitter.on(Events.END, () => workerFarm.end(this._workers)); } exec(state, browserSession, page) { - var coverage = page.coverage, - jobArgs = { - captureProcessorInfo: this._captureProcessorInfo, - browserSession: browserSession.serialize(), - page: _.omit(page, 'coverage'), - execOpts: { - pixelRatio: page.pixelRatio, - refPath: browserSession.browser.config.getScreenshotPath(state.suite, state.name), - tolerance: _.isNumber(state.tolerance) - ? state.tolerance - : browserSession.browser.config.tolerance - }, - temp: temp.serialize() - }; + const browserConfig = browserSession.browser.config; + const coverage = page.coverage; + const tolerance = _.isNumber(state.tolerance) + ? state.tolerance + : browserConfig.tolerance; + + const jobArgs = { + captureProcessorType: this._captureProcessorType, + browserSession: browserSession.serialize(), + page: _.omit(page, 'coverage'), + execOpts: { + refImg: {path: browserConfig.getScreenshotPath(state.suite, state.name), size: null}, + pixelRatio: page.pixelRatio, + antialiasingTolerance: browserConfig.antialiasingTolerance, + tolerance, + compareOpts: browserConfig.compareOpts + }, + temp: temp.serialize() + }; - return q.nfcall(this._workers, jobArgs) - .fail(err => q.reject(errorUtils.fromPlainObject(err))) - .then(result => { - result.coverage = coverage; - return this._captureProcessor.postprocessResult(result, jobArgs.execOpts); - }); + return Promise.fromCallback((cb) => this._workers(jobArgs, cb)) + .catch(err => Promise.reject(errorUtils.fromPlainObject(err))) + .then(result => _.extend(result, {coverage, tolerance})); } }; diff --git a/lib/state-processor/test-state-processor.js b/lib/state-processor/test-state-processor.js new file mode 100644 index 000000000..d2956089f --- /dev/null +++ b/lib/state-processor/test-state-processor.js @@ -0,0 +1,41 @@ +'use strict'; + +const _ = require('lodash'); + +const StateProcessor = require('./state-processor'); +const Events = require('../constants/events'); +const {Image} = require('gemini-core'); + +module.exports = class TestStateProcessor extends StateProcessor { + constructor(config) { + super('tester', config.system.workers); + + this._diffColor = config.system.diffColor; + } + + exec(state, browserSession, page, emit) { + return super.exec(state, browserSession, page) + .then((result) => { + if (!result.equal) { + const {buildDiffOpts, antialiasingTolerance} = browserSession.browser.config; + result = this._attachDiffBuilder(result, {buildDiffOpts, antialiasingTolerance}); + } + + emit(Events.TEST_RESULT, result); + }); + } + + _attachDiffBuilder(result, {buildDiffOpts, antialiasingTolerance}) { + return _.extend(result, { + saveDiffTo: (diffPath) => Image.buildDiff({ + reference: result.refImg.path, + current: result.currImg.path, + diff: diffPath, + diffColor: this._diffColor, + tolerance: result.tolerance, + antialiasingTolerance, + ...buildDiffOpts + }) + }); + } +}; diff --git a/lib/state-processor/update-state-processor.js b/lib/state-processor/update-state-processor.js new file mode 100644 index 000000000..98993bcf5 --- /dev/null +++ b/lib/state-processor/update-state-processor.js @@ -0,0 +1,21 @@ +'use strict'; + +const StateProcessor = require('./state-processor'); +const Events = require('../constants/events'); + +module.exports = class UpdateStateProcessor extends StateProcessor { + constructor(config, opts) { + const updaterType = opts.diff && !opts.new && 'diff-updater' + || !opts.diff && opts.new && 'new-updater' + || 'meta-updater'; + + super(updaterType, config.system.workers); + } + + exec(state, browserSession, page, emit) { + return super.exec(state, browserSession, page) + .then((result) => { + emit(Events.UPDATE_RESULT, result); + }); + } +}; diff --git a/lib/state.js b/lib/state.js index 3209e2db8..54e01c1c9 100644 --- a/lib/state.js +++ b/lib/state.js @@ -1,47 +1,50 @@ 'use strict'; -var inherit = require('inherit'), - suiteUtil = require('./suite-util'); +const _ = require('lodash'); -module.exports = inherit({ - __constructor: function(suite, name) { +module.exports = class State { + constructor(suite, name) { this.suite = suite; this.name = name; this._ownTolerance = null; this.actions = []; - this.browsers = suite.browsers; - this.metaInfo = { - get url() { - return suite.url; - } - }; - }, - - shouldSkip: function(browserId) { - return suiteUtil.shouldSkip(this.suite, browserId); - }, + this.browsers = _.clone(suite.browsers); + } + + clone() { + const clonedState = new State(this.suite, this.name); + ['_ownTolerance', 'actions'].forEach((prop) => { + clonedState[prop] = _.clone(this[prop]); + }); + + return clonedState; + } + + shouldSkip(browserId) { + return this.suite.shouldSkip(browserId); + } get fullName() { - return this.suite.fullName + ' ' + this.name; - }, + return `${this.suite.fullName} ${this.name}`; + } get skipped() { return this.suite.skipped; - }, + } get captureSelectors() { return this.suite.captureSelectors; - }, + } get ignoreSelectors() { return this.suite.ignoreSelectors; - }, + } get tolerance() { - return this._ownTolerance === null? this.suite.tolerance : this._ownTolerance; - }, + return this._ownTolerance === null ? this.suite.tolerance : this._ownTolerance; + } set tolerance(value) { this._ownTolerance = value; } -}); +}; diff --git a/lib/stats.js b/lib/stats.js index bdd128389..02a52807d 100644 --- a/lib/stats.js +++ b/lib/stats.js @@ -1,39 +1,40 @@ 'use strict'; -var _ = require('lodash'), - RunnerEvents = require('./constants/runner-events'); +const {BaseStats} = require('gemini-core'); +const RunnerEvents = require('./constants/events'); -/** - * @constructor - * @param {Runner} [runner] - */ -module.exports = function(runner) { - var data = {}; +const statNames = { + TOTAL: 'total', + UPDATED: 'updated', + PASSED: 'passed', + FAILED: 'failed', + SKIPPED: 'skipped', + RETRIES: 'retries' +}; - function add(key) { - data[key] = data[key] || 0; - data[key]++; +module.exports = class Stats extends BaseStats { + constructor() { + super(statNames); } - if (runner) { - runner - .on(RunnerEvents.BEGIN_STATE, _.partial(add, 'total')) - .on(RunnerEvents.SKIP_STATE, function() { - add('total'); - add('skipped'); - }) - .on(RunnerEvents.WARNING, _.partial(add, 'warned')) - .on(RunnerEvents.ERROR, _.partial(add, 'errored')) + addUpdated(test) { + return this._addStat(this._statNames.UPDATED, test); + } - .on(RunnerEvents.CAPTURE, _.partial(add, 'gathered')) - .on(RunnerEvents.END_TEST, function(res) { - add(res && res.equal? 'passed' : 'failed'); - }); + attachRunner(runner) { + runner + .on(RunnerEvents.SKIP_STATE, (test) => this.addSkipped(test)) + .on(RunnerEvents.ERROR, (test) => this.addFailed(test)) + .on(RunnerEvents.UPDATE_RESULT, (test) => test.updated ? this.addUpdated(test) : this.addPassed(test)) + .on(RunnerEvents.TEST_RESULT, (test) => test.equal ? this.addPassed(test) : this.addFailed(test)) + .on(RunnerEvents.RETRY, () => this.addRetries()); } - this.add = add; + _buildStateKey(test) { + return test.state.name; + } - this.get = function(name) { - return name === undefined? data : data[name]; - }; + _buildSuiteKey(test) { + return `${test.suite.fullName} ${test.browserId}`; + } }; diff --git a/lib/suite-collection.js b/lib/suite-collection.js index c59413d29..0d5dce269 100644 --- a/lib/suite-collection.js +++ b/lib/suite-collection.js @@ -1,70 +1,72 @@ 'use strict'; -var _ = require('lodash'), - inherit = require('inherit'), - format = require('util').format; +const _ = require('lodash'); +const SuiteBuilder = require('./tests-api/suite-builder'); -module.exports = inherit({ - __constructor: function(suites) { - this._suites = suites || []; +module.exports = class SuiteCollection { + constructor(suites) { + this._suites = _.clone(suites) || []; this._originalBrowsers = {}; - }, + } - add: function(suite) { + add(suite) { this._suites.push(suite); return this; - }, + } + + clone() { + const clonedSuites = this._suites.map((suite) => suite.clone()); + return new SuiteCollection(clonedSuites); + } - topLevelSuites: function() { + topLevelSuites() { return this._suites; - }, + } - allSuites: function() { - return _.flattenDeep(flat_(this._suites)); + allSuites() { + const flat_ = (suites) => _.map(suites, (s) => [s, flat_(s.children)]); - function flat_(suites) { - if (!suites) { - return []; - } + return _.flattenDeep(flat_(this._suites)); + } - return suites - .map(function(suite) { - return [suite, flat_(suite.children)]; - }); - } - }, + skipBrowsers(browsers) { + this.topLevelSuites().forEach((suite) => { + const suiteBuilder = new SuiteBuilder(suite); + suiteBuilder.skip(browsers, 'The test was skipped by environment variable GEMINI_SKIP_BROWSERS'); + }); + } - disableAll: function() { + disableAll() { return this._applyToTopLevel(this.disable); - }, + } - enableAll: function() { + enableAll() { return this._applyToTopLevel(this.enable); - }, + } - _applyToTopLevel: function(method) { - this.topLevelSuites().forEach(function(suite) { - method.call(this, suite); - }, this); + _applyToTopLevel(method) { + this.topLevelSuites().forEach((suite) => method.call(this, suite)); return this; - }, + } + + disable(suite, opts) { + this._applyRecursive(this._disableEntity, suite, opts); - disable: function(suite, opts) { - this._applyRecrusive(this._disableEntity, suite, opts); return this; - }, + } - enable: function(suite, opts) { - suite = this._applyRecrusive(this._enableEntity, suite, opts); + enable(suite, opts) { + suite = this._applyRecursive(this._enableEntity, suite, opts); while (suite) { this._enableEntity(suite, opts && opts.browser); suite = suite.parent; } + return this; - }, + } - _applyRecrusive: function(method, suite, opts) { + _applyRecursive(method, suite, opts) { opts = opts || {}; if (_.isString(suite)) { @@ -74,45 +76,48 @@ module.exports = inherit({ if (opts.state) { method.call(this, this._findState(opts.state, suite), opts.browser); } else { - suite.children.forEach(function(child) { - this._applyRecrusive(method, child, opts); - }, this); + suite.children.forEach((child) => this._applyRecursive(method, child, opts)); suite.states.forEach(_.bind(method, this, _, opts.browser)); method.call(this, suite, opts.browser); } return suite; - }, + } + + _findSuite(fullName) { + const suite = _.find(this.allSuites(), {fullName}); - _findSuite: function(fullName) { - var suite = _.find(this.allSuites(), {fullName: fullName}); if (!suite) { throw new Error('Unknown suite: ' + fullName); } + return suite; - }, + } + + _findState(name, suite) { + const state = _.find(suite.states, {name}); - _findState: function(name, suite) { - var state = _.find(suite.states, {name: name}); if (!state) { - throw new Error(format('No such state `%s` in suite `%s`', name, suite.fullName)); + throw new Error(`No such state ${name} in suite ${suite.fullName}`); } + return state; - }, + } - _disableEntity: function(obj, browser) { - this._originalBrowsers[obj.fullName] = obj.browsers; - obj.browsers = browser? _.without(obj.browsers, browser) : []; - }, + _disableEntity(obj, browser) { + this._originalBrowsers[obj.fullName + obj.file] = obj.browsers; + obj.browsers = browser ? _.without(obj.browsers, browser) : []; + } - _enableEntity: function(obj, browser) { - if (!browser && this._originalBrowsers[obj.fullName]) { - obj.browsers = _.union(obj.browsers, this._originalBrowsers[obj.fullName]); + _enableEntity(obj, browser) { + const suiteKey = obj.fullName + obj.file; + if (!browser && this._originalBrowsers[suiteKey]) { + obj.browsers = _.union(obj.browsers, this._originalBrowsers[suiteKey]); } if (browser) { obj.browsers = _.union(obj.browsers, [browser]); } } -}); +}; diff --git a/lib/suite-monitor.js b/lib/suite-monitor.js index b3a7de722..90862738e 100644 --- a/lib/suite-monitor.js +++ b/lib/suite-monitor.js @@ -4,9 +4,9 @@ var EventEmitter = require('events').EventEmitter, _ = require('lodash'), inherit = require('inherit'), - RunnerEvents = require('./constants/runner-events'); + Events = require('./constants/events'); -module.exports = inherit(EventEmitter, { +const SuiteMonitor = module.exports = inherit(EventEmitter, { __constructor: function() { this.awaiting = {}; @@ -16,7 +16,7 @@ module.exports = inherit(EventEmitter, { suiteFinished: function(suite, browser) { if (suite.children.length === 0) { this._markAsCompleted(suite, browser); - this.emit(RunnerEvents.END_SUITE, {suite: suite, browserId: browser}); + this.emit(Events.END_SUITE, {suite: suite, browserId: browser}); } else { if (!this.awaiting[browser]) { this.awaiting[browser] = []; @@ -38,7 +38,7 @@ module.exports = inherit(EventEmitter, { _.forEachRight(suites, function(suite, i) { if (_.every(suite.children, this._isCompletedInBrowser.bind(this, browser))) { this._markAsCompleted(suite, browser); - this.emit(RunnerEvents.END_SUITE, {suite: suite, browserId: browser}); + this.emit(Events.END_SUITE, {suite: suite, browserId: browser}); complete.push(i); } }.bind(this)); @@ -56,4 +56,8 @@ module.exports = inherit(EventEmitter, { return this.complete.has(suite) && this.complete.get(suite)[browser]; } +}, { + create: function() { + return new SuiteMonitor(); + } }); diff --git a/lib/suite-util.js b/lib/suite-util.js deleted file mode 100644 index 9d26b7456..000000000 --- a/lib/suite-util.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -exports.shouldSkip = function(suite, browserId) { - var skipped = suite.skipped; - - if (typeof skipped === 'boolean') { - return skipped; - } - - return skipped.some(function(browserSkipMatcher) { - if (browserSkipMatcher.matches(browserId)) { - suite.skipComment = browserSkipMatcher.comment; - return true; - } else { - return false; - } - }); -}; diff --git a/lib/suite.js b/lib/suite.js index fbad7a157..13f8c908f 100644 --- a/lib/suite.js +++ b/lib/suite.js @@ -1,7 +1,6 @@ 'use strict'; -var inherit = require('inherit'), - _ = require('lodash'); +const _ = require('lodash'); function definePrivate(suite) { Object.defineProperty(suite, '_states', { @@ -13,11 +12,11 @@ function definePrivate(suite) { }); } -var Suite = inherit({ - __constructor: function(name) { +module.exports = class Suite { + constructor(name) { this.name = name; this.url = null; - this.skipped = false; + this.skipped = []; this.captureSelectors = null; this.tolerance = null; this.ignoreSelectors = []; @@ -25,82 +24,109 @@ var Suite = inherit({ this.afterActions = []; this.browsers = []; this.context = {}; + this.file = null; definePrivate(this); - }, - - addState: function(state) { - this._states.push(state); - }, + } - skip: function(browserSkipMatcher) { - if (this.skipped === true) { - return; + static create(name, parent) { + if (!parent) { + return new Suite(name); } - if (!browserSkipMatcher) { - this.skipped = true; - } else { - this.skipped = _.isArray(this.skipped) - ? this.skipped.concat(browserSkipMatcher) - : [browserSkipMatcher]; + if (_.isEmpty(name)) { + throw new Error('Empty suite name'); } - }, - hasChildNamed: function(name) { - return _.some(this._children, {name: name}); - }, + const suite = Object.create(parent); + definePrivate(suite); + suite.name = name; + suite.path = parent.path ? parent.path.concat(name) : [name]; + suite.context = _.clone(parent.context); + + return suite; + } + + addState(state) { + state.suite = this; + this._states.push(state); + } + + skip(browserSkipMatcher) { + this.skipped = this.skipped.concat(browserSkipMatcher); + } + + shouldSkip(browserId) { + return this.skipped.some((browserSkipMatcher) => { + if (browserSkipMatcher.matches(browserId)) { + this.skipComment = browserSkipMatcher.comment; + return true; + } + + return false; + }); + } + + clone() { + const clonedSuite = Suite.create(this.name, this.parent); + + _.forOwn(this, (value, key) => { + clonedSuite[key] = _.clone(value); + }); + + this.children.forEach((child) => clonedSuite.addChild(child.clone())); + this.states.forEach((state) => clonedSuite.addState(state.clone())); - hasStateNamed: function(name) { + return clonedSuite; + } + + hasChild(name, browsers) { + return _.some(this.children, (child) => { + return _.isEqual(child.name, name) && !_.isEmpty(_.intersection(child.browsers, browsers)); + }); + } + + hasStateNamed(name) { return _.some(this._states, {name: name}); - }, + } get states() { return this._states; - }, + } get children() { return this._children; - }, + } - addChild: function(suite) { - suite.parent = this; - this._children.push(suite); - }, + addChild(child) { + Object.setPrototypeOf(child, this); + this._children.push(child); + } - removeChild: function(suite) { - var index = _.indexOf(this._children, suite); + removeChild(suite) { + const index = _.indexOf(this._children, suite); if (index !== -1) { - suite.parent = null; + Object.setPrototypeOf(suite, Suite.prototype); this._children.splice(index, 1); } - }, + } get hasStates() { return this._states.length > 0; - }, + } get isRoot() { return !this.parent; - }, + } + + get parent() { + const proto = Object.getPrototypeOf(this); + return proto === Suite.prototype ? null : proto; + } get fullName() { return this.isRoot ? this.name : _.compact([this.parent.fullName, this.name]).join(' '); } -}); - -exports.create = function createSuite(name, parent) { - if (!parent) { - return new Suite(name); - } - - var suite = Object.create(parent); - definePrivate(suite); - suite.name = name; - suite.path = parent.path? parent.path.concat(name) : [name]; - suite.context = _.clone(parent.context); - parent.addChild(suite); - return suite; }; diff --git a/lib/temp.js b/lib/temp.js deleted file mode 100644 index e675b6503..000000000 --- a/lib/temp.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -var inherit = require('inherit'), - temp = require('temp'), - path = require('path'), - _ = require('lodash'); - -temp.track(); - -var Temp = inherit({ - __constructor: function(dir, opts) { - opts = opts || {}; - - this._tempDir = opts.attach - ? dir - : temp.mkdirSync({ - dir: dir && path.resolve(dir), - prefix: '.gemini.tmp.' - }); - }, - - path: function(opts) { - return temp.path(_.extend(opts || {}, { - dir: this._tempDir - })); - }, - - serialize: function() { - return {dir: this._tempDir}; - } -}); - -var tempInstance; -module.exports = { - init: function(dir) { - if (!tempInstance) { - tempInstance = new Temp(dir); - } - }, - - attach: function(serializedTemp) { - if (!tempInstance) { - tempInstance = new Temp(serializedTemp.dir, {attach: true}); - } - }, - - path: function(opts) { - return tempInstance.path(opts); - }, - - serialize: function() { - return tempInstance.serialize(); - } -}; diff --git a/lib/test-reader.js b/lib/test-reader.js index 43910544d..8e8a933a5 100644 --- a/lib/test-reader.js +++ b/lib/test-reader.js @@ -1,78 +1,36 @@ 'use strict'; -var _ = require('lodash'), - q = require('q'), - Suite = require('./suite'), - pathUtils = require('./path-utils'), - testsApi = require('./tests-api'), - utils = require('./utils'); +const _ = require('lodash'); +const SetsBuilder = require('gemini-core').SetsBuilder; +const Suite = require('./suite'); +const Events = require('./constants/events'); +const testsApi = require('./tests-api'); +const utils = require('./utils'); -module.exports = function(paths, config) { - return q.all([ - expandSets(config.sets, config.system.projectRoot), - pathUtils.expandPaths(paths || []) - ]) - .spread(function(sets, filesToRun) { - var files = _.isEmpty(filesToRun) - ? getFiles(sets) - : filesToRun; +const DEFAULT_DIR = require('../package').name; - return loadSuites(files, sets, config); - }); -}; - -/// -function getFiles(sets) { - return _(sets) - .map('files') - .flatten() - .uniq() - .value(); -} +const loadSuites = (sets, emitter, config) => { + const rootSuite = Suite.create(''); -/// -function expandSets(sets, projectRoot) { - return _(sets) - .map(function(set) { - return pathUtils.expandPaths(set.files, projectRoot) - .then(function(files) { - return _.extend(set, {files: files}); - }); - }) - .thru(q.all) - .value(); -} + _.forEach(sets.groupByFile(), (browsers, filePath) => { + global.gemini = testsApi(rootSuite, browsers, filePath, config); -/** - * @param {String[]} files - * @param {Objct[]} sets - * @param {Config} config - * @return {Suite} root suite - */ -function loadSuites(files, sets, config) { - var rootSuite = Suite.create(''); + emitter.emit(Events.BEFORE_FILE_READ, filePath); + utils.requireWithNoCache(filePath); + emitter.emit(Events.AFTER_FILE_READ, filePath); - files.forEach(function(file) { - var browsers = getBrowsers(file, sets, config); - global.gemini = testsApi(rootSuite, browsers); - utils.requireWithNoCache(file); delete global.gemini; }); return rootSuite; -} - -function getBrowsers(file, sets, config) { - var browsers = _(sets) - .filter(function(set) { - return _.contains(set.files, file); - }) - .map('browsers') - .flatten() - .uniq() - .value(); +}; - return _.isEmpty(browsers) - ? config.getBrowserIds() - : browsers; -} +module.exports = (emitter, config, opts) => { + return SetsBuilder + .create(config.sets, {defaultDir: DEFAULT_DIR}) + .useSets(opts.sets) + .useFiles(opts.paths) + .useBrowsers(opts.browsers) + .build(config.system.projectRoot, {ignore: config.system.exclude}) + .then((setCollection) => loadSuites(setCollection, emitter, config)); +}; diff --git a/lib/tests-api/actions-builder.js b/lib/tests-api/actions-builder.js index 16a5f2f23..0eee1a946 100644 --- a/lib/tests-api/actions-builder.js +++ b/lib/tests-api/actions-builder.js @@ -1,27 +1,30 @@ 'use strict'; -const inherit = require('inherit'); const _ = require('lodash'); -const q = require('q'); -const fs = require('q-io/fs'); +const Promise = require('bluebird'); +const fs = require('fs-extra'); const wd = require('wd'); const StateError = require('../errors/state-error'); const find = require('./find-func').find; -module.exports = inherit({ - __constructor: function(actions) { +module.exports = class ActionsBuilder { + static create(actions) { + return new ActionsBuilder(actions); + } + + constructor(actions) { this._actions = actions; - }, + } - wait: function(milliseconds) { - this._pushAction(this.wait, function wait(browser) { + wait(milliseconds) { + this._pushAction(this.wait, (browser) => { return browser.sleep(milliseconds); }); return this; - }, + } - waitForElementToShow: function waitForElementToShow(selector, timeout) { + waitForElementToShow(selector, timeout) { this._waitElementAction(this.waitForElementToShow, selector, { timeout: timeout, asserter: wd.asserters.isDisplayed, @@ -29,9 +32,9 @@ module.exports = inherit({ }); return this; - }, + } - waitForElementToHide: function waitForElementToHide(selector, timeout) { + waitForElementToHide(selector, timeout) { this._waitElementAction(this.waitForElementToHide, selector, { timeout: timeout, asserter: wd.asserters.isNotDisplayed, @@ -39,44 +42,46 @@ module.exports = inherit({ }); return this; - }, + } + + _waitElementAction(method, selector, options) { + options = _.defaults(options, {timeout: 1000}); - _waitElementAction: function(method, selector, options) { if (typeof selector !== 'string') { throw new TypeError(method.name + ' accepts only CSS selectors'); } - var timeout = (typeof options.timeout !== 'undefined'? options.timeout : 1000); + if (typeof options.timeout !== 'number') { + throw new TypeError(method.name + ' accepts only numeric timeout'); + } - this._pushAction(method, function(browser) { - return browser.waitForElementByCssSelector(selector, options.asserter, timeout) - .fail(function() { + this._pushAction(method, (browser) => { + return browser.waitForElementByCssSelector(selector, options.asserter, options.timeout) + .catch(() => { //assuming its timeout error, no way to distinguish - return q.reject(new StateError( - 'Element ' + selector + ' ' + options.error + ' in ' + timeout + 'ms')); + return Promise.reject(new StateError( + 'Element ' + selector + ' ' + options.error + ' in ' + options.timeout + 'ms')); }); }); return this; - }, + } - waitForJSCondition: function(jsFunc, timeout) { + waitForJSCondition(jsFunc, timeout) { if (typeof jsFunc !== 'function') { throw new TypeError('waitForCondition should accept function'); } - timeout = (typeof timeout === 'undefined'? 1000 : timeout); + timeout = (typeof timeout === 'undefined' ? 1000 : timeout); - this._pushAction(this.waitForJSCondition, function(browser) { + this._pushAction(this.waitForJSCondition, (browser) => { return browser.waitFor(wd.asserters.jsCondition(serializeFunc(jsFunc)), timeout) - .fail(function() { - return q.reject(new StateError('Condition was not met in ' + timeout + 'ms')); - }); + .catch(() => Promise.reject(new StateError('Condition was not met in ' + timeout + 'ms'))); }); return this; - }, + } - _pushAction: function(method, action) { - var stackHolder = {}; + _pushAction(method, action) { + let stackHolder = {}; // capture stack trace to use it later in case // of an error. @@ -84,7 +89,7 @@ module.exports = inherit({ this._actions.push(function() { return action.apply(null, arguments) - .fail(function(e) { + .catch((e) => { if (e instanceof StateError) { // replace stack of the error, so that // stacktrace will now link to user's @@ -92,111 +97,87 @@ module.exports = inherit({ // of gemini's internals. replaceStack(e, stackHolder.stack); } - return q.reject(e); + return Promise.reject(e); }); }); - }, + } - click: function(element, button) { - if (isInvalidMouseButton(button)) { - throw new TypeError('Mouse button should be 0 (left), 1 (right) or 2 (middle)'); - } + click(element, button) { + button = acceptMouseButton(button); if (isInvalidElement(element)) { throw new TypeError('.click() must receive valid element or CSS selector'); } - this._pushAction(this.click, function mouseDown(browser) { + this._pushAction(this.click, (browser) => { return findElement(element, browser) - .then(function(element) { - return browser.moveTo(element); - }) - .then(function() { - return browser.click(button); - }); + .then((element) => browser.moveTo(element)) + .then(() => browser.click(button)); }); return this; - }, - - doubleClick: function(element, button) { - if (isInvalidMouseButton(button)) { - throw new TypeError('Mouse button should be 0 (left), 1 (right) or 2 (middle)'); - } + } + doubleClick(element) { if (isInvalidElement(element)) { throw new TypeError('.doubleClick() must receive valid element or CSS selector'); } - this._pushAction(this.doubleClick, function(browser) { + this._pushAction(this.doubleClick, (browser) => { return findElement(element, browser) - .then(function() { - return browser.moveTo(element); - }) - .then(function() { - return browser.doubleClick(element, button); + .then((element) => { + return browser.moveTo(element) + .then(() => browser.doubleclick()); }); }); return this; - }, + } - dragAndDrop: function(element, dragTo) { + dragAndDrop(element, dragTo) { if (isInvalidElement(element)) { throw new TypeError('.dragAndDrop() "element" argument should be valid element or CSS selector'); } - if (isInvalidElement(element)) { + if (isInvalidElement(dragTo)) { throw new TypeError('.dragAndDrop() "dragTo" argument should be valid element or CSS selector'); } return this.mouseDown(element) .mouseMove(dragTo) .mouseUp(); - }, + } - mouseDown: function(element, button) { - if (isInvalidMouseButton(button)) { - throw new TypeError('Mouse button should be 0 (left), 1 (right) or 2 (middle)'); - } + mouseDown(element, button) { + button = acceptMouseButton(button); if (isInvalidElement(element)) { throw new TypeError('.mouseDown() must receive valid element or CSS selector'); } - this._pushAction(this.mouseDown, function mouseDown(browser) { + this._pushAction(this.mouseDown, (browser) => { return findElement(element, browser) - .then(function(element) { - return browser.moveTo(element); - }) - .then(function() { - return browser.buttonDown(button); - }); + .then((element) => browser.moveTo(element)) + .then(() => browser.buttonDown(button)); }); return this; - }, + } - mouseUp: function(element, button) { - if (isInvalidMouseButton(button)) { - throw new TypeError('Mouse button should be 0 (left), 1 (right) or 2 (middle)'); - } + mouseUp(element, button) { + button = acceptMouseButton(button); - this._pushAction(this.mouseUp, function mouseUp(browser) { - var action; + this._pushAction(this.mouseUp, (browser) => { + let action; if (element) { action = findElement(element, browser) - .then(function(element) { - return browser.moveTo(element); - }); + .then((element) => browser.moveTo(element)); } else { - action = q.resolve(); + action = Promise.resolve(); } - return action.then(function() { - return browser.buttonUp(button); - }); + return action.then(() => browser.buttonUp(button)); }); return this; - }, + } - mouseMove: function(element, offset) { + mouseMove(element, offset) { if (isInvalidElement(element)) { throw new TypeError('.mouseMove() must receive valid element or CSS selector'); } @@ -211,9 +192,9 @@ module.exports = inherit({ } } - this._pushAction(this.mouseMove, function mouseMove(browser) { + this._pushAction(this.mouseMove, (browser) => { return findElement(element, browser) - .then(function(element) { + .then((element) => { if (offset) { return browser.moveTo(element, offset.x, offset.y); } @@ -222,26 +203,22 @@ module.exports = inherit({ }); return this; - }, + } - sendKeys: function(element, keys) { - var action; + sendKeys(element, keys) { + let action; if (typeof keys === 'undefined' || keys === null) { keys = element; - action = function sendKeys(browser) { - return browser.keys(keys); - }; + action = (browser) => browser.keys(keys); } else { if (isInvalidElement(element)) { throw new TypeError('.sendKeys() must receive valid element or CSS selector'); } - action = function sendKeys(browser) { + action = (browser) => { return findElement(element, browser) - .then(function(element) { - return browser.type(element, keys); - }); + .then((element) => browser.type(element, keys)); }; } @@ -252,9 +229,9 @@ module.exports = inherit({ this._pushAction(this.sendKeys, action); return this; - }, + } - sendFile: function(element, path) { + sendFile(element, path) { if (typeof path !== 'string') { throw new TypeError('path must be string'); } @@ -262,81 +239,71 @@ module.exports = inherit({ throw new TypeError('.sendFile() must receive valid element or CSS selector'); } - this._pushAction(this.sendFile, function sendFile(browser) { - return fs.isFile(path) - .then(function(isFile) { - if (!isFile) { - return q.reject(new StateError(path + ' should be existing file')); + this._pushAction(this.sendFile, (browser) => { + return fs.statAsync(path) + .then((stat) => { + if (!stat.isFile()) { + return Promise.reject(new StateError(path + ' should be existing file')); } return findElement(element, browser); }) - .then(function(element) { - return element.sendKeys(path); - }); + .then((element) => element.sendKeys(path)); }); return this; - }, + } - focus: function(element) { + focus(element) { if (isInvalidElement(element)) { throw new TypeError('.focus() must receive valid element or CSS selector'); } return this.sendKeys(element, ''); - }, + } - tap: function(element) { + tap(element) { if (isInvalidElement(element)) { throw new TypeError('.tap() must receive valid element or CSS selector'); } - this._pushAction(this.tap, function tap(browser) { + this._pushAction(this.tap, (browser) => { return findElement(element, browser) - .then(function(elem) { - return browser.tapElement(elem); - }); + .then((elem) => browser.tapElement(elem)); }); return this; - }, + } - flick: function(offsets, speed, element) { + flick(offsets, speed, element) { if (element && isInvalidElement(element)) { throw new TypeError('.flick() must receive valid element or CSS selector'); } - this._pushAction(this.flick, function flick(browser) { + this._pushAction(this.flick, (browser) => { if (element) { return findElement(element, browser) - .then(function(elem) { - return browser.flick(elem, offsets.x, offsets.y, speed); - }); + .then((elem) => browser.flick(elem, offsets.x, offsets.y, speed)); } return browser.flick(offsets.x, offsets.y, speed); }); return this; - }, + } - executeJS: function(callback) { + executeJS(callback) { if (typeof callback !== 'function') { throw new TypeError('executeJS argument should be function'); } - this._pushAction(this.executeJS, function executeJS(browser) { - return browser.execute(serializeFunc(callback)); - }); + this._pushAction(this.executeJS, (browser) => browser.execute(serializeFunc(callback))); return this; - }, + } - setWindowSize: function(width, height) { - this._pushAction(this.setWindowSize, function setWindowSize(browser, postActions) { - return (postActions? mkRestoreAction_() : q()) - .then(function() { - return browser.setWindowSize(width, height); - }); + setWindowSize(width, height) { + this._pushAction(this.setWindowSize, (browser, postActions) => { + return (postActions ? mkRestoreAction_() : Promise.resolve()) + .then(() => browser.setWindowSize(width, height)); function mkRestoreAction_() { return browser.getWindowSize() - .then(function(size) { + .then((size) => { if (size.width !== width || size.height !== height) { postActions.setWindowSize(size.width, size.height); } @@ -345,31 +312,59 @@ module.exports = inherit({ }); return this; - }, - - changeOrientation: function() { - if (arguments.length) { - throw new TypeError('.changeOrientation() does not accept any arguments'); - } + } - const orientations = ['PORTRAIT', 'LANDSCAPE']; - const getAnotherOrientation = (orientation) => _(orientations).without(orientation).first(); + changeOrientation(options = {}) { + options = _.defaults(options, {timeout: 2500}); this._pushAction(this.changeOrientation, (browser, postActions) => { if (postActions) { - postActions.changeOrientation(); + postActions.changeOrientation(options); + } + + return getBodyWidth() + .then((initialBodyWidth) => { + return rotate() + .then((result) => waitForOrientationChange(initialBodyWidth).then(() => result)); + }); + + function getBodyWidth() { + return browser.evalScript(serializeFunc(function(window) { + return window.document.body.clientWidth; + })); } - return browser.getOrientation() - .then((initialOrientation) => browser.setOrientation(getAnotherOrientation(initialOrientation))); + function rotate() { + const orientations = ['PORTRAIT', 'LANDSCAPE']; + const getAnotherOrientation = (orientation) => _(orientations).without(orientation).first(); + + return browser.getOrientation() + .then((initialOrientation) => browser.setOrientation(getAnotherOrientation(initialOrientation))); + } + + function waitForOrientationChange(initialBodyWidth) { + return browser + .waitFor(wd.asserters.jsCondition(serializeFunc(function(window, initialBodyWidth) { + return window.document.body.clientWidth !== Number(initialBodyWidth); + }, [initialBodyWidth])), options.timeout) + .catch(() => Promise.reject(new StateError(`Orientation did not changed in ${options.timeout} ms`))); + } }); return this; } -}); +}; + +function acceptMouseButton(button) { + if (typeof button === 'undefined') { + return 0; + } -function isInvalidMouseButton(button) { - return typeof button !== 'undefined' && [0, 1, 2].indexOf(button) === -1; + if ([0, 1, 2].indexOf(button) === -1) { + throw new TypeError('Mouse button should be 0 (left), 1 (middle) or 2 (right)'); + } + + return button; } function isInvalidKeys(keys) { @@ -377,9 +372,7 @@ function isInvalidKeys(keys) { if (!Array.isArray(keys)) { return true; } - return keys.some(function(chunk) { - return typeof chunk !== 'string'; - }); + return keys.some((chunk) => typeof chunk !== 'string'); } return false; } @@ -389,17 +382,17 @@ function isInvalidElement(element) { } function replaceStack(error, stack) { - var message = error.stack.split('\n')[0]; + let message = error.stack.split('\n')[0]; error.stack = [message].concat(stack.split('\n').slice(1)).join('\n'); } -function serializeFunc(func) { - return '(' + func.toString() + '(window));'; +function serializeFunc(func, args) { + return '(' + func.toString() + (_.isEmpty(args) ? ')(window);' : `)(window, '${args.join('\', \'')}');`); } function findElement(element, browser) { if (element.cache && element.cache[browser.sessionId]) { - return q.resolve(element.cache[browser.sessionId]); + return Promise.resolve(element.cache[browser.sessionId]); } if (typeof element === 'string') { @@ -407,18 +400,18 @@ function findElement(element, browser) { } return browser.findElement(element._selector) - .then(function(foundElement) { + .then((foundElement) => { element.cache = element.cache || {}; element.cache[browser.sessionId] = foundElement; return foundElement; }) - .fail(function(error) { + .catch((error) => { if (error.status === 7) { error = new StateError('Could not find element with css selector in actions chain: ' + error.selector); } - return q.reject(error); + return Promise.reject(error); }); } diff --git a/lib/tests-api/index.js b/lib/tests-api/index.js index bb6464370..302b8beb7 100644 --- a/lib/tests-api/index.js +++ b/lib/tests-api/index.js @@ -1,14 +1,16 @@ 'use strict'; -var Suite = require('../suite'), - SuiteBuilder = require('./suite-builder'), - keysCodes = require('./keys-codes'); +const path = require('path'); +const _ = require('lodash'); +const Suite = require('../suite'); +const SuiteBuilder = require('./suite-builder'); +const keysCodes = require('./keys-codes'); -module.exports = function(suite, browsers) { - var suiteId = 1, - testsAPI = keysCodes; +module.exports = (suite, browsers, file, config) => { + let suiteId = 1; + const testsAPI = keysCodes; - testsAPI.suite = function(name, callback) { + testsAPI.suite = (name, callback) => { if (typeof name !== 'string') { throw new TypeError('First argument of the gemini.suite must be a string'); } @@ -17,15 +19,25 @@ module.exports = function(suite, browsers) { throw new TypeError('Second argument of the gemini.suite must be a function'); } - if (suite.hasChildNamed(name)) { - throw new Error('Suite ' + name + ' already exists at this level. Choose different name'); + if (suite.hasChild(name, browsers)) { + throw new Error(`Suite ${name} already exists at this level. Choose different name`); } - suite = Suite.create(name, suite); + const parent = suite; + suite = Suite.create(name, parent); + parent.addChild(suite); suite.id = suiteId++; - if (browsers && suite.parent.isRoot) { - suite.browsers = browsers; + + if (suite.parent.isRoot) { + if (browsers) { + suite.browsers = browsers; + } + + if (file) { + suite.file = path.relative(config.system.projectRoot, file); + } } + callback(new SuiteBuilder(suite)); if (suite.hasStates) { if (!suite.url) { @@ -43,5 +55,7 @@ module.exports = function(suite, browsers) { suite = suite.parent; }; + testsAPI.ctx = _.clone(config.system.ctx); + return testsAPI; }; diff --git a/lib/tests-api/skip/index.js b/lib/tests-api/skip/index.js new file mode 100644 index 000000000..debd83784 --- /dev/null +++ b/lib/tests-api/skip/index.js @@ -0,0 +1,42 @@ +'use strict'; + +const _ = require('lodash'); + +module.exports = class Skip { + constructor(suite) { + this._suite = suite; + } + + _validateArgs(browsers) { + if (!this._isArrayOfStringsAndRegExps(browsers)) { + throw new TypeError('Browsers must be an array with strings and RegExp objects'); + } + } + + _shouldSkip(browsers, {negate} = {}) { + const fn = negate ? _.every : _.some; + return (browserId) => fn(this._mkBrowsersMatcher(browsers, {negate}), (matcher) => matcher(browserId)); + } + + _mkBrowsersMatcher(browsers, {negate}) { + const mkMatcher = (browser) => _.isRegExp(browser) ? browser.test.bind(browser) : _.isEqual.bind(null, browser); + + return browsers.map((browser) => negate ? _.negate(mkMatcher(browser)) : mkMatcher(browser)); + } + + _isArrayOfStringsAndRegExps(arr) { + return _.isArray(arr) && _.every(arr, (item) => _.isString(item) || _.isRegExp(item)); + } + + in() { + return new Error('Not implemented'); + } + + notIn() { + return new Error('Not implemented'); + } + + buildAPI() { + return new Error('Not implemented'); + } +}; diff --git a/lib/tests-api/skip/only-builder.js b/lib/tests-api/skip/only-builder.js new file mode 100644 index 000000000..1e9a9d9e4 --- /dev/null +++ b/lib/tests-api/skip/only-builder.js @@ -0,0 +1,59 @@ +'use strict'; + +const Skip = require('./index'); +const _ = require('lodash'); + +module.exports = class OnlyBuilder extends Skip { + static create(suite) { + return new OnlyBuilder(suite); + } + + constructor(suite) { + super(suite); + } + + in(...browsers) { + return this._process(browsers); + } + + notIn(...browsers) { + return this._process(browsers, {negate: true}); + } + + _process(browsers, opts = {negate: false}) { + browsers = normalizeArgs(browsers); + this._validateArgs(browsers); + + this._suite.browsers = this._suite.browsers.filter(this._shouldSkip(browsers, opts)); + return this; + } + + buildAPI(context) { + const only = { + in: (...browsers) => { + this.in(...browsers); + return context; + }, + notIn: (...browsers) => { + this.notIn(...browsers); + return context; + } + }; + const browsers = (...browsers) => { + this.in(...browsers); + return context; + }; + + return {only, browsers}; + } +}; + +function normalizeArgs(browsers) { + if (browsers.length === 0) { + return; + } + if (browsers.length === 1 && _.isArray(browsers[0])) { + return browsers[0]; + } + return browsers; +} diff --git a/lib/tests-api/skip/skip-builder.js b/lib/tests-api/skip/skip-builder.js new file mode 100644 index 000000000..b4ef625e5 --- /dev/null +++ b/lib/tests-api/skip/skip-builder.js @@ -0,0 +1,52 @@ +'use strict'; + +const Skip = require('./index'); + +module.exports = class SkipBuilder extends Skip { + static create(suite) { + return new SkipBuilder(suite); + } + + constructor(suite) { + super(suite); + } + + in(browsers, comment) { + return this._process(browsers, comment); + } + + notIn(browsers, comment) { + return this._process(browsers, comment, {negate: true}); + } + + _process(browsers, comment, opts = {negate: false}) { + browsers = [].concat(browsers); + this._validateArgs(browsers); + + this._suite.skip({matches: this._shouldSkip(browsers, opts), comment}); + return this; + } + + buildAPI(context) { + const skip = (browsers, comment) => { + if (!browsers) { + browsers = /.*/; + } + + this.in(browsers, comment); + return context; + }; + + skip.in = (browsers, comment) => { + this.in(browsers, comment); + return context; + }; + + skip.notIn = (browsers, comment) => { + this.notIn(browsers, comment); + return context; + }; + + return {skip}; + } +}; diff --git a/lib/tests-api/suite-builder.js b/lib/tests-api/suite-builder.js index 9de73721f..0cecfb676 100644 --- a/lib/tests-api/suite-builder.js +++ b/lib/tests-api/suite-builder.js @@ -1,62 +1,70 @@ 'use strict'; -var _ = require('lodash'), - State = require('../state'), - find = require('./find-func').find, - ActionsBuilder = require('./actions-builder'); -module.exports = function(suite) { - this.setCaptureElements = function() { - var selectors = argumentsToArray(arguments); +const _ = require('lodash'); +const State = require('../state'); +const {find} = require('./find-func'); +const ActionsBuilder = require('./actions-builder'); +const SkipBuilder = require('./skip/skip-builder'); +const OnlyBuilder = require('./skip/only-builder'); + +module.exports = class SuiteBuilder { + constructor(suite) { + this._suite = suite; + this._injectSkip(); + } + + setCaptureElements(...selectors) { + selectors = _.flatten(selectors); - if (selectors.some(notString)) { + if (!selectors.every(_.isString)) { throw new TypeError('suite.captureElements accepts only strings or array of strings'); } - suite.captureSelectors = selectors; + this._suite.captureSelectors = selectors; return this; - }; + } - this.before = function(hook) { - if (typeof hook !== 'function') { + before(hook) { + if (!_.isFunction(hook)) { throw new TypeError('before hook must be a function'); } - suite.beforeActions = _.clone(suite.beforeActions); - hook.call(suite.context, new ActionsBuilder(suite.beforeActions), find); + this._suite.beforeActions = _.clone(this._suite.beforeActions); + hook.call(this._suite.context, ActionsBuilder.create(this._suite.beforeActions), find); return this; - }; + } - this.after = function(hook) { - if (typeof hook !== 'function') { + after(hook) { + if (!_.isFunction(hook)) { throw new TypeError('after hook must be a function'); } - var actions = []; - hook.call(suite.context, new ActionsBuilder(actions), find); - suite.afterActions = actions.concat(suite.afterActions); + const actions = []; + hook.call(this._suite.context, ActionsBuilder.create(actions), find); + this._suite.afterActions = actions.concat(this._suite.afterActions); return this; - }; + } - this.setUrl = function setUrl(url) { - if (typeof url !== 'string') { + setUrl(url) { + if (!_.isString(url)) { throw new TypeError('URL must be string'); } - suite.url = url; + this._suite.url = url; return this; - }; + } - this.setTolerance = function setTolerance(tolerance) { - if (typeof tolerance !== 'number') { + setTolerance(tolerance) { + if (!_.isNumber(tolerance)) { throw new TypeError('tolerance must be number'); } - suite.tolerance = tolerance; + this._suite.tolerance = tolerance; return this; - }; + } - this.capture = function capture(name, opts, cb) { - if (typeof name !== 'string') { + capture(name, opts, cb) { + if (!_.isString(name)) { throw new TypeError('State name should be string'); } @@ -68,85 +76,48 @@ module.exports = function(suite) { cb = cb || _.noop; opts = opts || {}; - if (typeof cb !== 'function') { + if (!_.isFunction(cb)) { throw new TypeError('Second argument of suite.capture must be a function'); } - if (suite.hasStateNamed(name)) { - throw new Error('State "' + name + '" already exists in suite "' + suite.name + '". ' + - 'Choose different name'); + if (this._suite.hasStateNamed(name)) { + throw new Error(`State "${name}" already exists in suite "${this._suite.name}". Choose different name`); } - var state = new State(suite, name); - cb.call(suite.context, new ActionsBuilder(state.actions), find); + const state = new State(this._suite, name); + cb.call(this._suite.context, ActionsBuilder.create(state.actions), find); if ('tolerance' in opts) { - if (typeof opts.tolerance !== 'number') { + if (!_.isNumber(opts.tolerance)) { throw new TypeError('Tolerance should be number'); } state.tolerance = opts.tolerance; } - suite.addState(state); + this._suite.addState(state); return this; - }; + } - this.ignoreElements = function ignoreElements() { - var selectors = argumentsToArray(arguments); + ignoreElements(...selectors) { + selectors = _.flatten(selectors); - if (selectors.some(notString)) { - throw new TypeError('suite.ignoreElements accepts only strings or array of strings'); - } - suite.ignoreSelectors = selectors; - return this; - }; - - this.skip = function skip(browser, comment) { - if (!browser) { - suite.skip(); - } else if (_.isArray(browser)) { - browser.forEach(_.bind(this.skip, this, _, comment)); - } else if (_.isString(browser) || _.isRegExp(browser)) { - suite.skip({matches: createMatcher(browser), comment: comment}); - } else { - throw new TypeError('suite.skip browser must be string or RegExp object'); - } - return this; - }; - - this.browsers = function browsers(matchers) { - matchers = [].concat(matchers); - if (!isArrayOfStringsAndRegExps(matchers)) { - throw new TypeError('suite.browsers must be string or RegExp object'); + if (selectors.some(isNotValidSelector)) { + throw new TypeError('suite.ignoreElements accepts strings, object with property "every" as string or array of them'); } - matchers = matchers.map(createMatcher); - suite.browsers = suite.browsers.filter(function(browser) { - return _.some(matchers, function(match) { - return match(browser); - }); - }); + this._suite.ignoreSelectors = selectors; return this; - }; -}; + } -function notString(arg) { - return typeof arg !== 'string'; -} + _injectSkip() { + const skipBuilder = SkipBuilder.create(this._suite); + const onlyBuilder = OnlyBuilder.create(this._suite); -function argumentsToArray(args) { - if (args.length === 1 && Array.isArray(args[0])) { - return args[0]; - } else { - return Array.prototype.slice.call(args); + _.extend(this, skipBuilder.buildAPI(this), onlyBuilder.buildAPI(this)); } -} -function isArrayOfStringsAndRegExps(arr) { - return _.every(arr, function(item) { - return _.isString(item) || _.isRegExp(item); - }); -} +}; -function createMatcher(matcher) { - return _.isRegExp(matcher)? matcher.test.bind(matcher) : _.isEqual.bind(null, matcher); +// Check if selector is not a string or not an object with "every" option. +function isNotValidSelector(selector) { + return !_.isString(selector) && !(_.isObject(selector) && _.isString(selector.every)); } diff --git a/lib/typedefs.js b/lib/typedefs.js deleted file mode 100644 index d80f39da3..000000000 --- a/lib/typedefs.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @typedef {Object} StateResult - * @property {String} stateName - * @property {String} suiteId - * @property {String} suitePath - * @property {String} suiteName - * @property {String} browserId - */ - -/** - * @typedef {StateResult} TestStateResult - * @property {Boolean} equal - * @property {Function} saveDiffTo - * @property {String} referencePath - * @property {String} currentPath - */ - -/** - * @typedef {StateResult} WarningStateResult - * @property {String} message - */ - -/** - * @typedef {StateResult} ErrorStateResult - * @property {String} [stack] - * @property {String} [message] - */ - -/** - * @typedef {Object} ViewModelResult - * @property {String} suites - * @property {Number} total - * @property {Number} passed - * @property {Number} failed - * @property {Number} skipped - * @property {Number} retries - */ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..403b48013 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,12363 @@ +{ + "name": "gemini", + "version": "7.5.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" + }, + "@types/normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "dev": true + }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "acorn": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz", + "integrity": "sha1-yM4n3grMdtiW0rH6099YjZ6C8BQ=" + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "^3.0.4" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "requires": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } + }, + "acorn-walk": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.0.0.tgz", + "integrity": "sha512-7Bv1We7ZGuU79zZbb6rRqcpxo3OY+zrdtloZWoyD8fmGX+FeXRjE+iuGkZjSXLVovLzrsvMGMy0EkwA0E0umxg==" + }, + "ajv": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", + "dev": true + }, + "aliasify": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/aliasify/-/aliasify-1.9.0.tgz", + "integrity": "sha1-A6oaX+W0ysYE47lnvEx86s+VcDA=", + "requires": { + "browserify-transform-tools": "~1.5.1" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "optional": true + }, + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", + "dev": true + }, + "app-module-path": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-1.1.0.tgz", + "integrity": "sha1-pqxTaEUPIJufW4bpo+Smq2/nUxw=", + "dev": true + }, + "archiver": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-2.1.1.tgz", + "integrity": "sha1-/2YrSnggFJSj7lRNOjP+dJZQnrw=", + "requires": { + "archiver-utils": "^1.3.0", + "async": "^2.0.0", + "buffer-crc32": "^0.2.1", + "glob": "^7.0.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0", + "tar-stream": "^1.5.0", + "zip-stream": "^1.2.0" + }, + "dependencies": { + "async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "requires": { + "lodash": "^4.17.11" + } + } + } + }, + "archiver-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", + "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", + "requires": { + "glob": "^7.0.0", + "graceful-fs": "^4.1.0", + "lazystream": "^1.0.0", + "lodash": "^4.8.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, + "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=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "babel-polyfill": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.20.0.tgz", + "integrity": "sha1-3ko3EAYTniCZCqwL42fTmDMSBOc=", + "dev": true, + "requires": { + "babel-runtime": "^6.20.0", + "core-js": "^2.4.0", + "regenerator-runtime": "^0.10.0" + } + }, + "babel-runtime": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", + "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.10.0" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" + }, + "bash-color": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/bash-color/-/bash-color-0.0.4.tgz", + "integrity": "sha1-6b6M4zVAytpIgXaMWb1jhlc26RM=", + "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=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "bluebird": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", + "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-pack": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", + "requires": { + "JSONStream": "^1.0.3", + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + } + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + } + } + }, + "browserify": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-13.3.0.tgz", + "integrity": "sha1-tanJAgJD8McORnW+yCI7xifkFc4=", + "requires": { + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^1.11.0", + "browserify-zlib": "~0.1.2", + "buffer": "^4.1.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.1", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "~1.1.0", + "duplexer2": "~0.1.2", + "events": "~1.1.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "~0.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "module-deps": "^4.0.8", + "os-browserify": "~0.1.1", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^2.0.0", + "string_decoder": "~0.10.0", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "~0.0.0", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "~0.0.1", + "xtend": "^4.0.0" + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-transform-tools": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/browserify-transform-tools/-/browserify-transform-tools-1.5.3.tgz", + "integrity": "sha1-UJycZS+2sHvw0h787rsdgm+AdUs=", + "requires": { + "falafel": "^1.0.1", + "through": "^2.3.7" + } + }, + "browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "requires": { + "pako": "~0.2.0" + } + }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + } + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "cached-path-relative": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz", + "integrity": "sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg==" + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dev": true, + "requires": { + "callsites": "^2.0.0" + }, + "dependencies": { + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + } + } + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "^0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + } + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chai": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "dev": true, + "requires": { + "assertion-error": "^1.0.1", + "deep-eql": "^0.1.3", + "type-detect": "^1.0.0" + } + }, + "chai-as-promised": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-5.3.0.tgz", + "integrity": "sha1-CdekApCKpw39vq1T5YU/x50+8hw=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "coa": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/coa/-/coa-1.0.4.tgz", + "integrity": "sha1-qe8VNmDWqGqL3sAomlxoTSF0Mv0=", + "requires": { + "q": "^1.1.2" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", + "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=" + }, + "color-diff": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/color-diff/-/color-diff-1.1.0.tgz", + "integrity": "sha1-mDrn+TZnnpTjZd/kShaqFTva6I4=" + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "requires": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + }, + "compare-func": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", + "integrity": "sha1-md0LpFfh+bxyKxLAjsM+6rMfpkg=", + "dev": true, + "requires": { + "array-ify": "^1.0.0", + "dot-prop": "^3.0.0" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "compress-commons": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.2.tgz", + "integrity": "sha1-UkqfEJA/OoEzibAiXSfEi7dRiQ8=", + "requires": { + "buffer-crc32": "^0.2.1", + "crc32-stream": "^2.0.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", + "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~2.0.0", + "typedarray": "~0.0.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + } + } + } + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=" + }, + "conventional-changelog": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.24.tgz", + "integrity": "sha512-2WcSUst4Y3Z4hHvoMTWXMJr/DmgVdLiMOVY1Kak2LfFz+GIz2KDp5naqbFesYbfXPmaZ5p491dO0FWZIJoJw1Q==", + "dev": true, + "requires": { + "conventional-changelog-angular": "^1.6.6", + "conventional-changelog-atom": "^0.2.8", + "conventional-changelog-codemirror": "^0.3.8", + "conventional-changelog-core": "^2.0.11", + "conventional-changelog-ember": "^0.3.12", + "conventional-changelog-eslint": "^1.0.9", + "conventional-changelog-express": "^0.3.6", + "conventional-changelog-jquery": "^0.1.0", + "conventional-changelog-jscs": "^0.1.0", + "conventional-changelog-jshint": "^0.3.8", + "conventional-changelog-preset-loader": "^1.1.8" + }, + "dependencies": { + "conventional-changelog-angular": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.6.6.tgz", + "integrity": "sha512-suQnFSqCxRwyBxY68pYTsFkG0taIdinHLNEAX5ivtw8bCRnIgnpvcHmlR/yjUyZIrNPYAoXlY1WiEKWgSE4BNg==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "q": "^1.5.1" + } + } + } + }, + "conventional-changelog-angular": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.3.0.tgz", + "integrity": "sha1-P2QYWXiqE6sJVMnkaniWn9WcaAE=", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "github-url-from-git": "^1.4.0", + "q": "^1.4.1" + } + }, + "conventional-changelog-atom": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-0.2.8.tgz", + "integrity": "sha512-8pPZqhMbrnltNBizjoDCb/Sz85KyUXNDQxuAEYAU5V/eHn0okMBVjqc8aHWYpHrytyZWvMGbayOlDv7i8kEf6g==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-codemirror": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.3.8.tgz", + "integrity": "sha512-3HFZKtBXTaUCHvz7ai6nk2+psRIkldDoNzCsom0egDtVmPsvvHZkzjynhdQyULfacRSsBTaiQ0ol6nBOL4dDiQ==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-core": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-2.0.11.tgz", + "integrity": "sha512-HvTE6RlqeEZ/NFPtQeFLsIDOLrGP3bXYr7lFLMhCVsbduF1MXIe8OODkwMFyo1i9ku9NWBwVnVn0jDmIFXjDRg==", + "dev": true, + "requires": { + "conventional-changelog-writer": "^3.0.9", + "conventional-commits-parser": "^2.1.7", + "dateformat": "^3.0.0", + "get-pkg-repo": "^1.0.0", + "git-raw-commits": "^1.3.6", + "git-remote-origin-url": "^2.0.0", + "git-semver-tags": "^1.3.6", + "lodash": "^4.2.1", + "normalize-package-data": "^2.3.5", + "q": "^1.5.1", + "read-pkg": "^1.1.0", + "read-pkg-up": "^1.0.1", + "through2": "^2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "conventional-commits-parser": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz", + "integrity": "sha512-BoMaddIEJ6B4QVMSDu9IkVImlGOSGA1I2BQyOZHeLQ6qVOJLcLKn97+fL6dGbzWEiqDzfH4OkcveULmeq2MHFQ==", + "dev": true, + "requires": { + "JSONStream": "^1.0.4", + "is-text-path": "^1.0.0", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0", + "trim-off-newlines": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "git-raw-commits": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.6.tgz", + "integrity": "sha512-svsK26tQ8vEKnMshTDatSIQSMDdz8CxIIqKsvPqbtV23Etmw6VNaFAitu8zwZ0VrOne7FztwPyRLxK7/DIUTQg==", + "dev": true, + "requires": { + "dargs": "^4.0.1", + "lodash.template": "^4.0.2", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0" + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + }, + "dependencies": { + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + } + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + } + } + }, + "conventional-changelog-ember": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.3.12.tgz", + "integrity": "sha512-mmJzA7uzbrOqeF89dMMi6z17O07ORTXlTMArnLG9ZTX4oLaKNolUlxFUFlFm9JUoVWajVpaHQWjxH1EOQ+ARoQ==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-eslint": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-1.0.9.tgz", + "integrity": "sha512-h87nfVh2fdk9fJIvz26wCBsbDC/KxqCc5wSlNMZbXcARtbgNbNDIF7Y7ctokFdnxkzVdaHsbINkh548T9eBA7Q==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-express": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-0.3.6.tgz", + "integrity": "sha512-3iWVtBJZ9RnRnZveNDzOD8QRn6g6vUif0qVTWWyi5nUIAbuN1FfPVyKdAlJJfp5Im+dE8Kiy/d2SpaX/0X678Q==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-jquery": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-jquery/-/conventional-changelog-jquery-0.1.0.tgz", + "integrity": "sha1-Agg5cWLjhGmG5xJztsecW1+A9RA=", + "dev": true, + "requires": { + "q": "^1.4.1" + } + }, + "conventional-changelog-jscs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-jscs/-/conventional-changelog-jscs-0.1.0.tgz", + "integrity": "sha1-BHnrRDzH1yxYvwvPDvHURKkvDlw=", + "dev": true, + "requires": { + "q": "^1.4.1" + } + }, + "conventional-changelog-jshint": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-0.3.8.tgz", + "integrity": "sha512-hn9QU4ZI/5V50wKPJNPGT4gEWgiBFpV6adieILW4MaUFynuDYOvQ71EMSj3EznJyKi/KzuXpc9dGmX8njZMjig==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "q": "^1.5.1" + } + }, + "conventional-changelog-lint": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-lint/-/conventional-changelog-lint-1.1.9.tgz", + "integrity": "sha1-h/8MKH8OJgCAOk6wSD4Uu4AzNhM=", + "dev": true, + "requires": { + "babel-polyfill": "6.20.0", + "babel-runtime": "6.23.0", + "chalk": "1.1.3", + "conventional-changelog-angular": "1.3.0", + "conventional-changelog-lint-config-angular": "0.4.1", + "conventional-commits-parser": "1.3.0", + "franc": "2.0.0", + "get-stdin": "5.0.1", + "git-raw-commits": "1.1.2", + "git-toplevel": "1.1.1", + "lodash": "4.17.4", + "meow": "3.7.0", + "mz": "2.6.0", + "pos": "0.4.2", + "rc": "1.1.7" + }, + "dependencies": { + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + } + } + }, + "conventional-changelog-lint-config-angular": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-lint-config-angular/-/conventional-changelog-lint-config-angular-0.4.1.tgz", + "integrity": "sha1-Dx0JCINjbKRfCDBM5y7gssYNn/o=", + "dev": true + }, + "conventional-changelog-preset-loader": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.8.tgz", + "integrity": "sha512-MkksM4G4YdrMlT2MbTsV2F6LXu/hZR0Tc/yenRrDIKRwBl/SP7ER4ZDlglqJsCzLJi4UonBc52Bkm5hzrOVCcw==", + "dev": true + }, + "conventional-changelog-writer": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-3.0.9.tgz", + "integrity": "sha512-n9KbsxlJxRQsUnK6wIBRnARacvNnN4C/nxnxCkH+B/R1JS2Fa+DiP1dU4I59mEDEjgnFaN2+9wr1P1s7GYB5/Q==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "conventional-commits-filter": "^1.1.6", + "dateformat": "^3.0.0", + "handlebars": "^4.0.2", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "semver": "^5.5.0", + "split": "^1.0.0", + "through2": "^2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + } + } + }, + "conventional-commits-filter": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.1.6.tgz", + "integrity": "sha512-KcDgtCRKJCQhyk6VLT7zR+ZOyCnerfemE/CsR3iQpzRRFbLEs0Y6rwk3mpDvtOh04X223z+1xyJ582Stfct/0Q==", + "dev": true, + "requires": { + "is-subset": "^0.1.1", + "modify-values": "^1.0.0" + } + }, + "conventional-commits-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-1.3.0.tgz", + "integrity": "sha1-4ye1MZThp61dxjR57pCZpSsCSGU=", + "dev": true, + "requires": { + "JSONStream": "^1.0.4", + "is-text-path": "^1.0.0", + "lodash": "^4.2.1", + "meow": "^3.3.0", + "split2": "^2.0.0", + "through2": "^2.0.0", + "trim-off-newlines": "^1.0.0" + } + }, + "conventional-recommended-bump": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-1.2.1.tgz", + "integrity": "sha512-oJjG6DkRgtnr/t/VrPdzmf4XZv8c4xKVJrVT4zrSHd92KEL+EYxSbYoKq8lQ7U5yLMw7130wrcQTLRjM/T+d4w==", + "dev": true, + "requires": { + "concat-stream": "^1.4.10", + "conventional-commits-filter": "^1.1.1", + "conventional-commits-parser": "^2.1.1", + "git-raw-commits": "^1.3.0", + "git-semver-tags": "^1.3.0", + "meow": "^3.3.0", + "object-assign": "^4.0.1" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "conventional-commits-parser": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz", + "integrity": "sha512-BoMaddIEJ6B4QVMSDu9IkVImlGOSGA1I2BQyOZHeLQ6qVOJLcLKn97+fL6dGbzWEiqDzfH4OkcveULmeq2MHFQ==", + "dev": true, + "requires": { + "JSONStream": "^1.0.4", + "is-text-path": "^1.0.0", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0", + "trim-off-newlines": "^1.0.0" + }, + "dependencies": { + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + } + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "git-raw-commits": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.6.tgz", + "integrity": "sha512-svsK26tQ8vEKnMshTDatSIQSMDdz8CxIIqKsvPqbtV23Etmw6VNaFAitu8zwZ0VrOne7FztwPyRLxK7/DIUTQg==", + "dev": true, + "requires": { + "dargs": "^4.0.1", + "lodash.template": "^4.0.2", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0" + }, + "dependencies": { + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + } + } + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + } + } + }, + "convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=" + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, + "core-js": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", + "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cosmiconfig": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "dev": true, + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.13.1", + "parse-json": "^4.0.0" + }, + "dependencies": { + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + } + } + }, + "coveralls": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.3.tgz", + "integrity": "sha512-iiAmn+l1XqRwNLXhW8Rs5qHZRFMYp9ZIPjEOVRpC/c4so6Y/f4/lFi0FfR5B9cCqgyhkJ5cZmbvcVRfP8MHchw==", + "dev": true, + "requires": { + "js-yaml": "3.6.1", + "lcov-parse": "0.0.10", + "log-driver": "1.2.5", + "minimist": "1.2.0", + "request": "2.79.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "js-yaml": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^2.6.0" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "dev": true + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "dev": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~2.0.6", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "qs": "~6.3.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1", + "uuid": "^3.0.0" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + } + } + }, + "crc": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", + "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "requires": { + "buffer": "^5.1.0" + }, + "dependencies": { + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + } + } + }, + "crc32-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-2.0.0.tgz", + "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", + "requires": { + "crc": "^3.4.4", + "readable-stream": "^2.0.0" + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "css": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", + "integrity": "sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==", + "requires": { + "inherits": "^2.0.3", + "source-map": "^0.6.1", + "source-map-resolve": "^0.5.2", + "urix": "^0.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "^0.10.9" + } + }, + "dargs": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-4.1.0.tgz", + "integrity": "sha1-A6nbtLXC8Tm/FK5T8LiipqhvThc=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "dash-ast": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", + "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "deep-eql": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "dev": true, + "requires": { + "type-detect": "0.1.1" + }, + "dependencies": { + "type-detect": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", + "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", + "dev": true + } + } + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "deps-sort": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz", + "integrity": "sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==", + "requires": { + "JSONStream": "^1.0.3", + "shasum-object": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + } + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detective": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", + "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "requires": { + "acorn": "^5.2.1", + "defined": "^1.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + } + } + }, + "diff": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz", + "integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "domain-browser": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", + "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=" + }, + "dot-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz", + "integrity": "sha1-G3CK8JSknJoOfbyteQq6U52sEXc=", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "dotgitignore": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dotgitignore/-/dotgitignore-1.0.3.tgz", + "integrity": "sha512-eu5XjSstm0WXQsARgo6kPjkINYZlOUW+z/KtAAIBjHa5mUpMPrxJytbPIndWz6GubBuuuH5ljtVcXKnVnH5q8w==", + "dev": true, + "requires": { + "find-up": "^2.1.0", + "minimatch": "^3.0.4" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + } + } + }, + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "requires": { + "readable-stream": "^2.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "elliptic": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz", + "integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emojify.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/emojify.js/-/emojify.js-1.1.0.tgz", + "integrity": "sha1-B5//IjMHyQB/VweF6OSTXVw5i+s=", + "dev": true + }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "requires": { + "iconv-lite": "~0.4.13" + } + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "requires": { + "once": "^1.4.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es5-ext": { + "version": "0.10.49", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz", + "integrity": "sha512-3NMEhi57E31qdzmYp2jwRArIUsj1HI/RxbQ4bgnSB+AIKIxsAmTiK83bYMifIcpWvEc3P1X30DhUKOqEtF/kvg==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "^1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-map": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-set": "~0.1.5", + "es6-symbol": "~3.1.1", + "event-emitter": "~0.3.5" + } + }, + "es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "dev": true + }, + "es6-set": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-symbol": "3.1.1", + "event-emitter": "~0.3.5" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "es6-weak-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.14", + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, + "requires": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" + }, + "dependencies": { + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true + }, + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "escope": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "dev": true, + "requires": { + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", + "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", + "dev": true, + "requires": { + "babel-code-frame": "^6.16.0", + "chalk": "^1.1.3", + "concat-stream": "^1.5.2", + "debug": "^2.1.1", + "doctrine": "^2.0.0", + "escope": "^3.6.0", + "espree": "^3.4.0", + "esquery": "^1.0.0", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "glob": "^7.0.3", + "globals": "^9.14.0", + "ignore": "^3.2.0", + "imurmurhash": "^0.1.4", + "inquirer": "^0.12.0", + "is-my-json-valid": "^2.10.0", + "is-resolvable": "^1.0.0", + "js-yaml": "^3.5.1", + "json-stable-stringify": "^1.0.0", + "levn": "^0.3.0", + "lodash": "^4.0.0", + "mkdirp": "^0.5.0", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.1", + "pluralize": "^1.2.1", + "progress": "^1.1.8", + "require-uncached": "^1.0.2", + "shelljs": "^0.7.5", + "strip-bom": "^3.0.0", + "strip-json-comments": "~2.0.1", + "table": "^3.7.8", + "text-table": "~0.2.0", + "user-home": "^2.0.0" + }, + "dependencies": { + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "eslint-config-gemini-testing": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-config-gemini-testing/-/eslint-config-gemini-testing-2.8.0.tgz", + "integrity": "sha512-zp9yStBk+Yplm0QpeyvgLPZA12wzDsWpvzi/YiN+GLSrt9ilq0NbNvFOp5KEFvnJNh57s8SioeIbv+jJX2BBQA==", + "dev": true + }, + "espree": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "dev": true, + "requires": { + "acorn": "^5.5.0", + "acorn-jsx": "^3.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "requires": { + "fill-range": "^2.1.0" + }, + "dependencies": { + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "extend": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-1.3.0.tgz", + "integrity": "sha1-0VFvsP9WJNLr+RI+odrFoZlABPg=" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "falafel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/falafel/-/falafel-1.2.0.tgz", + "integrity": "sha1-wY0k71CRF0pJfzGM0ksCaiXN2rQ=", + "requires": { + "acorn": "^1.0.3", + "foreach": "^2.0.5", + "isarray": "0.0.1", + "object-keys": "^1.0.6" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-glob": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.6.tgz", + "integrity": "sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + }, + "dependencies": { + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "^1.2.1", + "object-assign": "^4.0.1" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" + }, + "fill-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", + "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", + "dev": true, + "requires": { + "is-object": "~1.0.1", + "merge-descriptors": "~1.0.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "flat-cache": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", + "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", + "dev": true, + "requires": { + "circular-json": "^0.3.1", + "graceful-fs": "^4.1.2", + "rimraf": "~2.6.2", + "write": "^0.2.1" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "requires": { + "for-in": "^1.0.1" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "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==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "formatio": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", + "dev": true, + "requires": { + "samsam": "1.x" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, + "franc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/franc/-/franc-2.0.0.tgz", + "integrity": "sha1-2ZOe3tS0hqz0ufM1kf6OaeVGRhY=", + "dev": true, + "requires": { + "trigram-utils": "^0.1.0" + } + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "^1.0.0" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "gemini-configparser": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gemini-configparser/-/gemini-configparser-1.0.0.tgz", + "integrity": "sha1-lKjZTqTqESh9nEChnHSSFo7toCA=", + "requires": { + "lodash": "^4.17.4" + } + }, + "gemini-core": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/gemini-core/-/gemini-core-3.8.3.tgz", + "integrity": "sha512-8QqxGu6rJe7vBrIOkycxZvJA2/0GkmYTFP4k0L2HQLmYmkzXZ15FYOu5BPyghDY5Hh4Q9WTbNREY+Iz3WnfkmQ==", + "requires": { + "aliasify": "^1.9.0", + "bluebird": "^3.4.6", + "browserify": "^13.3.0", + "debug": "^2.2.0", + "gemini-configparser": "^1.0.0", + "glob-extra": "^4.0.1", + "lodash": "^4.15.0", + "looks-same": "^7.1.1", + "micromatch": "^4.0.2", + "png-img": "^2.1.1", + "sizzle": "^2.3.3", + "temp": "^0.8.3", + "uglify-js": "^2.8.29", + "uglifyify": "^3.0.4", + "yallist": "^3.0.3" + }, + "dependencies": { + "fast-glob": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + }, + "dependencies": { + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "glob-extra": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/glob-extra/-/glob-extra-4.0.2.tgz", + "integrity": "sha512-7lNZKnJY+a+AS2jMvoDW21t/K4H/vyDEczISyfGP5vn0BmlXVF0EoxepyFtGltzQIyznqyeZknDxQxJEidDnvg==", + "requires": { + "bluebird": "^3.5.1", + "fast-glob": "^2.2.7", + "glob": "^7.0.5", + "lodash": "^4.15.0", + "minimatch": "^3.0.4" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + } + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "gemini-coverage": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/gemini-coverage/-/gemini-coverage-2.0.0.tgz", + "integrity": "sha512-Bf5MdZ4KlnDS4Og+qLmxq82eebj67dpjJj6Nsg0IEevJaCVsaxMukpVqS2xBPv+5eq0X5JCIVr0EUEQpOtXavg==", + "requires": { + "bluebird": "^3.5.1", + "coa": "^1.0.1", + "fs-extra": "^5.0.0", + "handlebars": "~1.3.0" + }, + "dependencies": { + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "handlebars": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz", + "integrity": "sha1-npsTCpPjiUkTItl1zz7BgYw3zjQ=", + "requires": { + "optimist": "~0.3", + "uglify-js": "~2.3" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "source-map": { + "version": "0.1.43", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.3.6.tgz", + "integrity": "sha1-+gmEdwtCi3qbKoBY9GNV0U/vIRo=", + "optional": true, + "requires": { + "async": "~0.2.6", + "optimist": "~0.3.5", + "source-map": "~0.1.7" + } + } + } + }, + "generate-function": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "dev": true, + "requires": { + "is-property": "^1.0.2" + } + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "^1.0.0" + } + }, + "get-assigned-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", + "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==" + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-pkg-repo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", + "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "meow": "^3.3.0", + "normalize-package-data": "^2.3.0", + "parse-github-repo-url": "^1.3.0", + "through2": "^2.0.0" + } + }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "git-raw-commits": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.1.2.tgz", + "integrity": "sha1-oS2Ekq66KIGALXAIJe2ByfOeby8=", + "dev": true, + "requires": { + "dargs": "^4.0.1", + "lodash.template": "^4.0.2", + "meow": "^3.3.0", + "split2": "^2.0.0", + "through2": "^2.0.0" + } + }, + "git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", + "dev": true, + "requires": { + "gitconfiglocal": "^1.0.0", + "pify": "^2.3.0" + } + }, + "git-semver-tags": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.3.6.tgz", + "integrity": "sha512-2jHlJnln4D/ECk9FxGEBh3k44wgYdWjWDtMmJPaecjoRmxKo3Y1Lh8GMYuOPu04CHw86NTAODchYjC5pnpMQig==", + "dev": true, + "requires": { + "meow": "^4.0.0", + "semver": "^5.5.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + } + } + }, + "git-toplevel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/git-toplevel/-/git-toplevel-1.1.1.tgz", + "integrity": "sha1-04ecbKYSDIyxgMUoQglMDMnq2so=", + "dev": true, + "requires": { + "es6-promise": "^3.0.2", + "jq-trim": "^0.1.1" + } + }, + "gitbook-cli": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/gitbook-cli/-/gitbook-cli-2.3.2.tgz", + "integrity": "sha512-eyGtkY7jKHhmgpfuvgAP5fZcUob/FBz4Ld0aLRdEmiTrS1RklimN9epzPp75dd4MWpGhYvSbiwxnpyLiv1wh6A==", + "dev": true, + "requires": { + "bash-color": "0.0.4", + "commander": "2.11.0", + "fs-extra": "3.0.1", + "lodash": "4.17.4", + "npm": "5.1.0", + "npmi": "1.0.1", + "optimist": "0.6.1", + "q": "1.5.0", + "semver": "5.3.0", + "tmp": "0.0.31", + "user-home": "2.0.0" + }, + "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "fs-extra": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", + "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^3.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", + "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "q": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz", + "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=", + "dev": true + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + } + } + }, + "gitbook-plugin-advanced-emoji": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/gitbook-plugin-advanced-emoji/-/gitbook-plugin-advanced-emoji-0.2.2.tgz", + "integrity": "sha1-CLzGn2KnSc1pIEQ1J2UYyUHDGeM=", + "dev": true, + "requires": { + "emojify.js": "^1.1.0" + } + }, + "gitconfiglocal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", + "integrity": "sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=", + "dev": true, + "requires": { + "ini": "^1.3.2" + } + }, + "github-url-from-git": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.5.0.tgz", + "integrity": "sha1-+YX+3MCpqledyI16/waNVcxiUaA=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "glob-extra": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/glob-extra/-/glob-extra-4.0.0.tgz", + "integrity": "sha512-CKVVPD3+Yv2AmJDHjqSggz43C1xP1pAZ7df/qRS5+VHqfolaZ3bizNn5g3weP6bIvDPZoR11uxsbuvEBqxAnJQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "fast-glob": "^2.2.3", + "glob": "^7.0.5", + "lodash": "^4.15.0", + "minimatch": "^3.0.4" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=" + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "handlebars": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz", + "integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==", + "requires": { + "async": "^2.5.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + }, + "dependencies": { + "async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "requires": { + "lodash": "^4.17.11" + } + }, + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "optional": true + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "uglify-js": { + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "optional": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1" + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", + "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=" + }, + "husky": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-3.0.1.tgz", + "integrity": "sha512-PXBv+iGKw23GHUlgELRlVX9932feFL407/wHFwtsGeArp0dDM4u+/QusSQwPKxmNgjpSL+ustbOdQ2jetgAZbA==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "cosmiconfig": "^5.2.1", + "execa": "^1.0.0", + "get-stdin": "^7.0.0", + "is-ci": "^2.0.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.1.1", + "read-pkg": "^5.1.1", + "run-node": "^1.0.0", + "slash": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==" + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "dev": true, + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + }, + "dependencies": { + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dev": true, + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherit": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/inherit/-/inherit-2.2.7.tgz", + "integrity": "sha512-dxJmC1j0Q32NFAjvbd6g3lXYLZ49HgzotgbSMwMkoiTXGhC9412Oc24g7A7M9cPPkw/vDsF2cSII+2zJwocUtQ==" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "requires": { + "source-map": "~0.5.3" + } + }, + "inquirer": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "dev": true, + "requires": { + "ansi-escapes": "^1.1.0", + "ansi-regex": "^2.0.0", + "chalk": "^1.0.0", + "cli-cursor": "^1.0.1", + "cli-width": "^2.0.0", + "figures": "^1.3.5", + "lodash": "^4.3.0", + "readline2": "^1.0.1", + "run-async": "^0.1.0", + "rx-lite": "^3.1.2", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.0", + "through": "^2.3.6" + } + }, + "insert-module-globals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", + "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", + "requires": { + "JSONStream": "^1.0.3", + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + } + } + }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=" + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "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" + } + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", + "dev": true + }, + "is-my-json-valid": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", + "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", + "dev": true, + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "is-my-ip-valid": "^1.0.0", + "jsonpointer": "^4.0.0", + "xtend": "^4.0.0" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=" + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-subset": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", + "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", + "dev": true + }, + "is-text-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", + "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", + "dev": true, + "requires": { + "text-extensions": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "jade": { + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", + "integrity": "sha1-jxDXl32NefL2/4YqgbBRPMslaGw=", + "dev": true, + "requires": { + "commander": "0.6.1", + "mkdirp": "0.3.0" + }, + "dependencies": { + "commander": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", + "integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=", + "dev": true + }, + "mkdirp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", + "integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=", + "dev": true + } + } + }, + "jq-trim": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/jq-trim/-/jq-trim-0.1.2.tgz", + "integrity": "sha1-h9km2UTTm9S0mcuDfDV2qRC1hhg=", + "dev": true + }, + "js-graph-algorithms": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/js-graph-algorithms/-/js-graph-algorithms-1.0.18.tgz", + "integrity": "sha1-+W7Ie/GU9cCjE2X6Dh0Ht7li2JE=" + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz", + "integrity": "sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=" + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, + "labeled-stream-splicer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", + "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", + "requires": { + "inherits": "^2.0.1", + "stream-splicer": "^2.0.0" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" + }, + "lazystream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", + "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "requires": { + "readable-stream": "^2.0.5" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=" + }, + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", + "dev": true + }, + "lolex": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", + "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + }, + "looks-same": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/looks-same/-/looks-same-7.2.2.tgz", + "integrity": "sha512-I8WvkX68SMfjmKpRIhIQW8U4p4VyWCnkLeRl/tzMIgMjnF+6JeWZqwZgFuMH7djm4VoGTQlyFZY5GFvN88nugg==", + "requires": { + "color-diff": "^1.1.0", + "concat-stream": "^1.6.2", + "fs-extra": "^8.1.0", + "js-graph-algorithms": "1.0.18", + "lodash": "^4.17.3", + "nested-error-stacks": "^2.1.0", + "parse-color": "^1.0.0", + "pngjs": "^3.3.3" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + } + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==" + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "merge2": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==" + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime-db": { + "version": "1.38.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", + "integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==" + }, + "mime-types": { + "version": "2.1.22", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz", + "integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==", + "requires": { + "mime-db": "~1.38.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "mocha": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-2.5.3.tgz", + "integrity": "sha1-FhvlvetJZ3HrmzV0UFC2IrWu/Fg=", + "dev": true, + "requires": { + "commander": "2.3.0", + "debug": "2.2.0", + "diff": "1.4.0", + "escape-string-regexp": "1.0.2", + "glob": "3.2.11", + "growl": "1.9.2", + "jade": "0.26.3", + "mkdirp": "0.5.1", + "supports-color": "1.2.0", + "to-iso-string": "0.0.2" + }, + "dependencies": { + "commander": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", + "integrity": "sha1-/UMOiJgy7DU7ms0d4hfBHLPu+HM=", + "dev": true + }, + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "dev": true, + "requires": { + "ms": "0.7.1" + } + }, + "escape-string-regexp": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", + "integrity": "sha1-Tbwv5nTnGUnK8/smlc5/LcHZqNE=", + "dev": true + }, + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "dev": true, + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "dev": true + }, + "supports-color": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.2.0.tgz", + "integrity": "sha1-/x7R5hFp0Gs88tWI4YixjYhH4X4=", + "dev": true + } + } + }, + "modify-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true + }, + "module-deps": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", + "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", + "requires": { + "JSONStream": "^1.0.3", + "browser-resolve": "^1.7.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.0", + "defined": "^1.0.0", + "detective": "^4.0.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.3", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "module-not-found-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", + "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mute-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", + "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "dev": true + }, + "mz": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.6.0.tgz", + "integrity": "sha1-yLhSHZWN8KTydoAl22nHGe5O8c4=", + "dev": true, + "requires": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "n-gram": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/n-gram/-/n-gram-0.1.2.tgz", + "integrity": "sha1-ms7LD3l/v9IqCtiijZh4gKYwAqs=", + "dev": true + }, + "nan": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", + "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==" + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "native-promise-only": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", + "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nested-error-stacks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", + "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==" + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "requires": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm/-/npm-5.1.0.tgz", + "integrity": "sha512-pt5ClxEmY/dLpb60SmGQQBKi3nB6Ljx1FXmpoCUdAULlGqGVn2uCyXxPCWFbcuHGthT7qGiaGa1wOfs/UjGYMw==", + "dev": true, + "requires": { + "JSONStream": "~1.3.1", + "abbrev": "~1.1.0", + "ansi-regex": "~3.0.0", + "ansicolors": "~0.3.2", + "ansistyles": "~0.1.3", + "aproba": "~1.1.2", + "archy": "~1.0.0", + "bluebird": "~3.5.0", + "cacache": "~9.2.9", + "call-limit": "~1.1.0", + "chownr": "~1.0.1", + "cmd-shim": "~2.0.2", + "columnify": "~1.5.4", + "config-chain": "~1.1.11", + "debuglog": "*", + "detect-indent": "~5.0.0", + "dezalgo": "~1.0.3", + "editor": "~1.0.0", + "fs-vacuum": "~1.2.10", + "fs-write-stream-atomic": "~1.0.10", + "fstream": "~1.0.11", + "fstream-npm": "~1.2.1", + "glob": "~7.1.2", + "graceful-fs": "~4.1.11", + "has-unicode": "~2.0.1", + "hosted-git-info": "~2.5.0", + "iferr": "~0.1.5", + "imurmurhash": "*", + "inflight": "~1.0.6", + "inherits": "~2.0.3", + "ini": "~1.3.4", + "init-package-json": "~1.10.1", + "lazy-property": "~1.0.0", + "lockfile": "~1.0.3", + "lodash._baseindexof": "*", + "lodash._baseuniq": "~4.6.0", + "lodash._bindcallback": "*", + "lodash._cacheindexof": "*", + "lodash._createcache": "*", + "lodash._getnative": "*", + "lodash.clonedeep": "~4.5.0", + "lodash.restparam": "*", + "lodash.union": "~4.6.0", + "lodash.uniq": "~4.5.0", + "lodash.without": "~4.4.0", + "lru-cache": "~4.1.1", + "mississippi": "~1.3.0", + "mkdirp": "~0.5.1", + "move-concurrently": "~1.0.1", + "node-gyp": "~3.6.2", + "nopt": "~4.0.1", + "normalize-package-data": "~2.4.0", + "npm-cache-filename": "~1.0.2", + "npm-install-checks": "~3.0.0", + "npm-package-arg": "~5.1.2", + "npm-registry-client": "~8.4.0", + "npm-user-validate": "~1.0.0", + "npmlog": "~4.1.2", + "once": "~1.4.0", + "opener": "~1.4.3", + "osenv": "~0.1.4", + "pacote": "~2.7.38", + "path-is-inside": "~1.0.2", + "promise-inflight": "~1.0.1", + "read": "~1.0.7", + "read-cmd-shim": "~1.0.1", + "read-installed": "~4.0.3", + "read-package-json": "~2.0.9", + "read-package-tree": "~5.1.6", + "readable-stream": "~2.3.2", + "readdir-scoped-modules": "*", + "request": "~2.81.0", + "retry": "~0.10.1", + "rimraf": "~2.6.1", + "safe-buffer": "~5.1.1", + "semver": "~5.3.0", + "sha": "~2.0.1", + "slide": "~1.1.6", + "sorted-object": "~2.0.1", + "sorted-union-stream": "~2.1.3", + "ssri": "~4.1.6", + "strip-ansi": "~4.0.0", + "tar": "~2.2.1", + "text-table": "~0.2.0", + "uid-number": "0.0.6", + "umask": "~1.1.0", + "unique-filename": "~1.1.0", + "unpipe": "~1.0.0", + "update-notifier": "~2.2.0", + "uuid": "~3.1.0", + "validate-npm-package-license": "*", + "validate-npm-package-name": "~3.0.0", + "which": "~1.2.14", + "worker-farm": "~1.3.1", + "wrappy": "~1.0.2", + "write-file-atomic": "~2.1.0" + }, + "dependencies": { + "JSONStream": { + "version": "1.3.1", + "bundled": true, + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "dependencies": { + "jsonparse": { + "version": "1.3.1", + "bundled": true, + "dev": true + }, + "through": { + "version": "2.3.8", + "bundled": true, + "dev": true + } + } + }, + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "ansicolors": { + "version": "0.3.2", + "bundled": true, + "dev": true + }, + "ansistyles": { + "version": "0.1.3", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.2", + "bundled": true, + "dev": true + }, + "archy": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "bluebird": { + "version": "3.5.0", + "bundled": true, + "dev": true + }, + "cacache": { + "version": "9.2.9", + "bundled": true, + "dev": true, + "requires": { + "bluebird": "^3.5.0", + "chownr": "^1.0.1", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.1", + "mississippi": "^1.3.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.1", + "ssri": "^4.1.6", + "unique-filename": "^1.1.0", + "y18n": "^3.2.1" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + }, + "dependencies": { + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true, + "dev": true + } + } + }, + "y18n": { + "version": "3.2.1", + "bundled": true, + "dev": true + } + } + }, + "call-limit": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "cmd-shim": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "mkdirp": "~0.5.0" + } + }, + "columnify": { + "version": "1.5.4", + "bundled": true, + "dev": true, + "requires": { + "strip-ansi": "^3.0.0", + "wcwidth": "^1.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + }, + "wcwidth": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "defaults": "^1.0.3" + }, + "dependencies": { + "defaults": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + } + } + } + } + }, + "config-chain": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + }, + "dependencies": { + "proto-list": { + "version": "1.2.4", + "bundled": true, + "dev": true + } + } + }, + "debuglog": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "detect-indent": { + "version": "5.0.0", + "bundled": true, + "dev": true + }, + "dezalgo": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + }, + "dependencies": { + "asap": { + "version": "2.0.5", + "bundled": true, + "dev": true + } + } + }, + "editor": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fs-vacuum": { + "version": "1.2.10", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "path-is-inside": "^1.0.1", + "rimraf": "^2.5.2" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "fstream-npm": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "fstream-ignore": "^1.0.0", + "inherits": "2" + }, + "dependencies": { + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + } + } + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "bundled": true, + "dev": true + }, + "iferr": { + "version": "0.1.5", + "bundled": true, + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "bundled": true, + "dev": true + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true + }, + "init-package-json": { + "version": "1.10.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.1.1", + "npm-package-arg": "^4.0.0 || ^5.0.0", + "promzard": "^0.3.0", + "read": "~1.0.1", + "read-package-json": "1 || 2", + "semver": "2.x || 3.x || 4 || 5", + "validate-npm-package-license": "^3.0.1", + "validate-npm-package-name": "^3.0.0" + }, + "dependencies": { + "promzard": { + "version": "0.3.0", + "bundled": true, + "dev": true, + "requires": { + "read": "1" + } + } + } + }, + "lazy-property": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "lockfile": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "lodash._baseindexof": { + "version": "3.1.0", + "bundled": true, + "dev": true + }, + "lodash._baseuniq": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + }, + "dependencies": { + "lodash._createset": { + "version": "4.0.3", + "bundled": true, + "dev": true + }, + "lodash._root": { + "version": "3.0.1", + "bundled": true, + "dev": true + } + } + }, + "lodash._bindcallback": { + "version": "3.0.1", + "bundled": true, + "dev": true + }, + "lodash._cacheindexof": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "lodash._createcache": { + "version": "3.1.2", + "bundled": true, + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0" + } + }, + "lodash._getnative": { + "version": "3.9.1", + "bundled": true, + "dev": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "bundled": true, + "dev": true + }, + "lodash.restparam": { + "version": "3.6.1", + "bundled": true, + "dev": true + }, + "lodash.union": { + "version": "4.6.0", + "bundled": true, + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "bundled": true, + "dev": true + }, + "lodash.without": { + "version": "4.4.0", + "bundled": true, + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + }, + "dependencies": { + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true, + "dev": true + } + } + }, + "mississippi": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^1.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "typedarray": { + "version": "0.0.6", + "bundled": true, + "dev": true + } + } + }, + "duplexify": { + "version": "3.5.0", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "end-of-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "once": "~1.3.0" + }, + "dependencies": { + "once": { + "version": "1.3.3", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + } + } + }, + "stream-shift": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "end-of-stream": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "flush-write-stream": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" + } + }, + "from2": { + "version": "2.3.0", + "bundled": true, + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "parallel-transform": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "cyclist": "~0.2.2", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + }, + "dependencies": { + "cyclist": { + "version": "0.2.2", + "bundled": true, + "dev": true + } + } + }, + "pump": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "requires": { + "duplexify": "^3.1.2", + "inherits": "^2.0.1", + "pump": "^1.0.0" + } + }, + "stream-each": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "stream-shift": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "through2": { + "version": "2.0.3", + "bundled": true, + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + }, + "dependencies": { + "xtend": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + } + } + }, + "move-concurrently": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + }, + "dependencies": { + "copy-concurrently": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "run-queue": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + } + } + }, + "node-gyp": { + "version": "3.6.2", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "2", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "dev": true, + "requires": { + "abbrev": "1" + } + } + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "normalize-package-data": { + "version": "2.4.0", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "is-builtin-module": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "npm-cache-filename": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "npm-install-checks": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "semver": "^2.3.0 || 3.x || 4 || 5" + } + }, + "npm-package-arg": { + "version": "5.1.2", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.4.2", + "osenv": "^0.1.4", + "semver": "^5.1.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-registry-client": { + "version": "8.4.0", + "bundled": true, + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0", + "npmlog": "2 || ^3.1.0 || ^4.0.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3", + "ssri": "^4.1.2" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "typedarray": { + "version": "0.0.6", + "bundled": true, + "dev": true + } + } + } + } + }, + "npm-user-validate": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + }, + "dependencies": { + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "dependencies": { + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + }, + "dependencies": { + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^1.0.2" + } + } + } + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opener": { + "version": "1.4.3", + "bundled": true, + "dev": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + }, + "dependencies": { + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "pacote": { + "version": "2.7.38", + "bundled": true, + "dev": true, + "requires": { + "bluebird": "^3.5.0", + "cacache": "^9.2.9", + "glob": "^7.1.2", + "lru-cache": "^4.1.1", + "make-fetch-happen": "^2.4.13", + "minimatch": "^3.0.4", + "mississippi": "^1.2.0", + "normalize-package-data": "^2.4.0", + "npm-package-arg": "^5.1.2", + "npm-pick-manifest": "^1.0.4", + "osenv": "^0.1.4", + "promise-inflight": "^1.0.1", + "promise-retry": "^1.1.1", + "protoduck": "^4.0.0", + "safe-buffer": "^5.1.1", + "semver": "^5.3.0", + "ssri": "^4.1.6", + "tar-fs": "^1.15.3", + "tar-stream": "^1.5.4", + "unique-filename": "^1.1.0", + "which": "^1.2.12" + }, + "dependencies": { + "make-fetch-happen": { + "version": "2.4.13", + "bundled": true, + "dev": true, + "requires": { + "agentkeepalive": "^3.3.0", + "cacache": "^9.2.9", + "http-cache-semantics": "^3.7.3", + "http-proxy-agent": "^2.0.0", + "https-proxy-agent": "^2.0.0", + "lru-cache": "^4.1.1", + "mississippi": "^1.2.0", + "node-fetch-npm": "^2.0.1", + "promise-retry": "^1.1.1", + "socks-proxy-agent": "^3.0.0", + "ssri": "^4.1.6" + }, + "dependencies": { + "agentkeepalive": { + "version": "3.3.0", + "bundled": true, + "dev": true, + "requires": { + "humanize-ms": "^1.2.1" + }, + "dependencies": { + "humanize-ms": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "ms": "^2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "http-cache-semantics": { + "version": "3.7.3", + "bundled": true, + "dev": true + }, + "http-proxy-agent": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "agent-base": "4", + "debug": "2" + }, + "dependencies": { + "agent-base": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + }, + "dependencies": { + "es6-promisify": { + "version": "5.0.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + }, + "dependencies": { + "es6-promise": { + "version": "4.1.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "https-proxy-agent": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "agent-base": "^4.1.0", + "debug": "^2.4.1" + }, + "dependencies": { + "agent-base": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + }, + "dependencies": { + "es6-promisify": { + "version": "5.0.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + }, + "dependencies": { + "es6-promise": { + "version": "4.1.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "node-fetch-npm": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "encoding": "^0.1.11", + "json-parse-helpfulerror": "^1.0.3", + "safe-buffer": "^5.0.1" + }, + "dependencies": { + "encoding": { + "version": "0.1.12", + "bundled": true, + "dev": true, + "requires": { + "iconv-lite": "~0.4.13" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.18", + "bundled": true, + "dev": true + } + } + }, + "json-parse-helpfulerror": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "jju": "^1.1.0" + }, + "dependencies": { + "jju": { + "version": "1.3.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "socks-proxy-agent": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "agent-base": "^4.0.1", + "socks": "^1.1.10" + }, + "dependencies": { + "agent-base": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + }, + "dependencies": { + "es6-promisify": { + "version": "5.0.0", + "bundled": true, + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + }, + "dependencies": { + "es6-promise": { + "version": "4.1.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "socks": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "requires": { + "ip": "^1.1.4", + "smart-buffer": "^1.0.13" + }, + "dependencies": { + "ip": { + "version": "1.1.5", + "bundled": true, + "dev": true + }, + "smart-buffer": { + "version": "1.1.15", + "bundled": true, + "dev": true + } + } + } + } + } + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "npm-pick-manifest": { + "version": "1.0.4", + "bundled": true, + "dev": true, + "requires": { + "npm-package-arg": "^5.1.2", + "semver": "^5.3.0" + } + }, + "promise-retry": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "err-code": "^1.0.0", + "retry": "^0.10.0" + }, + "dependencies": { + "err-code": { + "version": "1.1.2", + "bundled": true, + "dev": true + } + } + }, + "protoduck": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "genfun": "^4.0.1" + }, + "dependencies": { + "genfun": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + }, + "tar-fs": { + "version": "1.15.3", + "bundled": true, + "dev": true, + "requires": { + "chownr": "^1.0.1", + "mkdirp": "^0.5.1", + "pump": "^1.0.0", + "tar-stream": "^1.1.2" + }, + "dependencies": { + "pump": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + }, + "dependencies": { + "end-of-stream": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.4.0" + } + } + } + } + } + }, + "tar-stream": { + "version": "1.5.4", + "bundled": true, + "dev": true, + "requires": { + "bl": "^1.0.0", + "end-of-stream": "^1.0.0", + "readable-stream": "^2.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "bl": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + } + }, + "end-of-stream": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "path-is-inside": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "read": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "mute-stream": "~0.0.4" + }, + "dependencies": { + "mute-stream": { + "version": "0.0.7", + "bundled": true, + "dev": true + } + } + }, + "read-cmd-shim": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2" + } + }, + "read-installed": { + "version": "4.0.3", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "graceful-fs": "^4.1.2", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + }, + "dependencies": { + "util-extend": { + "version": "1.0.3", + "bundled": true, + "dev": true + } + } + }, + "read-package-json": { + "version": "2.0.9", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "json-parse-helpfulerror": "^1.0.2", + "normalize-package-data": "^2.0.0" + }, + "dependencies": { + "json-parse-helpfulerror": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "jju": "^1.1.0" + }, + "dependencies": { + "jju": { + "version": "1.3.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "read-package-tree": { + "version": "5.1.6", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "once": "^1.3.0", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0" + } + }, + "readable-stream": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.0", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "readdir-scoped-modules": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "dev": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" + }, + "dependencies": { + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "dev": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + }, + "dependencies": { + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + }, + "dependencies": { + "asynckit": { + "version": "0.4.0", + "bundled": true, + "dev": true + } + } + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "dev": true, + "requires": { + "ajv": "^4.9.1", + "har-schema": "^1.0.5" + }, + "dependencies": { + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + }, + "dependencies": { + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "jsonify": "~0.0.0" + }, + "dependencies": { + "jsonify": { + "version": "0.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true + } + } + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + }, + "dependencies": { + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + } + } + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "dev": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "requires": { + "extsprintf": "1.0.2" + } + } + } + }, + "sshpk": { + "version": "1.13.1", + "bundled": true, + "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", + "tweetnacl": "~0.14.0" + }, + "dependencies": { + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "dev": true, + "optional": true + } + } + } + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "~1.27.0" + }, + "dependencies": { + "mime-db": { + "version": "1.27.0", + "bundled": true, + "dev": true + } + } + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "requires": { + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true + } + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + } + } + }, + "retry": { + "version": "0.10.1", + "bundled": true, + "dev": true + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true + }, + "sha": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "readable-stream": "^2.0.2" + } + }, + "slide": { + "version": "1.1.6", + "bundled": true, + "dev": true + }, + "sorted-object": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "sorted-union-stream": { + "version": "2.1.3", + "bundled": true, + "dev": true, + "requires": { + "from2": "^1.3.0", + "stream-iterate": "^1.1.0" + }, + "dependencies": { + "from2": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~1.1.10" + }, + "dependencies": { + "readable-stream": { + "version": "1.1.14", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + } + } + } + } + }, + "stream-iterate": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "stream-shift": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "ssri": { + "version": "4.1.6", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "bundled": true, + "dev": true + } + } + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + }, + "dependencies": { + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true + }, + "umask": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "unique-filename": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + }, + "dependencies": { + "unique-slug": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + } + } + }, + "unpipe": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "update-notifier": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "requires": { + "boxen": "^1.0.0", + "chalk": "^1.0.0", + "configstore": "^3.0.0", + "import-lazy": "^2.1.0", + "is-npm": "^1.0.0", + "latest-version": "^3.0.0", + "semver-diff": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "boxen": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-align": "^2.0.0", + "camelcase": "^4.0.0", + "chalk": "^1.1.1", + "cli-boxes": "^1.0.0", + "string-width": "^2.0.0", + "term-size": "^0.1.0", + "widest-line": "^1.0.0" + }, + "dependencies": { + "ansi-align": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^2.0.0" + } + }, + "camelcase": { + "version": "4.1.0", + "bundled": true, + "dev": true + }, + "cli-boxes": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "string-width": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "term-size": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "requires": { + "execa": "^0.4.0" + }, + "dependencies": { + "execa": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "requires": { + "cross-spawn-async": "^2.1.1", + "is-stream": "^1.1.0", + "npm-run-path": "^1.0.0", + "object-assign": "^4.0.1", + "path-key": "^1.0.0", + "strip-eof": "^1.0.0" + }, + "dependencies": { + "cross-spawn-async": { + "version": "2.2.5", + "bundled": true, + "dev": true, + "requires": { + "lru-cache": "^4.0.0", + "which": "^1.2.8" + } + }, + "is-stream": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "npm-run-path": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "path-key": "^1.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true + }, + "path-key": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "widest-line": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^1.0.1" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + }, + "dependencies": { + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + } + } + } + } + } + } + }, + "chalk": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "bundled": true, + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "configstore": { + "version": "3.1.0", + "bundled": true, + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "dot-prop": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "is-obj": "^1.0.0" + }, + "dependencies": { + "is-obj": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "make-dir": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "pify": "^2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "bundled": true, + "dev": true + } + } + }, + "unique-string": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "crypto-random-string": "^1.0.0" + }, + "dependencies": { + "crypto-random-string": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "import-lazy": { + "version": "2.1.0", + "bundled": true, + "dev": true + }, + "is-npm": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "latest-version": { + "version": "3.1.0", + "bundled": true, + "dev": true, + "requires": { + "package-json": "^4.0.0" + }, + "dependencies": { + "package-json": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "requires": { + "got": "^6.7.1", + "registry-auth-token": "^3.0.1", + "registry-url": "^3.0.3", + "semver": "^5.1.0" + }, + "dependencies": { + "got": { + "version": "6.7.1", + "bundled": true, + "dev": true, + "requires": { + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" + }, + "dependencies": { + "create-error-class": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "requires": { + "capture-stack-trace": "^1.0.0" + }, + "dependencies": { + "capture-stack-trace": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "duplexer3": { + "version": "0.1.4", + "bundled": true, + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "lowercase-keys": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "bundled": true, + "dev": true + }, + "unzip-response": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + }, + "dependencies": { + "prepend-http": { + "version": "1.0.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "registry-auth-token": { + "version": "3.3.1", + "bundled": true, + "dev": true, + "requires": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + }, + "dependencies": { + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "registry-url": { + "version": "3.1.0", + "bundled": true, + "dev": true, + "requires": { + "rc": "^1.0.1" + }, + "dependencies": { + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true + } + } + } + } + } + } + } + } + }, + "semver-diff": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "semver": "^5.0.3" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "bundled": true, + "dev": true + } + } + }, + "uuid": { + "version": "3.1.0", + "bundled": true, + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "spdx-correct": "~1.0.0", + "spdx-expression-parse": "~1.0.0" + }, + "dependencies": { + "spdx-correct": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-license-ids": "^1.0.2" + }, + "dependencies": { + "spdx-license-ids": { + "version": "1.2.2", + "bundled": true, + "dev": true + } + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "bundled": true, + "dev": true + } + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "builtins": "^1.0.3" + }, + "dependencies": { + "builtins": { + "version": "1.0.3", + "bundled": true, + "dev": true + } + } + }, + "which": { + "version": "1.2.14", + "bundled": true, + "dev": true, + "requires": { + "isexe": "^2.0.0" + }, + "dependencies": { + "isexe": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "worker-farm": { + "version": "1.3.1", + "bundled": true, + "dev": true, + "requires": { + "errno": ">=0.1.1 <0.2.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + }, + "dependencies": { + "errno": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "requires": { + "prr": "~0.0.0" + }, + "dependencies": { + "prr": { + "version": "0.0.0", + "bundled": true, + "dev": true + } + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "write-file-atomic": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + } + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npmi": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npmi/-/npmi-1.0.1.tgz", + "integrity": "sha1-FddpJzVHVF5oCdzwzhiu1IsCkOI=", + "dev": true, + "requires": { + "npm": "^2.1.12", + "semver": "^4.1.0" + }, + "dependencies": { + "npm": { + "version": "2.15.12", + "resolved": "https://registry.npmjs.org/npm/-/npm-2.15.12.tgz", + "integrity": "sha1-33w+1aJ3w/nUtdgZsFMR0QogCuY=", + "dev": true, + "requires": { + "abbrev": "~1.0.9", + "ansi": "~0.3.1", + "ansi-regex": "*", + "ansicolors": "~0.3.2", + "ansistyles": "~0.1.3", + "archy": "~1.0.0", + "async-some": "~1.0.2", + "block-stream": "0.0.9", + "char-spinner": "~1.0.1", + "chmodr": "~1.0.2", + "chownr": "~1.0.1", + "cmd-shim": "~2.0.2", + "columnify": "~1.5.4", + "config-chain": "~1.1.10", + "dezalgo": "~1.0.3", + "editor": "~1.0.0", + "fs-vacuum": "~1.2.9", + "fs-write-stream-atomic": "~1.0.8", + "fstream": "~1.0.10", + "fstream-npm": "~1.1.1", + "github-url-from-git": "~1.4.0", + "github-url-from-username-repo": "~1.0.2", + "glob": "~7.0.6", + "graceful-fs": "~4.1.6", + "hosted-git-info": "~2.1.5", + "imurmurhash": "*", + "inflight": "~1.0.4", + "inherits": "~2.0.3", + "ini": "~1.3.4", + "init-package-json": "~1.9.4", + "lockfile": "~1.0.1", + "lru-cache": "~4.0.1", + "minimatch": "~3.0.3", + "mkdirp": "~0.5.1", + "node-gyp": "~3.6.0", + "nopt": "~3.0.6", + "normalize-git-url": "~3.0.2", + "normalize-package-data": "~2.3.5", + "npm-cache-filename": "~1.0.2", + "npm-install-checks": "~1.0.7", + "npm-package-arg": "~4.1.0", + "npm-registry-client": "~7.2.1", + "npm-user-validate": "~0.1.5", + "npmlog": "~2.0.4", + "once": "~1.4.0", + "opener": "~1.4.1", + "osenv": "~0.1.3", + "path-is-inside": "~1.0.0", + "read": "~1.0.7", + "read-installed": "~4.0.3", + "read-package-json": "~2.0.4", + "readable-stream": "~2.1.5", + "realize-package-specifier": "~3.0.1", + "request": "~2.74.0", + "retry": "~0.10.0", + "rimraf": "~2.5.4", + "semver": "~5.1.0", + "sha": "~2.0.1", + "slide": "~1.1.6", + "sorted-object": "~2.0.0", + "spdx-license-ids": "~1.2.2", + "strip-ansi": "~3.0.1", + "tar": "~2.2.1", + "text-table": "~0.2.0", + "uid-number": "0.0.6", + "umask": "~1.1.0", + "validate-npm-package-license": "~3.0.1", + "validate-npm-package-name": "~2.2.2", + "which": "~1.2.11", + "wrappy": "~1.0.2", + "write-file-atomic": "~1.1.4" + }, + "dependencies": { + "abbrev": { + "version": "1.0.9", + "bundled": true, + "dev": true + }, + "ansi": { + "version": "0.3.1", + "bundled": true, + "dev": true + }, + "ansi-regex": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "ansicolors": { + "version": "0.3.2", + "bundled": true, + "dev": true + }, + "ansistyles": { + "version": "0.1.3", + "bundled": true, + "dev": true + }, + "archy": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "async-some": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "dezalgo": "^1.0.2" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, + "char-spinner": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "chmodr": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "cmd-shim": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "mkdirp": "~0.5.0" + } + }, + "columnify": { + "version": "1.5.4", + "bundled": true, + "dev": true, + "requires": { + "strip-ansi": "^3.0.0", + "wcwidth": "^1.0.0" + }, + "dependencies": { + "wcwidth": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "defaults": "^1.0.0" + }, + "dependencies": { + "defaults": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + } + } + } + } + }, + "config-chain": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + }, + "dependencies": { + "proto-list": { + "version": "1.2.4", + "bundled": true, + "dev": true + } + } + }, + "dezalgo": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + }, + "dependencies": { + "asap": { + "version": "2.0.3", + "bundled": true, + "dev": true + } + } + }, + "editor": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fs-vacuum": { + "version": "1.2.9", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "path-is-inside": "^1.0.1", + "rimraf": "^2.5.2" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.8", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + }, + "dependencies": { + "iferr": { + "version": "0.1.5", + "bundled": true, + "dev": true + } + } + }, + "fstream": { + "version": "1.0.10", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "fstream-npm": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "fstream-ignore": "^1.0.0", + "inherits": "2" + }, + "dependencies": { + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" + } + } + } + }, + "github-url-from-git": { + "version": "1.4.0", + "bundled": true, + "dev": true + }, + "github-url-from-username-repo": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "glob": { + "version": "7.0.6", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.1.6", + "bundled": true, + "dev": true + }, + "hosted-git-info": { + "version": "2.1.5", + "bundled": true, + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "bundled": true, + "dev": true + }, + "inflight": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true + }, + "init-package-json": { + "version": "1.9.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^6.0.0", + "npm-package-arg": "^4.0.0", + "promzard": "^0.3.0", + "read": "~1.0.1", + "read-package-json": "1 || 2", + "semver": "2.x || 3.x || 4 || 5", + "validate-npm-package-license": "^3.0.1", + "validate-npm-package-name": "^2.0.1" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "bundled": true, + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "promzard": { + "version": "0.3.0", + "bundled": true, + "dev": true, + "requires": { + "read": "1" + } + } + } + }, + "lockfile": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "lru-cache": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "^1.0.1", + "yallist": "^2.0.0" + }, + "dependencies": { + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "minimatch": { + "version": "3.0.3", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.6", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^0.4.1", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + } + } + }, + "node-gyp": { + "version": "3.6.0", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "2", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true + } + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-git-url": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "normalize-package-data": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "is-builtin-module": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "npm-cache-filename": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "npm-install-checks": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "npmlog": "0.1 || 1 || 2", + "semver": "^2.3.0 || 3.x || 4 || 5" + } + }, + "npm-package-arg": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "semver": "4 || 5" + } + }, + "npm-registry-client": { + "version": "7.2.1", + "bundled": true, + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0", + "npmlog": "~2.0.0 || ~3.1.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3" + }, + "dependencies": { + "concat-stream": { + "version": "1.5.2", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~2.0.0", + "typedarray": "~0.0.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "typedarray": { + "version": "0.0.6", + "bundled": true, + "dev": true + } + } + }, + "retry": { + "version": "0.10.0", + "bundled": true, + "dev": true + } + } + }, + "npm-user-validate": { + "version": "0.1.5", + "bundled": true, + "dev": true + }, + "npmlog": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "requires": { + "ansi": "~0.3.1", + "are-we-there-yet": "~1.1.2", + "gauge": "~1.2.5" + }, + "dependencies": { + "are-we-there-yet": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.0 || ^1.1.13" + }, + "dependencies": { + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "gauge": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + }, + "dependencies": { + "has-unicode": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "lodash._baseslice": { + "version": "4.0.0", + "bundled": true, + "dev": true + }, + "lodash._basetostring": { + "version": "4.12.0", + "bundled": true, + "dev": true + }, + "lodash.pad": { + "version": "4.4.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.padend": { + "version": "4.5.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.padstart": { + "version": "4.5.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.tostring": { + "version": "4.1.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opener": { + "version": "1.4.1", + "bundled": true, + "dev": true + }, + "osenv": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + }, + "dependencies": { + "os-homedir": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "os-tmpdir": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "path-is-inside": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "read": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "mute-stream": "~0.0.4" + }, + "dependencies": { + "mute-stream": { + "version": "0.0.5", + "bundled": true, + "dev": true + } + } + }, + "read-installed": { + "version": "4.0.3", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "graceful-fs": "^4.1.2", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + }, + "dependencies": { + "debuglog": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "readdir-scoped-modules": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "util-extend": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "read-package-json": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^6.0.0", + "graceful-fs": "^4.1.2", + "json-parse-helpfulerror": "^1.0.2", + "normalize-package-data": "^2.0.0" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "bundled": true, + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "json-parse-helpfulerror": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "jju": "^1.1.0" + }, + "dependencies": { + "jju": { + "version": "1.3.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "readable-stream": { + "version": "2.1.5", + "bundled": true, + "dev": true, + "requires": { + "buffer-shims": "^1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "realize-package-specifier": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "dezalgo": "^1.0.1", + "npm-package-arg": "^4.0.0" + } + }, + "request": { + "version": "2.74.0", + "bundled": true, + "dev": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "bl": "~1.1.2", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~1.0.0-rc4", + "har-validator": "~2.0.6", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "node-uuid": "~1.4.7", + "oauth-sign": "~0.8.1", + "qs": "~6.2.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1" + }, + "dependencies": { + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true + }, + "aws4": { + "version": "1.4.1", + "bundled": true, + "dev": true + }, + "bl": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "readable-stream": "~2.0.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + } + } + }, + "caseless": { + "version": "0.11.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + }, + "dependencies": { + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "extend": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true + }, + "form-data": { + "version": "1.0.0-rc4", + "bundled": true, + "dev": true, + "requires": { + "async": "^1.5.2", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.10" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "bundled": true, + "dev": true + } + } + }, + "har-validator": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "bundled": true, + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "commander": { + "version": "2.9.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + }, + "dependencies": { + "graceful-readlink": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "is-my-json-valid": { + "version": "2.13.1", + "bundled": true, + "dev": true, + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "jsonpointer": "2.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "generate-function": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "is-property": "^1.0.0" + }, + "dependencies": { + "is-property": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "jsonpointer": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "xtend": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + }, + "pinkie-promise": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "pinkie": "^2.0.0" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + }, + "dependencies": { + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + } + } + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "jsprim": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "extsprintf": "1.0.2", + "json-schema": "0.2.2", + "verror": "1.3.6" + }, + "dependencies": { + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "json-schema": { + "version": "0.2.2", + "bundled": true, + "dev": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "requires": { + "extsprintf": "1.0.2" + } + } + } + }, + "sshpk": { + "version": "1.9.2", + "bundled": true, + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jodid25519": "^1.0.0", + "jsbn": "~0.1.0", + "tweetnacl": "~0.13.0" + }, + "dependencies": { + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "dashdash": { + "version": "1.14.0", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "getpass": { + "version": "0.1.6", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "jsbn": { + "version": "0.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "tweetnacl": { + "version": "0.13.3", + "bundled": true, + "dev": true, + "optional": true + } + } + } + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.11", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "~1.23.0" + }, + "dependencies": { + "mime-db": { + "version": "1.23.0", + "bundled": true, + "dev": true + } + } + }, + "node-uuid": { + "version": "1.4.7", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true + }, + "qs": { + "version": "6.2.1", + "bundled": true, + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true + }, + "tough-cookie": { + "version": "2.3.1", + "bundled": true, + "dev": true + }, + "tunnel-agent": { + "version": "0.4.3", + "bundled": true, + "dev": true + } + } + }, + "retry": { + "version": "0.10.0", + "bundled": true, + "dev": true + }, + "rimraf": { + "version": "2.5.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "semver": { + "version": "5.1.0", + "bundled": true, + "dev": true + }, + "sha": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "process-nextick-args": "~1.0.0", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "slide": { + "version": "1.1.6", + "bundled": true, + "dev": true + }, + "sorted-object": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "bundled": true, + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "text-table": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true + }, + "umask": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "spdx-correct": "~1.0.0", + "spdx-expression-parse": "~1.0.0" + }, + "dependencies": { + "spdx-correct": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-license-ids": "^1.0.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-exceptions": "^1.0.4", + "spdx-license-ids": "^1.0.0" + }, + "dependencies": { + "spdx-exceptions": { + "version": "1.0.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "validate-npm-package-name": { + "version": "2.2.2", + "bundled": true, + "dev": true, + "requires": { + "builtins": "0.0.7" + }, + "dependencies": { + "builtins": { + "version": "0.0.7", + "bundled": true, + "dev": true + } + } + }, + "which": { + "version": "1.2.11", + "bundled": true, + "dev": true, + "requires": { + "isexe": "^1.1.1" + }, + "dependencies": { + "isexe": { + "version": "1.1.2", + "bundled": true, + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "write-file-atomic": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + } + } + }, + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + } + } + }, + "null-check": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", + "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "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==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, + "optimist": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=", + "requires": { + "wordwrap": "~0.0.2" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "os-browserify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.1.2.tgz", + "integrity": "sha1-ScoCk+CxlZCl9d4Qx/JlphfY/lQ=" + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=" + }, + "parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "requires": { + "path-platform": "~0.11.15" + } + }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-color": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", + "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", + "requires": { + "color-convert": "~0.5.0" + } + }, + "parse-github-repo-url": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", + "integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==" + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=" + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "picomatch": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz", + "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA==" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", + "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "please-upgrade-node": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz", + "integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "plugins-loader": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/plugins-loader/-/plugins-loader-1.1.0.tgz", + "integrity": "sha512-AVLb8tpRhQn3buabonz19+VMBc2CW1iLFuZzEiIqHqsCdBgE6PRZ/YtPyKtYv91Esp7WRFAH+ruUtRnkQwrxwA==", + "requires": { + "lodash": "^4.16.4" + } + }, + "pluralize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, + "png-img": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/png-img/-/png-img-2.2.0.tgz", + "integrity": "sha512-rdWIsOuM9NH8fZUUa098Y1GmPjysadTwTYOBNM6JeteBX5NShLtq/aBomfb48d/Q4bNe+H3g5FvH0UD+LiAN1g==", + "requires": { + "nan": "^2.0.4" + } + }, + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" + }, + "pos": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/pos/-/pos-0.4.2.tgz", + "integrity": "sha1-IOnHf77tzDVoI86mPHWFys6Tvio=", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, + "proxyquire": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.8.0.tgz", + "integrity": "sha1-AtUUpb7ZhvBMuyCTrxZ0FTX3ntw=", + "dev": true, + "requires": { + "fill-keys": "^1.0.2", + "module-not-found-error": "^1.0.0", + "resolve": "~1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, + "randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==" + } + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "rc": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.1.7.tgz", + "integrity": "sha1-xepWS7B6/5/TpbMukGwdOmWUD+o=", + "dev": true, + "requires": { + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "requires": { + "readable-stream": "^2.0.2" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "readline2": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", + "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "mute-stream": "0.0.5" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "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.0", + "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.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + } + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" + } + }, + "resolve": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-async": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "dev": true, + "requires": { + "once": "^1.3.0" + } + }, + "run-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", + "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", + "dev": true + }, + "rx-lite": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "samsam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shasum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", + "requires": { + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" + } + }, + "shasum-object": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz", + "integrity": "sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==", + "requires": { + "fast-safe-stringify": "^2.0.7" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", + "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==" + }, + "shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "sinon": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-2.4.1.tgz", + "integrity": "sha512-vFTrO9Wt0ECffDYIPSP/E5bBugt0UjcBQOfQUMh66xzkyPEnhl/vM2LRZi2ajuTdkH07sA6DzrM6KvdvGIH8xw==", + "dev": true, + "requires": { + "diff": "^3.1.0", + "formatio": "1.2.0", + "lolex": "^1.6.0", + "native-promise-only": "^0.8.1", + "path-to-regexp": "^1.7.0", + "samsam": "^1.1.3", + "text-encoding": "0.6.4", + "type-detect": "^4.0.0" + }, + "dependencies": { + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "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 + } + } + }, + "sizzle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha1-TrB4w3IxpWtS5Bk/cB5++JN+YGs=" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz", + "integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==", + "dev": true + }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "requires": { + "through": "2" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "dev": true, + "requires": { + "through2": "^2.0.2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "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" + } + }, + "standard-version": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/standard-version/-/standard-version-4.4.0.tgz", + "integrity": "sha512-jJ8FZhnmh9xJRQLnaXiGRLaAUNItIH29lOQZGpL5fd4+jUHto9Ij6SPCYN86h6ZNNXkYq2TYiIVVF7gVyC+pcQ==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "conventional-changelog": "^1.1.0", + "conventional-recommended-bump": "^1.0.0", + "dotgitignore": "^1.0.3", + "figures": "^1.5.0", + "fs-access": "^1.0.0", + "semver": "^5.1.0", + "yargs": "^8.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "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", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^7.0.0" + } + } + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "requires": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-splicer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", + "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "string-width": { + "version": "1.0.2", + "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", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + }, + "dependencies": { + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + } + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "striptags": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/striptags/-/striptags-2.1.1.tgz", + "integrity": "sha1-53G4sxk7l7vtOS3KWaeCedPIpqY=" + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "requires": { + "minimist": "^1.1.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "requires": { + "acorn-node": "^1.2.0" + } + }, + "table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dev": true, + "requires": { + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", + "slice-ansi": "0.0.4", + "string-width": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + } + }, + "temp": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.4.tgz", + "integrity": "sha512-s0ZZzd0BzYv5tLSptZooSjK8oj6C+c19p7Vqta9+6NPOf7r+fxq0cJe6/oN4LTC79sy5NY8ucOJNgwsKCSbfqg==", + "requires": { + "rimraf": "~2.6.2" + } + }, + "text-encoding": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, + "text-extensions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", + "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "thenify": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", + "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", + "dev": true, + "requires": { + "any-promise": "^1.0.0" + } + }, + "thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", + "dev": true, + "requires": { + "thenify": ">= 3.1.0 < 4" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "requires": { + "process": "~0.11.0" + } + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" + }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" + }, + "to-iso-string": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/to-iso-string/-/to-iso-string-0.0.2.tgz", + "integrity": "sha1-TcGeZk38y+Jb2NtQiwDG2hWCVdE=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trigram-utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/trigram-utils/-/trigram-utils-0.1.1.tgz", + "integrity": "sha1-ffigksmJf8Lgnawi9CPigyMXYuc=", + "dev": true, + "requires": { + "n-gram": "^0.1.0" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "trim-off-newlines": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz", + "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", + "dev": true + }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "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=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-detect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", + "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", + "dev": true + }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "optional": true + }, + "uglifyify": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/uglifyify/-/uglifyify-3.0.4.tgz", + "integrity": "sha1-SH4IClp3mIgOaOkN75sGaB+xO9I=", + "requires": { + "convert-source-map": "~1.1.0", + "extend": "^1.2.1", + "minimatch": "^3.0.2", + "through": "~2.3.4", + "uglify-js": "2.x.x" + } + }, + "umd": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==" + }, + "undeclared-identifiers": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", + "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", + "requires": { + "acorn-node": "^1.3.0", + "dash-ast": "^1.0.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + } + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, + "user-home": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0" + } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vargs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vargs/-/vargs-0.1.0.tgz", + "integrity": "sha1-a2GE2mUgzDIEzhtAfKwm2SYJ6/8=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "requires": { + "indexof": "0.0.1" + } + }, + "wd": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/wd/-/wd-1.11.1.tgz", + "integrity": "sha512-XNK6EbOrXF7cG8f3pbps6mb/+xPGZH2r1AL1zGJluGynA/Xt6ip1Tvqj2AkavyDFworreaGXoe+0AP/r7EX9pg==", + "requires": { + "archiver": "2.1.1", + "async": "2.0.1", + "lodash": "4.17.11", + "mkdirp": "^0.5.1", + "q": "1.4.1", + "request": "2.88.0", + "vargs": "0.1.0" + }, + "dependencies": { + "async": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.0.1.tgz", + "integrity": "sha1-twnMAoCpw28J9FNr6CPIOKkEniU=", + "requires": { + "lodash": "^4.8.0" + } + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=" + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=" + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" + }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, + "zip-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", + "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", + "requires": { + "archiver-utils": "^1.3.0", + "compress-commons": "^1.2.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0" + } + } + } +} diff --git a/package.json b/package.json index 5a5a9749f..439646526 100644 --- a/package.json +++ b/package.json @@ -1,68 +1,73 @@ { "name": "gemini", - "version": "4.4.1", + "version": "7.5.2", "description": "UI Screenshot testing utility", "engines": { - "node": ">= 4.0.0" + "node": ">= 8.0.0" }, "bin": { "gemini": "./bin/gemini" }, "main": "api.js", "dependencies": { - "aliasify": "^1.7.2", - "app-module-path": "^1.1.0", - "browserify": "^13.0.0", + "bluebird": "^3.4.6", "chalk": "^1.1.3", - "commander": "^2.8.1", + "commander": "^2.12.2", "css": "^2.1.0", "debug": "^2.2.0", - "gemini-configparser": "^0.1.1", - "gemini-coverage": "~0.3.0", + "fs-extra": "^0.30.0", + "gemini-configparser": "^1.0.0", + "gemini-core": "3.8.3", + "gemini-coverage": "^2.0.0", + "graceful-fs": "^4.1.11", "handlebars": "^4.0.5", "inherit": "~2.2.1", - "install": "^0.6.1", "js-yaml": "^3.2.5", - "lodash": "^3.10.1", - "looks-same": "^3.0.0", - "minimatch": "^3.0.0", + "lodash": "^4.15.0", + "micromatch": "^2.3.11", + "node-fetch": "^1.6.3", + "plugins-loader": "^1.1.0", "png-img": "^2.1.0", - "polyfill-service": "~1.4.0", - "q": "^1.1.2", - "q-debug-mode": "0.0.1", - "q-io": "~1.13.2", - "q-promise-utils": "^1.1.0", - "qemitter": "^1.0.0", "resolve": "^1.1.0", "sizzle": "^2.2.0", "source-map": "^0.5.3", - "temp": "~0.8.0", - "uglifyify": "^3.0.1", - "wd": "^0.4.0", + "striptags": "2.1.1", + "wd": "^1.6.2", "worker-farm": "^1.3.1" }, "devDependencies": { + "app-module-path": "^1.1.0", "chai": "^3.5.0", "chai-as-promised": "^5.2.0", + "conventional-changelog-lint": "^1.0.1", "coveralls": "^2.11.2", - "husky": "^0.11.4", - "istanbul": "^0.4.2", - "jscs": "^2.11.0", - "jshint": "^2.7.0", + "eslint": "^3.1.1", + "eslint-config-gemini-testing": "^2.0.0", + "gitbook-cli": "^2.3.0", + "gitbook-plugin-advanced-emoji": "^0.2.2", + "glob-extra": "^4.0.0", + "husky": "^3.0.1", + "istanbul": "^0.4.5", "mocha": "^2.1.0", "proxyquire": "^1.7.3", - "sinon": "^1.17.3", - "uglify-js": "2.6.4" + "q": "^1.5.1", + "sinon": "^2.2.0", + "standard-version": "^4.0.0" }, "scripts": { "test-unit": "istanbul test _mocha -- --recursive test/unit", - "prepublish": "uglifyjs ./lib/browser/client-scripts/gemini.calibrate.js -m > ./lib/browser/client-scripts/gemini.calibrate.min.js", + "postpublish": "npm run publish-site", "test-func": "istanbul test _mocha test/functional", "test-browser": "istanbul test _mocha test/browser", "test": "istanbul test _mocha -- --recursive test/unit test/functional test/browser", - "lint": "jshint . && jscs .", + "lint": "eslint .", + "release": "standard-version", "precommit": "npm run lint", - "preversion": "npm run lint && npm test" + "commitmsg": "conventional-changelog-lint -e", + "preversion": "npm run lint && npm test", + "prepare-site": "gitbook install", + "build-site": "npm run prepare-site && gitbook build", + "publish-site": "npm run build-site && cd _book && git init && git add -A && git commit -m 'Update site' && git push --force git@github.com:gemini-testing/gemini-testing.github.io.git master" }, "author": "Sergey Tatarintsev (https://github.com/SevInf)", "license": "MIT", diff --git a/test/.eslintrc.js b/test/.eslintrc.js new file mode 100644 index 000000000..40d5bd0a3 --- /dev/null +++ b/test/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: 'gemini-testing/tests' +}; diff --git a/test/assert-ext.js b/test/assert-ext.js new file mode 100644 index 000000000..942f14d8c --- /dev/null +++ b/test/assert-ext.js @@ -0,0 +1,4 @@ +global.assert.calledOnceWith = function() { + assert.calledOnce(arguments[0]); + assert.calledWith.apply(null, arguments); +}; diff --git a/test/browser/calibrator.test.js b/test/browser/calibrator.test.js index 7573e42fe..6335d844c 100644 --- a/test/browser/calibrator.test.js +++ b/test/browser/calibrator.test.js @@ -1,6 +1,7 @@ 'use strict'; -var eachSupportedBrowser = require('./util').eachSupportedBrowser, - Calibrator = require('lib/calibrator'); + +const {eachSupportedBrowser} = require('./util'); +const {Calibrator} = require('gemini-core'); describe('calibrator', function() { eachSupportedBrowser(function() { diff --git a/test/browser/client-bridge.test.js b/test/browser/client-bridge.test.js index 247ed982b..17c316129 100644 --- a/test/browser/client-bridge.test.js +++ b/test/browser/client-bridge.test.js @@ -1,12 +1,12 @@ 'use strict'; -var ClientBridge = require('lib/browser/client-bridge'), - eachSupportedBrowser = require('./util').eachSupportedBrowser, +const {clientBridge: {ClientBridge}} = require('gemini-core'); +const eachSupportedBrowser = require('./util').eachSupportedBrowser; - TEST_SCRIPT = 'window.__gemini = {}; window.__gemini.add2 = function(x) { return x + 2; }'; +const TEST_SCRIPT = 'window.__gemini = {}; window.__gemini.add2 = function(x) { return x + 2; }'; -describe('ClientBridge', function() { - eachSupportedBrowser(function() { +describe('ClientBridge', () => { + eachSupportedBrowser(() => { beforeEach(function() { this.bridge = new ClientBridge(this.browser, TEST_SCRIPT); return this.browser.initSession(); diff --git a/test/functional/data/image/calibrate-broken.png b/test/functional/data/image/calibrate-broken.png deleted file mode 100644 index 989da4028..000000000 Binary files a/test/functional/data/image/calibrate-broken.png and /dev/null differ diff --git a/test/functional/data/image/calibrate.png b/test/functional/data/image/calibrate.png deleted file mode 100644 index ef64d730e..000000000 Binary files a/test/functional/data/image/calibrate.png and /dev/null differ diff --git a/test/functional/util.js b/test/functional/util.js deleted file mode 100644 index eedcc2cf5..000000000 --- a/test/functional/util.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var fs = require('fs'), - path = require('path'), - temp = require('temp'), - Image = require('lib/image'); - -function imagePath(name) { - return path.join(__dirname, 'data', 'image', name); -} -exports.imagePath = imagePath; - -exports.withTempFile = function(func) { - var filePath = temp.path({suffix: '.png'}); - return func(filePath).fin(function() { - try { - fs.unlinkSync(filePath); - } catch (e) { - } - }); -}; - -exports.assertSameImages = function(refName, filePath) { - return assert.eventually.isTrue( - Image.compare(imagePath(refName), filePath), - 'expected image to be equal to ' + refName - ); -}; diff --git a/test/mocha.opts b/test/mocha.opts index af5edce62..6b0553d2b 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,2 +1,3 @@ --require ./test/setup --t 0 +--require ./test/assert-ext +-t 0 diff --git a/test/setup.js b/test/setup.js index d8b46f741..813b31136 100644 --- a/test/setup.js +++ b/test/setup.js @@ -1,6 +1,13 @@ 'use strict'; -var chai = require('chai'); +const chai = require('chai'); +const Promise = require('bluebird'); + +Promise.config({ + longStackTraces: true +}); + +Promise.promisifyAll(require('fs-extra')); global.sinon = require('sinon'); global.assert = chai.assert; diff --git a/test/unit/browser-config.test.js b/test/unit/browser-config.test.js index 7d212067e..ea5b7f6c4 100644 --- a/test/unit/browser-config.test.js +++ b/test/unit/browser-config.test.js @@ -14,16 +14,16 @@ describe('BrowserConfig', function() { assert.equal(url, 'http://example.com/path/sub/path'); }); - it('should ignore slash at the end of the root', function() { + it('should resolve url without slash at the end of the root', function() { var config = createConfig({rootUrl: 'http://example.com/path'}), url = config.getAbsoluteUrl('sub/path'); assert.equal(url, 'http://example.com/path/sub/path'); }); - it('should ignore slash at the begining of the passed relUrl', function() { + it('should resolve url with slash at the begining of the passed relUrl', function() { var config = createConfig({rootUrl: 'http://example.com/path/'}), url = config.getAbsoluteUrl('/sub/path'); - assert.equal(url, 'http://example.com/path/sub/path'); + assert.equal(url, 'http://example.com/sub/path'); }); }); diff --git a/test/unit/browser-pool.js b/test/unit/browser-pool.js new file mode 100644 index 000000000..d7eead6ae --- /dev/null +++ b/test/unit/browser-pool.js @@ -0,0 +1,178 @@ +'use strict'; + +const BrowserPool = require('lib/browser-pool'); +const BrowserFabric = require('lib/browser'); +const RunnerEvents = require('lib/constants/events'); +const {BrowserPool: CoreBrowserPool, Calibrator} = require('gemini-core'); +const AsyncEmitter = require('gemini-core').events.AsyncEmitter; +const _ = require('lodash'); +const Promise = require('bluebird'); + +describe('browser-pool', () => { + const sandbox = sinon.sandbox.create(); + + beforeEach(() => { + sandbox.stub(CoreBrowserPool, 'create'); + }); + + afterEach(() => sandbox.restore()); + + it('should create core browser pool', () => { + BrowserPool.create(); + + assert.calledOnce(CoreBrowserPool.create); + }); + + it('should set gemini log namespace', () => { + BrowserPool.create(); + + assert.calledWith(CoreBrowserPool.create, sinon.match.any, sinon.match({logNamespace: 'gemini'})); + }); + + describe('config', () => { + it('should pass config system section as is', () => { + const config = { + system: { + foo: 'bar' + } + }; + + BrowserPool.create(config); + + assert.calledWith(CoreBrowserPool.create, sinon.match.any, sinon.match({config})); + }); + + it('should pass config browser ids as is', () => { + const config = { + getBrowserIds: () => ['foo', 'bar'] + }; + + BrowserPool.create(config); + + const passedConfig = CoreBrowserPool.create.firstCall.args[1].config; + assert.deepEqual(passedConfig.getBrowserIds(), ['foo', 'bar']); + }); + + it('should adopt browser session options', () => { + const config = { + forBrowser: () => { + return { + sessionsPerBrowser: 100500, + suitesPerSession: 500100 + }; + } + }; + + BrowserPool.create(config); + + const passedConfig = CoreBrowserPool.create.firstCall.args[1].config; + assert.deepEqual(passedConfig.forBrowser(), { + parallelLimit: 100500, + sessionUseLimit: 500100 + }); + }); + }); + + describe('browser manager', () => { + const init_ = (opts) => { + opts = _.defaults(opts, { + config: {}, + emitter: {} + }); + BrowserPool.create(opts.config, opts.emitter); + return CoreBrowserPool.create.firstCall.args[0]; + }; + + it('should create browser on request', () => { + const config = { + forBrowser: sinon.stub().withArgs('bro').returns({foo: 'bar'}) + }; + + const bro = {baz: 'qux'}; + sandbox.stub(BrowserFabric, 'create').withArgs({foo: 'bar'}).returns(bro); + + const browserManager = init_({config}); + + const browser = browserManager.create('bro'); + + assert.equal(browser, bro); + }); + + it('should launch browser on start', () => { + const browserManager = init_(); + + const browser = {launch: sinon.stub()}; + browserManager.start(browser); + + assert.calledOnce(browser.launch); + assert.calledWith(browser.launch, sinon.match.instanceOf(Calibrator)); + }); + + it('should quit browser', () => { + const browserManager = init_(); + + const browser = {quit: sinon.stub()}; + browserManager.quit(browser); + + assert.calledOnce(browser.quit); + }); + + describe('events', () => { + it('should emit START_BROWSER on start', () => { + const emitter = new AsyncEmitter(); + const onBrowserStart = sinon.spy(); + emitter.on(RunnerEvents.START_BROWSER, onBrowserStart); + + const browserManager = init_({emitter}); + + const browser = {foo: 'bar'}; + browserManager.onStart(browser); + + assert.calledOnce(onBrowserStart); + assert.calledWith(onBrowserStart, browser); + }); + + it('should wait START_BROWSER handler', () => { + const emitter = new AsyncEmitter(); + const spy1 = sinon.spy(); + const spy2 = sinon.spy(); + + emitter.on(RunnerEvents.START_BROWSER, () => Promise.delay(10).then(spy1)); + + const browserManager = init_({emitter}); + + return browserManager.onStart() + .then(spy2) + .then(() => assert.callOrder(spy1, spy2)); + }); + + it('should emit STOP_BROWSER on quit', () => { + const emitter = new AsyncEmitter(); + const onBrowserQuit = sinon.spy(); + emitter.on(RunnerEvents.STOP_BROWSER, onBrowserQuit); + + const browserManager = init_({emitter}); + + const browser = {foo: 'bar'}; + browserManager.onQuit(browser); + + assert.calledOnce(onBrowserQuit); + assert.calledWith(onBrowserQuit, browser); + }); + + it('should wait STOP_BROWSER handler', () => { + const emitter = new AsyncEmitter(); + const spy1 = sinon.spy(); + const spy2 = sinon.spy(); + + emitter.on(RunnerEvents.STOP_BROWSER, () => Promise.delay(10).then(spy1)); + + const browserManager = init_({emitter}); + + return browserManager.onQuit() + .then(spy2) + .then(() => assert.callOrder(spy1, spy2)); + }); + }); + }); +}); diff --git a/test/unit/browser-pool/basic-pool.test.js b/test/unit/browser-pool/basic-pool.test.js deleted file mode 100644 index e706a4a42..000000000 --- a/test/unit/browser-pool/basic-pool.test.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const q = require('q'); -const Browser = require('lib/browser'); -const BasicPool = require('lib/browser-pool/basic-pool'); -const signalHandler = require('lib/signal-handler'); -const browserWithId = require('test/util').browserWithId; - -describe('UnlimitedPool', function() { - const sandbox = sinon.sandbox.create(); - const browserConfig = {id: 'id'}; - - let config; - let browser; - let pool; - let requestBrowser; - - beforeEach(() => { - config = { - forBrowser: sinon.stub().returns(browserConfig) - }; - browser = sandbox.stub(browserWithId('id')); - browser.launch.returns(q()); - browser.quit.returns(q()); - - sandbox.stub(Browser, 'create').returns(browser); - pool = new BasicPool(config); - requestBrowser = () => pool.getBrowser('id'); - }); - - afterEach(() => sandbox.restore()); - - it('should create new browser when requested', () => { - return requestBrowser() - .then(() => assert.calledWith(Browser.create, browserConfig)); - }); - - it('should launch a browser', () => { - return requestBrowser() - .then(() => assert.calledOnce(browser.launch)); - }); - - it('should finalize browser if failed to create it', () => { - const freeBrowser = sinon.spy(pool, 'freeBrowser'); - const assertCalled = () => assert.called(freeBrowser); - - browser.reset.returns(q.reject()); - - return requestBrowser() - .then(assertCalled, assertCalled); - }); - - it('should quit a browser when freed', () => { - return requestBrowser() - .then((browser) => pool.freeBrowser(browser)) - .then(() => assert.calledOnce(browser.quit)); - }); - - it('should quit a browser on exit signal', () => { - return requestBrowser() - .then(() => signalHandler.emit('exit')) - .then(() => assert.calledOnce(browser.quit)); - }); -}); diff --git a/test/unit/browser-pool/caching-pool.js b/test/unit/browser-pool/caching-pool.js deleted file mode 100644 index fb7b3251a..000000000 --- a/test/unit/browser-pool/caching-pool.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; -const q = require('q'); -const Pool = require('lib/browser-pool/caching-pool'); -const browserWithId = require('../../util').browserWithId; - -describe('CachingPool', () => { - const makeStubBrowser = (id) => { - const browser = sinon.stub(browserWithId(id)); - browser.launch.returns(q()); - browser.reset.returns(q()); - return browser; - }; - - beforeEach(() => { - this.underlyingPool = { - getBrowser: sinon.stub(), - freeBrowser: sinon.stub().returns(q()), - finalizeBrowsers: sinon.stub().returns(q()) - }; - - this.poolWithReuseLimits = (limits) => { - const config = { - getBrowserIds: sinon.stub().returns(Object.keys(limits)), - forBrowser: (id) => { - return { - id, - suitesPerSession: limits[id], - desiredCapabilities: {} - }; - } - }; - return new Pool(config, this.underlyingPool); - }; - - this.makePool = () => this.poolWithReuseLimits({id: Infinity}); - - this.sinon = sinon.sandbox.create(); - }); - - afterEach(() => this.sinon.restore()); - - it('should create new browser when requested first time', () => { - this.underlyingPool.getBrowser.returns(q(makeStubBrowser('id'))); - const pool = this.makePool(); - return pool.getBrowser('id') - .then(() => assert.calledWith(this.underlyingPool.getBrowser, 'id')); - }); - - it('should return same browser as returned by underlying pool', () => { - const browser = makeStubBrowser('id'); - this.underlyingPool.getBrowser.returns(q(browser)); - const pool = this.makePool(); - return assert.eventually.equal(pool.getBrowser('id'), browser); - }); - - it('should not reset the new browser', () => { - const browser = makeStubBrowser('id'); - this.underlyingPool.getBrowser.returns(q(browser)); - return this.makePool().getBrowser('id') - .then(() => assert.notCalled(browser.reset)); - }); - - it('should create and launch new browser if there is free browser with different id', () => { - this.underlyingPool.getBrowser - .withArgs('first').returns(q(makeStubBrowser('first'))) - .withArgs('second').returns(q(makeStubBrowser('second'))); - const pool = this.poolWithReuseLimits({ - first: 1, - second: 1 - }); - return pool.getBrowser('first') - .then((browser) => pool.freeBrowser(browser)) - .then(() => pool.getBrowser('second')) - .then(() => assert.calledWith(this.underlyingPool.getBrowser, 'second')); - }); - - it('should not quit browser when freed', () => { - const pool = this.makePool(); - this.underlyingPool.getBrowser.returns(q(makeStubBrowser('id'))); - - return pool.getBrowser('id') - .then((browser) => pool.freeBrowser(browser, {noMoreRequests: false})) - .then(() => assert.notCalled(this.underlyingPool.freeBrowser)); - }); - - it('should quit browser when there are no more requests', () => { - const pool = this.makePool(); - this.underlyingPool.getBrowser.returns(q(makeStubBrowser('id'))); - - return pool.getBrowser('id') - .then((browser) => pool.freeBrowser(browser, {noMoreRequests: true})) - .then(() => assert.calledOnce(this.underlyingPool.freeBrowser)); - }); - - describe('when there is free browser with same id', () => { - beforeEach(() => { - this.browser = makeStubBrowser('id'); - this.pool = this.makePool(); - return this.pool.freeBrowser(this.browser); - }); - - it('should not create second instance', () => { - return this.pool.getBrowser('id') - .then(() => assert.notCalled(this.underlyingPool.getBrowser)); - }); - - it('should reset the browser', () => { - return this.pool.getBrowser('id') - .then(() => assert.calledOnce(this.browser.reset)); - }); - - describe('when reset failed', () => { - it('should fail to get browser', () => { - this.browser.reset.returns(q.reject('some-error')); - return assert.isRejected(this.pool.getBrowser('id'), /some-error/); - }); - - it('should put browser back', () => { - this.browser.reset.returns(q.reject()); - - return this.pool.getBrowser('id') - .fail(() => { - assert.calledOnce(this.underlyingPool.freeBrowser); - assert.calledWith(this.underlyingPool.freeBrowser, this.browser); - }); - }); - - it('should keep original error if failed to put browser back', () => { - this.browser.reset.returns(q.reject('reset-error')); - this.underlyingPool.freeBrowser.returns(q.reject('free-error')); - - return assert.isRejected(this.pool.getBrowser('id'), /reset-error/); - }); - }); - }); - - describe('when there are multiple browsers with same id', () => { - beforeEach(() => { - this.firstBrowser = makeStubBrowser('id'); - this.secondBrowser = makeStubBrowser('id'); - this.pool = this.makePool(); - return q.all([ - this.pool.freeBrowser(this.firstBrowser), - this.pool.freeBrowser(this.secondBrowser) - ]); - }); - - it('should return last browser in cache on first getBrowser', () => { - return assert.becomes(this.pool.getBrowser('id'), this.secondBrowser); - }); - - it('should return first browser on second getBrowser', () => { - return this.pool.getBrowser('id') - .then(() => assert.becomes(this.pool.getBrowser('id'), this.firstBrowser)); - }); - - it('should launch new session when there are no free browsers left', () => { - return this.pool.getBrowser('id') - .then(() => this.pool.getBrowser('id')) - .then(() => this.pool.getBrowser('id')) - .then(() => assert.calledWith(this.underlyingPool.getBrowser, 'id')); - }); - }); - - describe('when there is reuse limit', () => { - beforeEach(() => { - this.launchAndFree = (pool, id) => { - return pool.getBrowser(id) - .then((browser) => pool.freeBrowser(browser)); - }; - }); - - it('should launch only one session within the reuse limit', () => { - this.underlyingPool.getBrowser.returns(q(makeStubBrowser('id'))); - const pool = this.poolWithReuseLimits({id: 2}); - return this.launchAndFree(pool, 'id') - .then(() => pool.getBrowser('id')) - .then(() => assert.calledOnce(this.underlyingPool.getBrowser)); - }); - - it('should launch next session when over reuse limit', () => { - this.underlyingPool.getBrowser - .onFirstCall().returns(q(makeStubBrowser('id'))) - .onSecondCall().returns(q(makeStubBrowser('id'))); - const pool = this.poolWithReuseLimits({id: 2}); - return this.launchAndFree(pool, 'id') - .then(() => this.launchAndFree(pool, 'id')) - .then(() => pool.getBrowser('id')) - .then(() => assert.calledTwice(this.underlyingPool.getBrowser)); - }); - - it('should get new session for each suite if reuse limit equal 1', () => { - this.underlyingPool.getBrowser - .onFirstCall().returns(q(makeStubBrowser('browserId'))) - .onSecondCall().returns(q(makeStubBrowser('browserId'))); - const pool = this.poolWithReuseLimits({browserId: 1}); - return this.launchAndFree(pool, 'browserId') - .then(() => pool.getBrowser('browserId')) - .then(() => assert.calledTwice(this.underlyingPool.getBrowser)); - }); - - it('should close old session when reached reuse limit', () => { - const browser = makeStubBrowser('id'); - this.underlyingPool.getBrowser.returns(q(browser)); - const pool = this.poolWithReuseLimits({id: 2}); - return this.launchAndFree(pool, 'id') - .then(() => this.launchAndFree(pool, 'id')) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser)); - }); - - it('should cache browser with different id even if the first one is over limit', () => { - this.underlyingPool.getBrowser - .withArgs('first').returns(q(makeStubBrowser('first'))); - - const createSecondBrowser = this.underlyingPool.getBrowser.withArgs('second'); - createSecondBrowser.returns(q(makeStubBrowser('second'))); - - const pool = this.poolWithReuseLimits({ - first: 2, - second: 2 - }); - return this.launchAndFree(pool, 'first') - .then(() => this.launchAndFree(pool, 'second')) - .then(() => this.launchAndFree(pool, 'first')) - .then(() => pool.getBrowser('second')) - .then(() => assert.calledOnce(createSecondBrowser)); - }); - }); -}); diff --git a/test/unit/browser-pool/index.test.js b/test/unit/browser-pool/index.test.js deleted file mode 100644 index 53f47c393..000000000 --- a/test/unit/browser-pool/index.test.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -const LimitedPool = require('lib/browser-pool/limited-pool'); -const PerBrowserLimitedPool = require('lib/browser-pool/per-browser-limited-pool'); -const pool = require('lib/browser-pool'); - -describe('browser-pool', () => { - function mkConfig(opts) { - return { - system: opts || {}, - forBrowser: sinon.stub().returns({id: 'id'}), - getBrowserIds: sinon.stub().returns(['id']) - }; - } - - it('should create pool according perBrowserLimit by default', () => { - const browserPool = pool.create(mkConfig()); - - assert.instanceOf(browserPool, PerBrowserLimitedPool); - }); - - it('should create pool according parallelLimit if that option exist', () => { - const browserPool = pool.create(mkConfig({ - parallelLimit: 10 - })); - - assert.instanceOf(browserPool, LimitedPool); - }); - - it('should ignore parallelLimit if it value is Infinity', () => { - const browserPool = pool.create(mkConfig({ - parallelLimit: Infinity - })); - - assert.instanceOf(browserPool, PerBrowserLimitedPool); - }); -}); diff --git a/test/unit/browser-pool/limited-pool.test.js b/test/unit/browser-pool/limited-pool.test.js deleted file mode 100644 index 2e4f4d441..000000000 --- a/test/unit/browser-pool/limited-pool.test.js +++ /dev/null @@ -1,252 +0,0 @@ -'use strict'; -var Browser = require('lib/browser'), - q = require('q'), - LimitedPool = require('lib/browser-pool/limited-pool'); - -describe('LimitedPool', function() { - beforeEach(function() { - this.underlyingPool = { - getBrowser: sinon.stub(), - freeBrowser: sinon.stub().returns(q()), - cancel: sinon.stub() - }; - - this.sinon = sinon.sandbox.create(); - - this.makePool = function(limit) { - return new LimitedPool(limit || 1, this.underlyingPool); - }; - - this.makeBrowser = function() { - var config = { - id: 'id', - desiredCapabilities: {browserName: 'id'} - }; - - return this.sinon.stub(Browser.create(config, 'id')); - }; - }); - - afterEach(function() { - this.sinon.restore(); - }); - - it('should request browser from underlying pool', function() { - var browser = this.makeBrowser(); - this.underlyingPool.getBrowser.returns(q(browser)); - var pool = this.makePool(); - return assert.eventually.equal(pool.getBrowser('id'), browser); - }); - - describe('should return browser to underlying pool', function() { - let browser; - let pool; - - beforeEach(function() { - browser = this.makeBrowser(); - pool = this.makePool(); - this.underlyingPool.getBrowser.returns(q(browser)); - }); - - it('when freed', function() { - return pool.freeBrowser(browser) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser)); - }); - - it('for release if there are no more requests', function() { - return pool.getBrowser('first') - .then(() => pool.freeBrowser(browser)) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser, {noMoreRequests: true})); - }); - - it('for caching if there is at least one pending request', function() { - return pool.getBrowser('first') - .then(() => { - pool.getBrowser('second'); - return pool.freeBrowser(browser); - }) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser, {noMoreRequests: false})); - }); - - it('for caching if there are pending requests', function() { - return pool.getBrowser('first') - .then(() => { - pool.getBrowser('second'); - pool.getBrowser('third'); - return pool.freeBrowser(browser); - }) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser, {noMoreRequests: false})); - }); - - it('taking into account number of failed browser requests', function() { - const browser = this.makeBrowser(); - const pool = this.makePool(2); - - this.underlyingPool.getBrowser - .withArgs('first').returns(q(browser)) - .withArgs('second').returns(q.reject()); - - return q.allSettled([ - pool.getBrowser('first'), - pool.getBrowser('second') - ]) - .then(() => pool.freeBrowser(browser)) - .then(() => assert.calledWith(this.underlyingPool.freeBrowser, browser, {noMoreRequests: true})); - }); - }); - - it('should launch next request from queue on fail to receive browser from underlying pool', function() { - var browser = this.makeBrowser(), - pool = this.makePool(); - - this.underlyingPool.getBrowser.onFirstCall().returns(q.reject()); - this.underlyingPool.getBrowser.onSecondCall().returns(browser); - - pool.getBrowser('id'); - - assert.eventually.equal(pool.getBrowser('id'), browser); - }); - - describe('limit', function() { - it('should launch all browser in limit', function() { - var _this = this; - this.underlyingPool.getBrowser - .withArgs('first').returns(q(this.makeBrowser())) - .withArgs('second').returns(q(this.makeBrowser())); - var pool = this.makePool(2); - return q.all([pool.getBrowser('first'), pool.getBrowser('second')]) - .then(function() { - assert.calledTwice(_this.underlyingPool.getBrowser); - assert.calledWith(_this.underlyingPool.getBrowser, 'first'); - assert.calledWith(_this.underlyingPool.getBrowser, 'second'); - }); - }); - - it('should not launch browsers out of limit', function() { - this.underlyingPool.getBrowser.returns(q(this.makeBrowser())); - var pool = this.makePool(1); - var result = pool.getBrowser('first') - .then(function() { - return pool.getBrowser('second').timeout(100, 'timeout'); - }); - return assert.isRejected(result, /timeout$/); - }); - - it('should launch next browsers after previous are released', function() { - var expectedBrowser = this.makeBrowser(), - pool = this.makePool(1); - - this.underlyingPool.getBrowser - .withArgs('first').returns(q(this.makeBrowser())) - .withArgs('second').returns(q(expectedBrowser)); - - var result = pool.getBrowser('first') - .then(function(browser) { - return pool.freeBrowser(browser); - }) - .then(function() { - return pool.getBrowser('second'); - }); - - return assert.eventually.equal(result, expectedBrowser); - }); - - it('should launch queued browser when previous are released', function() { - var expectedBrowser = this.makeBrowser(), - pool = this.makePool(1); - - this.underlyingPool.getBrowser - .withArgs('first').returns(q(this.makeBrowser())) - .withArgs('second').returns(q(expectedBrowser)); - - var result = pool.getBrowser('first') - .then(function(browser) { - var secondPromise = pool.getBrowser('second'); - return q.delay(100) - .then(function() { - return pool.freeBrowser(browser); - }) - .then(function() { - return secondPromise; - }); - }); - return assert.eventually.equal(result, expectedBrowser); - }); - - it('should launch next browsers if free failed', function() { - var expectedBrowser = this.makeBrowser(), - pool = this.makePool(1); - - this.underlyingPool.getBrowser - .withArgs('first').returns(q(this.makeBrowser())) - .withArgs('second').returns(q(expectedBrowser)); - - this.underlyingPool.freeBrowser.returns(q.reject('error')); - - var result = pool.getBrowser('first') - .then(function(browser) { - var secondPromise = pool.getBrowser('second'); - return q.delay(100) - .then(function() { - return pool.freeBrowser(browser); - }) - .fail(function() { - return secondPromise; - }); - }); - - return assert.eventually.equal(result, expectedBrowser); - }); - - it('should not wait for queued browser to start after release browser', function() { - const pool = this.makePool(1); - const afterFree = sinon.spy().named('afterFree'); - const afterSecondGet = sinon.spy().named('afterSecondGet'); - - this.underlyingPool.getBrowser - .withArgs('first').returns(q(this.makeBrowser())) - .withArgs('second').returns(q.resolve()); - - return pool.getBrowser('first') - .then((browser) => { - const freeFirstBrowser = q.delay(100) - .then(() => pool.freeBrowser(browser)) - .then(afterFree); - - const getSecondBrowser = pool.getBrowser('second') - .then(afterSecondGet); - - return q.all([getSecondBrowser, freeFirstBrowser]) - .then(() => assert.callOrder(afterFree, afterSecondGet)); - }); - }); - - it('should cancel queued browsers when cancel is called', function() { - var pool = this.makePool(1); - this.underlyingPool.getBrowser.returns(q(this.makeBrowser())); - return pool.getBrowser('id') - .then(function() { - var secondRequest = pool.getBrowser('id'); - pool.cancel(); - return assert.isRejected(secondRequest, LimitedPool.CancelledError); - }); - }); - - it('should reject the queued call when underlying pool rejects the request', function() { - var pool = this.makePool(1), - error = new Error('You shall not pass'); - this.underlyingPool.getBrowser - .onFirstCall().returns(q(this.makeBrowser())) - .onSecondCall().returns(q.reject(error)); - - return pool.getBrowser('id') - .then(function(browser) { - var secondRequest = pool.getBrowser('id'); - return pool.freeBrowser(browser) - .then(function() { - return assert.isRejected(secondRequest, error); - }); - }); - }); - }); -}); diff --git a/test/unit/browser-pool/per-browser-limited-pool.test.js b/test/unit/browser-pool/per-browser-limited-pool.test.js deleted file mode 100644 index 2a7cf2c5b..000000000 --- a/test/unit/browser-pool/per-browser-limited-pool.test.js +++ /dev/null @@ -1,125 +0,0 @@ -'use strict'; -var q = require('q'), - PerBrowserLimitedPool = require('lib/browser-pool/per-browser-limited-pool'), - browserWithId = require('../../util').makeBrowser; - -describe('PerBrowserLimitedPool', function() { - beforeEach(function() { - this.underlyingPool = { - getBrowser: sinon.stub(), - freeBrowser: sinon.stub().returns(q()) - }; - - this.poolWithLimits = function(limits) { - var config = { - getBrowserIds: sinon.stub().returns(Object.keys(limits)), - forBrowser: function(id) { - return { - id: id, - sessionsPerBrowser: limits[id], - desiredCapabilities: {} - }; - } - }; - return new PerBrowserLimitedPool(config, this.underlyingPool); - }; - }); - - it('should request browser from underlying pool', function() { - var browser = browserWithId('id'); - this.underlyingPool.getBrowser.returns(q(browser)); - var pool = this.poolWithLimits({id: 1}); - return assert.eventually.equal(pool.getBrowser('id'), browser); - }); - - it('should return browser to underlying pool when freed', function() { - var _this = this, - browser = browserWithId('id'), - pool = this.poolWithLimits({id: 1}); - return pool.freeBrowser(browser).then(function() { - assert.calledWith(_this.underlyingPool.freeBrowser, browser); - }); - }); - - describe('limit', function() { - it('should launch all browser in limit', function() { - var _this = this; - this.underlyingPool.getBrowser - .onFirstCall().returns(q(browserWithId('id'))) - .onSecondCall().returns(q(browserWithId('id'))); - var pool = this.poolWithLimits({id: 2}); - return pool.getBrowser('id') - .then(function() { - return pool.getBrowser('id'); - }) - .then(function() { - assert.calledTwice(_this.underlyingPool.getBrowser); - }); - }); - - it('should not launch browsers out of limit', function() { - this.underlyingPool.getBrowser.returns(q(browserWithId('id'))); - var pool = this.poolWithLimits({id: 1}), - result = pool.getBrowser('id') - .then(function() { - return pool.getBrowser('id').timeout(100, 'timeout'); - }); - return assert.isRejected(result, /timeout$/); - }); - - it('should allow to launch different browser when first is over limit', function() { - var expectedBrowser = browserWithId('second'); - this.underlyingPool.getBrowser - .withArgs('first').returns(q(browserWithId('first'))) - .withArgs('second').returns(q(expectedBrowser)); - - var pool = this.poolWithLimits({first: 1, second: 1}), - result = pool.getBrowser('first') - .then(function() { - return pool.getBrowser('second'); - }); - return assert.eventually.equal(result, expectedBrowser); - }); - - it('should launch next browsers after previous are released', function() { - var expectedBrowser = browserWithId('id'), - pool = this.poolWithLimits({id: 1}); - - this.underlyingPool.getBrowser - .onFirstCall().returns(q(browserWithId('id'))) - .onSecondCall().returns(q(expectedBrowser)); - - var result = pool.getBrowser('id') - .then(function(browser) { - return pool.freeBrowser(browser); - }) - .then(function() { - return pool.getBrowser('id'); - }); - - return assert.eventually.equal(result, expectedBrowser); - }); - - it('should launch queued browser when previous are released', function() { - var expectedBrowser = browserWithId('id'), - pool = this.poolWithLimits({id: 1}); - - this.underlyingPool.getBrowser - .onFirstCall().returns(q(browserWithId('id'))) - .onSecondCall().returns(q(expectedBrowser)); - - var result = pool.getBrowser('id') - .then(function(browser) { - var secondPromise = pool.getBrowser('id'); - return q.delay(100) - .then(function() { - return pool.freeBrowser(browser); - }) - .then(function() { - return secondPromise; - }); - }); - return assert.eventually.equal(result, expectedBrowser); - }); - }); -}); diff --git a/test/unit/browser/camera.js b/test/unit/browser/camera.js deleted file mode 100644 index cf225e657..000000000 --- a/test/unit/browser/camera.js +++ /dev/null @@ -1,234 +0,0 @@ -'use strict'; - -const q = require('q'); -const Camera = require('lib/browser/camera'); -const Image = require('lib/image'); -const util = require('lib/browser/util'); - -describe('browser/camera', function() { - var sandbox = sinon.sandbox.create(); - - beforeEach(function() { - sandbox.stub(Image, 'fromBase64'); - }); - - afterEach(function() { - sandbox.restore(); - }); - - function mkWdStub_() { - return { - takeScreenshot: sinon.stub().returns(q({})), - currentContext: sinon.stub().returns(q()), - context: sinon.stub().returns(q()), - on: sinon.stub() - }; - } - - describe('captureViewportImage', function() { - it('should take screenshot', function() { - var wd = mkWdStub_(), - camera = new Camera(wd); - - return camera.captureViewportImage() - .then(function() { - assert.calledOnce(wd.takeScreenshot); - }); - }); - - it('should not switch appium context', function() { - var wd = mkWdStub_(), - camera = new Camera(wd); - - return camera.captureViewportImage() - .then(function() { - assert.notCalled(wd.context); - }); - }); - - it('should not switch appium context if capture succeeds for the first, but fails for the second time', function() { - var wd = mkWdStub_(), - error = new Error('not today'); - - wd.takeScreenshot - .onSecondCall().returns(q.reject(error)); - - var camera = new Camera(wd), - result = camera.captureViewportImage() - .then(function() { - return camera.captureViewportImage(); - }); - - return assert.isRejected(result, error) - .then(function() { - assert.notCalled(wd.context); - }); - }); - - it('should try to switch appium context if taking screenshot fails', function() { - var wd = mkWdStub_(); - - wd.takeScreenshot - .onFirstCall().returns(q.reject(new Error('not today'))); - - var camera = new Camera(wd); - return camera.captureViewportImage() - .then(function() { - assert.calledWithExactly(wd.context, 'NATIVE_APP'); - }); - }); - - it('should try to take screenshot after switching context', function() { - var wd = mkWdStub_(); - - wd.takeScreenshot - .onFirstCall().returns(q.reject(new Error('not today'))); - - var camera = new Camera(wd); - return camera.captureViewportImage() - .then(function() { - assert.calledTwice(wd.takeScreenshot); - }); - }); - - it('should restore original context after taking screenshot', function() { - var wd = mkWdStub_(); - - wd.currentContext.returns(q('Original')); - wd.takeScreenshot - .onFirstCall().returns(q.reject(new Error('not today'))); - - var camera = new Camera(wd); - return camera.captureViewportImage() - .then(function() { - assert.calledWithExactly(wd.context, 'Original'); - }); - }); - - it('should fail with original error if switching context does not helps', function() { - var wd = mkWdStub_(), - originalError = new Error('Original'); - - wd.takeScreenshot - .onFirstCall().returns(q.reject(originalError)) - .onSecondCall().returns(q.reject(new Error('still does not work'))); - - var camera = new Camera(wd); - return assert.isRejected(camera.captureViewportImage(), originalError); - }); - - it('should not try to take screenshot without switching context if it failed first time', function() { - var wd = mkWdStub_(), - error = new Error('not today'); - - wd.takeScreenshot - .onFirstCall().returns(q.reject(error)) - .onThirdCall().returns(q.reject(error)); - - var camera = new Camera(wd); - return assert.isRejected(camera.captureViewportImage() - .then(function() { - return camera.captureViewportImage(); - })) - .then(function() { - assert.calledThrice(wd.takeScreenshot); - }); - }); - - describe('captureViewportImage() crop', () => { - let image, wd, camera; - - beforeEach(() => { - image = sinon.createStubInstance(Image); - wd = mkWdStub_(); - Image.fromBase64.returns(image); - }); - - describe('calibrate', () => { - beforeEach(() => { - image.getSize.returns({width: 100, height: 200}); - camera = new Camera(wd); - }); - - it('should crop according to calibration result', () => { - camera.calibrate({top: 6, left: 4}); - - return camera.captureViewportImage() - .then(() => { - assert.calledWith(image.crop, { - left: 4, - top: 6, - width: 100 - 4, - height: 200 - 6 - }); - }); - }); - - it('should not crop image if calibration was not set', () => { - return camera.captureViewportImage() - .then(() => { - assert.notCalled(image.crop); - }); - }); - }); - - describe('crop to viewport', () => { - const mkCamera_ = (browserOptions) => { - const screenshotMode = (browserOptions || {}).screenshotMode || 'auto'; - return new Camera(wd, screenshotMode); - }; - const page = { - viewport: { - top: 1, - left: 1, - width: 100, - height: 100 - } - }; - - it('should not crop image if page disposition was not set', () => { - return mkCamera_().captureViewportImage() - .then(() => { - assert.notCalled(image.crop); - }); - }); - - it('should crop fullPage image with viewport value if page disposition was set', () => { - sandbox.stub(util, 'isFullPage').returns(true); - - return mkCamera_().captureViewportImage(page) - .then(() => { - assert.calledWith(image.crop, page.viewport); - }); - }); - - it('should crop not fullPage image to the left and right', () => { - sandbox.stub(util, 'isFullPage').returns(false); - - return mkCamera_().captureViewportImage(page) - .then(() => { - assert.calledWith(image.crop, { - top: 0, left: 0, - width: page.viewport.width, - height: page.viewport.height - }); - }); - }); - - it('should crop image to the left and right if "viewport" mode was set in config', () => { - camera = mkCamera_({screenshotMode: 'viewport'}); - sandbox.stub(util, 'isFullPage').returns(true); - - return camera.captureViewportImage(page) - .then(() => { - assert.calledWith(image.crop, { - top: 0, left: 0, - width: page.viewport.width, - height: page.viewport.height - }); - }); - }); - }); - }); - }); -}); diff --git a/test/unit/browser/client-bridge/client-bridge-decorator.js b/test/unit/browser/client-bridge/client-bridge-decorator.js new file mode 100644 index 000000000..d3666db25 --- /dev/null +++ b/test/unit/browser/client-bridge/client-bridge-decorator.js @@ -0,0 +1,45 @@ +'use strict'; + +const ClientBridgeDecorator = require('lib/browser/client-bridge/client-bridge-decorator'); +const {errors: {ClientBridgeError}} = require('gemini-core'); +const StateError = require('lib/errors/state-error'); + +describe('ClientBridgeDecorator', () => { + const stubClientBridge_ = () => ({call: sinon.stub().resolves()}); + + it('should call the original "call" method', () => { + const clientBridge = stubClientBridge_(); + const clientBridgeDecorator = ClientBridgeDecorator.create(clientBridge); + + clientBridge.call.withArgs('foo', 'bar').resolves('baz qux'); + + return assert.becomes(clientBridgeDecorator.call('foo', 'bar'), 'baz qux'); + }); + + it('should wrap "ClientBridge" error into "State" error', () => { + const clientBridge = stubClientBridge_(); + const clientBridgeDecorator = ClientBridgeDecorator.create(clientBridge); + + clientBridge.call.rejects(new ClientBridgeError()); + + return assert.isRejected(clientBridgeDecorator.call(), StateError); + }); + + it('should pass "ClientBridge" error message into "State" error', () => { + const clientBridge = stubClientBridge_(); + const clientBridgeDecorator = ClientBridgeDecorator.create(clientBridge); + + clientBridge.call.rejects(new ClientBridgeError('foo bar')); + + return assert.isRejected(clientBridgeDecorator.call(), /foo bar/); + }); + + it('should passthrough not "ClientBridge" error message into "State" error', () => { + const clientBridge = stubClientBridge_(); + const clientBridgeDecorator = ClientBridgeDecorator.create(clientBridge); + + clientBridge.call.rejects(new Error()); + + return assert.isRejected(clientBridgeDecorator.call(), Error); + }); +}); diff --git a/test/unit/browser/client-bridge/index.js b/test/unit/browser/client-bridge/index.js new file mode 100644 index 000000000..6a1066f0c --- /dev/null +++ b/test/unit/browser/client-bridge/index.js @@ -0,0 +1,30 @@ +'use strict'; + +const {clientBridge: coreClientBridge} = require('gemini-core'); +const ClientBridge = require('lib/browser/client-bridge'); +const ClientBridgeDecorator = require('lib/browser/client-bridge/client-bridge-decorator'); + +describe('ClientBridge', () => { + const sandbox = sinon.sandbox.create(); + + beforeEach(() => { + sandbox.stub(coreClientBridge, 'build').resolves(); + sandbox.stub(ClientBridgeDecorator, 'create'); + }); + + afterEach(() => sandbox.restore()); + + describe('build', () => { + it('should build client bridge', () => { + return ClientBridge.build('foo bar', {foo: 'bar'}) + .then(() => assert.calledOnceWith(coreClientBridge.build, 'foo bar', {foo: 'bar'})); + }); + + it('should return client bridge decorator', () => { + coreClientBridge.build.resolves({foo: 'bar'}); + ClientBridgeDecorator.create.withArgs({foo: 'bar'}).returns({baz: 'qux'}); + + return assert.becomes(ClientBridge.build(), {baz: 'qux'}); + }); + }); +}); diff --git a/test/unit/browser/existing-browser.js b/test/unit/browser/existing-browser.js index 0d1ffd0c6..a1aa00699 100644 --- a/test/unit/browser/existing-browser.js +++ b/test/unit/browser/existing-browser.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const wd = require('wd'); -const q = require('q'); +const Promise = require('bluebird'); const ExistingBrowser = require('lib/browser/existing-browser'); @@ -23,8 +23,8 @@ describe('browser/existing-browser', () => { beforeEach(() => { wdRemote = { - configureHttp: sinon.stub().returns(q()), - attach: sinon.stub().returns(q()) + configureHttp: sinon.stub().returns(Promise.resolve()), + attach: sinon.stub().returns(Promise.resolve()) }; sandbox.stub(wd, 'promiseRemote'); diff --git a/test/unit/browser/new-browser.js b/test/unit/browser/new-browser.js index 92aa36585..507c7c059 100644 --- a/test/unit/browser/new-browser.js +++ b/test/unit/browser/new-browser.js @@ -1,428 +1,629 @@ 'use strict'; -var Calibrator = require('lib/calibrator'), - ClientBridge = require('lib/browser/client-bridge'), - Camera = require('lib/browser/camera'), - WdErrors = require('lib/constants/wd-errors'), - q = require('q'), - wd = require('wd'), - polyfillService = require('polyfill-service'), - makeBrowser = require('../../util').makeBrowser; - -describe('browser/new-browser', function() { - beforeEach(function() { - this.sinon = sinon.sandbox.create(); +const Promise = require('bluebird'); +const wdAgent = require('wd'); +const _ = require('lodash'); + +const ClientBridge = require('lib/browser/client-bridge'); +const {Calibrator, browser: {Camera}} = require('gemini-core'); +const WdErrors = require('lib/constants/wd-errors'); +const GeminiError = require('lib/errors/gemini-error'); + +const makeBrowser = require('../../util').makeBrowser; + +describe('browser/new-browser', () => { + const sandbox = sinon.sandbox.create(); + + let wd; + + beforeEach(() => { + wd = { + configureHttp: sinon.stub().returns(Promise.resolve()), + init: sinon.stub().returns(Promise.resolve([])), + get: sinon.stub().returns(Promise.resolve({})), + eval: sinon.stub().returns(Promise.resolve('')), + setWindowSize: sinon.stub().returns(Promise.resolve({})), + setOrientation: sinon.stub().returns(Promise.resolve({})), + maximize: sinon.stub().returns(Promise.resolve()), + windowHandle: sinon.stub().returns(Promise.resolve({})), + moveTo: sinon.stub().returns(Promise.resolve()), + elementByCssSelector: sinon.stub().returns(Promise.resolve()), + on: sinon.stub(), + currentContext: sinon.stub().returns(Promise.resolve()), + context: sinon.stub().returns(Promise.resolve()), + quit: sinon.stub().returns(Promise.resolve()), + takeScreenshot: sinon.stub().returns(Promise.resolve({})) + }; + + sandbox.stub(wdAgent, 'promiseRemote').returns(wd); }); - afterEach(function() { - this.sinon.restore(); - }); + afterEach(() => sandbox.restore()); + + describe('constructor', () => { + describe('takeScreenshot', () => { + const takeScreenshot = () => { + if (!Camera.create.lastCall) { + makeBrowser(); + } + + return Camera.create.lastCall.args[1](); + }; - describe('properties', function() { - it('should have browserName property', function() { - var browser = makeBrowser({ - browserName: 'name' + beforeEach(() => sandbox.spy(Camera, 'create')); + + it('should take screenshot', () => { + return takeScreenshot() + .then(() => assert.calledOnce(wd.takeScreenshot)); }); - assert.equal(browser.browserName, 'name'); - }); + it('should not switch context', () => { + return takeScreenshot() + .then(() => assert.notCalled(wd.context)); + }); + + it('should not switch context if capture succeeds for the first, but fails for the second time', () => { + const error = new Error('not today'); + + wd.takeScreenshot.onSecondCall().rejects(error); - it('should have version propery', function() { - var browser = makeBrowser({ - version: '1.0' + return assert.isRejected(takeScreenshot().then(() => takeScreenshot()), error) + .then(() => assert.notCalled(wd.context)); }); - assert.equal(browser.version, '1.0'); + it('should try to switch context if taking screenshot fails', () => { + wd.takeScreenshot.onFirstCall().rejects(new Error('not today')); + + return takeScreenshot() + .then(() => assert.calledWithExactly(wd.context, 'NATIVE_APP')); + }); + + it('should try to take screenshot after switching context', () => { + wd.takeScreenshot.onFirstCall().rejects(new Error('not today')); + + return takeScreenshot() + .then(() => assert.calledTwice(wd.takeScreenshot)); + }); + + it('should restore original context after taking screenshot', () => { + wd.currentContext.resolves('Original'); + wd.takeScreenshot.onFirstCall().rejects(new Error('not today')); + + return takeScreenshot() + .then(() => assert.calledWithExactly(wd.context, 'Original')); + }); + + it('should fail with original error if switching context does not helps', function() { + const originalError = new Error('Original'); + + wd.takeScreenshot + .onFirstCall().rejects(originalError) + .onSecondCall().rejects(new Error('still does not work')); + + return assert.isRejected(takeScreenshot(), originalError); + }); + + it('should not try to take screenshot without switching context if it failed first time', function() { + const error = new Error('not today'); + + wd.takeScreenshot + .onFirstCall().rejects(error) + .onThirdCall().rejects(error); + + return assert.isRejected(takeScreenshot().then(() => takeScreenshot())) + .then(() => assert.calledThrice(wd.takeScreenshot)); + }); }); }); - describe('launch', function() { - beforeEach(function() { - this.wd = { - configureHttp: sinon.stub().returns(q()), - init: sinon.stub().returns(q({})), - get: sinon.stub().returns(q({})), - eval: sinon.stub().returns(q('')), - setWindowSize: sinon.stub().returns(q({})), - maximize: sinon.stub().returns(q()), - windowHandle: sinon.stub().returns(q({})), - on: sinon.stub() - }; + describe('properties', () => { + it('should have browserName property', () => { + const browser = makeBrowser({browserName: 'name'}); - this.sinon.stub(wd, 'promiseRemote').returns(this.wd); - this.calibrator = sinon.createStubInstance(Calibrator); - this.browser = makeBrowser({ - browserName: 'browser', - version: '1.0' - }, {calibrate: false}); + assert.equal(browser.browserName, 'name'); + }); - this.launchBrowser = function() { - return this.browser.launch(this.calibrator); - }; + it('should have version propery', () => { + const browser = makeBrowser({version: '1.0'}); - this.sinon.stub(Camera.prototype); + assert.equal(browser.version, '1.0'); }); + }); - it('should init browser with browserName and version capabilites', function() { - var _this = this; - return this.browser.launch(this.calibrator).then(function() { - assert.calledWith(_this.wd.init, { - browserName: 'browser', - version: '1.0' + describe('should expose wd API', () => { + const testExposedWdMethod = (method) => { + wd[method] = sinon.stub().returns(Promise.resolve('awesome-res')); + + return makeBrowser()[method]('firstArg', 'secondArg') + .then((res) => { + assert.calledWith(wd[method], 'firstArg', 'secondArg'); + assert.equal(res, 'awesome-res'); }); + }; + + [ + 'sleep', 'waitForElementByCssSelector', 'waitForElementByCssSelector', 'waitFor', 'moveTo', + 'click', 'doubleclick', 'buttonDown', 'buttonUp', 'keys', 'type', 'tapElement', 'execute', + 'setWindowSize', 'getWindowSize', 'getOrientation', 'setOrientation' + ].forEach((method) => it(method, () => testExposedWdMethod(method))); + + describe('getOrientation', () => { + beforeEach(() => wd.getOrientation = sinon.stub()); + + it('should be applied in context `NATIVE_APP`', () => { + const context = wd.context.withArgs('NATIVE_APP').named('context'); + + return makeBrowser().getOrientation() + .then(() => assert.callOrder(context, wd.getOrientation)); }); - }); - it('should set http options for browser instance', function() { - var _this = this; - this.browser.config.httpTimeout = 100; - return this.browser.launch(this.calibrator).then(function() { - assert.calledWith(_this.wd.configureHttp, { - timeout: 100, - retries: 'never' - }); + it('should restore original context after applying', () => { + wd.currentContext.returns(Promise.resolve('ORIGINAL_CONTEXT')); + + const context = wd.context.withArgs('ORIGINAL_CONTEXT').named('context'); + + return makeBrowser().getOrientation() + .then(() => assert.callOrder(wd.getOrientation, context)); }); }); - describe('if config.calibrate=true', function() { - beforeEach(function() { - this.browser.config.calibrate = true; + describe('setOrientation', () => { + beforeEach(() => wd.setOrientation = sinon.stub()); + + it('should be applied in context `NATIVE_APP`', () => { + const context = wd.context.withArgs('NATIVE_APP').named('context'); + + return makeBrowser().setOrientation() + .then(() => assert.callOrder(context, wd.setOrientation)); }); - it('should calibrate', function() { - var _this = this; + it('should restore original context after applying', () => { + wd.currentContext.returns(Promise.resolve('ORIGINAL_CONTEXT')); - this.calibrator.calibrate.returns(q()); - return this.browser.launch(this.calibrator) - .then(function() { - assert.calledOnce(_this.calibrator.calibrate); - }); + const context = wd.context.withArgs('ORIGINAL_CONTEXT').named('context'); + + return makeBrowser().setOrientation() + .then(() => assert.callOrder(wd.setOrientation, context)); }); + }); + }); + + describe('launch', () => { + let calibrator; + let browser; + let launchBrowser; - it('should calibrate camera object', function() { - var calibration = {some: 'data'}; + beforeEach(() => { + calibrator = sinon.createStubInstance(Calibrator); - this.calibrator.calibrate.returns(q(calibration)); - return this.browser.launch(this.calibrator) - .then(function() { + browser = makeBrowser({browserName: 'browser', version: '1.0'}, {calibrate: false}); + + launchBrowser = () => browser.launch(calibrator); + + sandbox.stub(Camera.prototype, 'calibrate'); + }); + + it('should init browser with browserName and version capabilites', () => { + return browser.launch(calibrator) + .then(() => assert.calledWith(wd.init, {browserName: 'browser', version: '1.0'})); + }); + + it('should set http options for browser instance', () => { + browser.config.httpTimeout = 100; + + return browser.launch(calibrator) + .then(() => assert.calledWith(wd.configureHttp, {timeout: 100, retries: 'never'})); + }); + + describe('if config.calibrate=true', () => { + beforeEach(() => browser.config.calibrate = true); + + it('should calibrate', () => { + calibrator.calibrate.returns(Promise.resolve()); + + return browser.launch(calibrator) + .then(() => assert.calledOnce(calibrator.calibrate)); + }); + + it('should calibrate camera object', () => { + const calibration = {some: 'data'}; + + calibrator.calibrate.returns(Promise.resolve(calibration)); + + return browser.launch(calibrator) + .then(() => { assert.calledOnce(Camera.prototype.calibrate); assert.calledWith(Camera.prototype.calibrate, calibration); }); }); }); - describe('if config.calibrate=false', function() { - beforeEach(function() { - this.browser.config.calibrate = false; + describe('if config.calibrate=false', () => { + beforeEach(() => browser.config.calibrate = false); + + it('should not calibrate', () => { + return browser.launch(calibrator) + .then(() => assert.notCalled(calibrator.calibrate)); }); - it('should not calibrate', function() { - var _this = this; + it('should not calibrate camera object', () => { + return browser.launch(calibrator) + .then(() => assert.notCalled(Camera.prototype.calibrate)); + }); + }); - return this.browser.launch(this.calibrator) - .then(function() { - assert.notCalled(_this.calibrator.calibrate); - }); + it('should maximize window if launching phantomjs', () => { + browser = makeBrowser({browserName: 'phantomjs', version: '1.0'}, {calibrate: false}); + + return launchBrowser().then(() => assert.called(wd.maximize)); + }); + + describe('set default orientation', () => { + it('should set to value specified in config', () => { + browser.config.orientation = 'portrait'; + + return launchBrowser().then(() => assert.calledWith(wd.setOrientation, 'portrait')); }); - it('should not calibrate camera object', function() { - return this.browser.launch(this.calibrator) - .then(function() { - assert.notCalled(Camera.prototype.calibrate); - }); + it('should do nothing if no value is specified', () => { + delete browser.config.orientation; + + return launchBrowser().then(() => assert.notCalled(wd.setOrientation)); }); }); - it('should maximize window if launching phantomjs', function() { - var _this = this; + describe('with windowSize option', () => { + beforeEach(() => browser.config.windowSize = {width: 1024, height: 768}); - this.browser = makeBrowser({ - browserName: 'phantomjs', - version: '1.0' - }, {calibrate: false}); + it('should set window size', () => { + return launchBrowser().then(() => assert.calledWith(wd.setWindowSize, 1024, 768)); + }); - return this.launchBrowser().then(function() { - assert.called(_this.wd.maximize); + it('should not maximize window', () => { + return launchBrowser().then(() => assert.notCalled(wd.maximize)); + }); + + it('should not fail if not supported in legacy Opera', () => { + wd.setWindowSize.rejects({cause: {value: {message: 'Not supported in OperaDriver yet'}}}); + + return assert.isFulfilled(launchBrowser()); + }); + + it('should fail if setWindowSize fails with other error', () => { + wd.setWindowSize.rejects(new Error('other')); + + return assert.isRejected(launchBrowser()); }); }); - describe('with windowSize option', function() { - beforeEach(function() { - this.browser.config.windowSize = {width: 1024, height: 768}; + describe('catch error on wd init', () => { + it('should fail if wd init fails', () => { + wd.init.rejects(new Error('o.O')); + + return assert.isRejected(launchBrowser()); }); - it('should set window size', function() { - var _this = this; - return this.launchBrowser().then(function() { - assert.calledWith(_this.wd.setWindowSize, 1024, 768); - }); + it('should fail with GeminiError instance', () => { + wd.init.rejects({message: 'defaultError'}); + + return assert.isRejected(launchBrowser(), GeminiError); }); - it('should not maximize window', function() { - var _this = this; - return this.launchBrowser().then(function() { - assert.notCalled(_this.wd.maximize); - }); + it('should fail with the error message by default', () => { + wd.init.rejects({message: 'error text'}); + + return launchBrowser() + .catch((e) => assert.include(e.message, 'error text')); }); - it('should not fail if not supported in legacy Opera', function() { - this.wd.setWindowSize.returns(q.reject({ - cause: { - value: { - message: 'Not supported in OperaDriver yet' - } - } - })); - return assert.isFulfilled(this.launchBrowser()); + it('should extend error message with error data if it exists', () => { + wd.init.rejects({data: 'error text'}); + + return launchBrowser() + .catch((e) => assert.include(e.message, 'error text')); }); - it('should fail if setWindowSize fails with other error', function() { - this.wd.setWindowSize.returns(q.reject(new Error('other'))); - return assert.isRejected(this.launchBrowser()); + it('should not add to the message fail reason if error data does not exists', () => { + wd.init.rejects({message: 'defaultError'}); + + return launchBrowser() + .catch((e) => assert.notInclude(e.message, 'Reason')); + }); + + it('should cut all tags from error', () => { + wd.init.rejects({data: '

Error

text'}); + + return launchBrowser() + .catch((e) => { + assert.notInclude(e.message, ''); + assert.notInclude(e.message, '<body>'); + assert.notInclude(e.message, '<h1>'); + }); + }); + + it('should skip text from all tags except body', () => { + wd.init.rejects({data: '<title>4xxError'}); + + return launchBrowser() + .catch((e) => assert.notInclude(e.message, '4xx')); + }); + + it('should not skip text from internal tags in body tag', () => { + wd.init.rejects({data: '

Error

text'}); + + return launchBrowser() + .catch((e) => assert.include(e.message, 'Error text')); + }); + + it('should replace newlines to spaces', () => { + wd.init.rejects({data: 'Error\ntext'}); + + return launchBrowser() + .catch((e) => assert.include(e.message, 'Error text')); + }); + + it('should fail with full html if tag is empty', () => { + wd.init.rejects({data: ''}); + + return launchBrowser() + .catch((e) => assert.include(e.message, '')); }); }); }); - describe('URL opening', function() { - beforeEach(function() { - this.wd = { - configureHttp: sinon.stub().returns(q({})), - eval: sinon.stub().returns(q({})), - get: sinon.stub().returns(q({})), - init: sinon.stub().returns(q({})), - on: sinon.stub(), - setWindowSize: sinon.stub().returns(q({})) - }; + describe('URL opening', () => { + let browser, clientBridge; - this.sinon.stub(wd, 'promiseRemote').returns(this.wd); - this.sinon.stub(ClientBridge.prototype, 'call').returns(q({})); - this.sinon.stub(polyfillService, 'getPolyfillString').returns('function() {}'); + beforeEach(() => { + clientBridge = {call: sandbox.stub().resolves()}; + + sandbox.stub(ClientBridge, 'build').resolves(clientBridge); }); - describe('open', function() { - function open_(browser, params) { + describe('open', () => { + const open = (browser, params) => { params = params || {}; return browser.launch() - .then(function() { - return browser.open( - params.url || 'http://www.example.com', - {resetZoom: params.resetZoom} - ); - }); - } + .then(() => browser.open(params.url || 'http://www.example.com', {resetZoom: params.resetZoom})); + }; - beforeEach(function() { - this.browser = makeBrowser({browserName: 'browser', version: '1.0'}); + beforeEach(() => { + browser = makeBrowser({browserName: 'browser', version: '1.0'}); }); - it('should open URL', function() { - var _this = this; - - return open_(this.browser, {url: 'http://www.example.com'}) - .then(function() { - assert.calledWith(_this.wd.get, 'http://www.example.com'); - }); + it('should open URL', () => { + return open(browser, {url: 'http://www.example.com'}) + .then(() => assert.calledWith(wd.get, 'http://www.example.com')); }); - it('should reset page zoom by default', function() { - return open_(this.browser, {url: 'http://www.example.com'}) - .then(function() { - assert.calledWith(ClientBridge.prototype.call, 'resetZoom'); - }); + it('should not reset page zoom by default', () => { + return open(browser, {url: 'http://www.example.com'}) + .then(() => assert.neverCalledWith(clientBridge.call, 'resetZoom')); }); - it('should not reset page zoom if `resetZoom` param passed as false', function() { - return open_(this.browser, {url: 'http://www.example.com', resetZoom: false}) - .then(function() { - assert.neverCalledWith(ClientBridge.prototype.call, 'resetZoom'); - }); + it('should reset page zoom if `resetZoom` param passed as true', () => { + return open(browser, {url: 'http://www.example.com', resetZoom: true}) + .then(() => assert.calledWith(clientBridge.call, 'resetZoom')); }); }); - describe('openRelative', function() { - beforeEach(function() { - this.browser = makeBrowser({browserName: 'browser', version: '1.0'}, { + describe('openRelative', () => { + beforeEach(() => { + browser = makeBrowser({browserName: 'browser', version: '1.0'}, { getAbsoluteUrl: sinon.stub().withArgs('/relative').returns('http://example.com/relative') }); }); - it('should open relative URL using config', function() { - var _this = this; - return this.browser.launch() - .then(function() { - return _this.browser.openRelative('/relative'); - }) - .then(function() { - assert.calledWith(_this.wd.get, 'http://example.com/relative'); - }); + it('should open relative URL using config', () => { + return browser.launch() + .then(() => browser.openRelative('/relative')) + .then(() => assert.calledWith(wd.get, 'http://example.com/relative')); }); }); }); - describe('reset', function() { - beforeEach(function() { - this.wd = { - eval: sinon.stub().returns(q()), - moveTo: sinon.stub().returns(q()), - on: sinon.stub() - }; + describe('reset', () => { + let browser; - this.sinon.stub(wd, 'promiseRemote').returns(this.wd); + beforeEach(() => { + browser = makeBrowser({browserName: 'browser', version: '1.0'}); - this.browser = makeBrowser({browserName: 'browser', version: '1.0'}); - this.browser.chooseLocator(); + browser.chooseLocator(); }); - it('should reset mouse position', function() { - var _this = this, - elem = {}; - this.wd.eval.returns(q(elem)); - return this.browser.reset() - .then(function() { - assert.calledWith(_this.wd.moveTo, elem, 0, 0); - }); + it('should reset mouse position', () => { + const elem = {}; + + wd.eval.returns(Promise.resolve(elem)); + + return browser.reset().then(() => assert.calledWith(wd.moveTo, elem, 0, 0)); }); - it('should reject promise with browserId and sessionId if error happened', function() { - this.browser.sessionId = 'test_session_id'; - this.wd.eval.returns(q.reject()); + it('should reject promise with browserId and sessionId if error happened', () => { + browser.sessionId = 'test_session_id'; + wd.eval.rejects(); - return this.browser.reset() - .fail(function(e) { - assert.deepEqual(e, { - browserId: 'id', - sessionId: 'test_session_id' - }); - }); + return browser.reset() + .catch((e) => assert.deepEqual(e, {browserId: 'id', sessionId: 'test_session_id'})); }); }); - describe('captureViewportImage', function() { - beforeEach(function() { - this.sinon.stub(Camera.prototype); + describe('prepareScreenshot', () => { + let clientBridge; - this.wd = { - init: sinon.stub().returns(q({})), - configureHttp: sinon.stub().returns(q()), - eval: sinon.stub().returns(q('')), - on: sinon.stub() - }; + beforeEach(() => { + clientBridge = {call: sandbox.stub().resolves()}; - this.sinon.stub(wd, 'promiseRemote').returns(this.wd); + sandbox.stub(ClientBridge, 'build').resolves(clientBridge); + }); - this.browser = makeBrowser({browserName: 'browser', version: '1.0'}, { - calibrate: true + const launchBrowser_ = (opts) => { + opts = opts || {}; + const config = _.extend(opts.config, { + calibrate: Boolean(opts.calibrator) }); + const browser = makeBrowser({}, config); + + return browser.launch(opts.calibrator) + .then(() => browser); + }; + + it('should prepare screenshot on client', () => { + return launchBrowser_() + .then((browser) => browser.prepareScreenshot(['some-selector'], {some: 'opt'})) + .then(() => { + assert.calledOnce(clientBridge.call); + assert.calledWith(clientBridge.call, 'prepareScreenshot'); + + const selectors = clientBridge.call.firstCall.args[1][0]; + assert.deepEqual(selectors, ['some-selector']); + + const opts = clientBridge.call.firstCall.args[1][1]; + assert.match(opts, {some: 'opt'}); + }); }); - it('should delegate actual capturing to camera object', function() { - this.browser = makeBrowser({browserName: 'browser', version: '1.0'}, { - calibrate: false - }); + it('should use pixel ratio by default', () => { + return launchBrowser_() + .then((browser) => browser.prepareScreenshot()) + .then(() => { + const opts = clientBridge.call.firstCall.args[1][1]; + assert.match(opts, {usePixelRatio: true}); + }); + }); + + it('should use calibration pixel ratio if any', () => { + const calibrator = sinon.createStubInstance(Calibrator); + calibrator.calibrate.returns(Promise.resolve({usePixelRatio: false})); + + return launchBrowser_({calibrator}) + .then((browser) => browser.prepareScreenshot()) + .then(() => { + const opts = clientBridge.call.firstCall.args[1][1]; + assert.match(opts, {usePixelRatio: false}); + }); + }); - Camera.prototype.captureViewportImage.returns(q({some: 'image'})); + it('should enable coverage if it is enabled in config', () => { + const config = {system: {coverage: {enabled: true}}}; + + return launchBrowser_({config}) + .then((browser) => browser.prepareScreenshot()) + .then(() => { + const opts = clientBridge.call.firstCall.args[1][1]; + assert.match(opts, {coverage: true}); + }); + }); + }); + + describe('captureViewportImage', () => { + beforeEach(() => { + sandbox.stub(Camera.prototype, 'captureViewportImage'); + sandbox.stub(Promise, 'delay').returns(Promise.resolve()); + }); - return this.browser.launch() - .then(function() { - return this.browser.captureViewportImage(); - }.bind(this)) - .then(function(image) { + it('should delay capturing by the configured amount', () => { + const browser = makeBrowser({browserName: 'browser', version: '1.0'}, {calibrate: false, screenshotDelay: 42}); + + return browser.launch() + .then(() => browser.captureViewportImage()) + .then(() => { + assert.calledOnce(Promise.delay); + assert.calledWith(Promise.delay, 42); + assert.callOrder(Promise.delay, Camera.prototype.captureViewportImage); + }); + }); + + it('should delegate actual capturing to camera object', () => { + const browser = makeBrowser({browserName: 'browser', version: '1.0'}, {calibrate: false}); + + Camera.prototype.captureViewportImage.returns(Promise.resolve({some: 'image'})); + + return browser.launch() + .then(() => browser.captureViewportImage()) + .then((image) => { assert.calledOnce(Camera.prototype.captureViewportImage); assert.deepEqual(image, {some: 'image'}); }); }); }); - describe('buildScripts', function() { - it('should include coverage script when coverage is on', function() { - var browser = makeBrowser({browserName: 'browser', version: '1.0'}, { - system: { - coverage: { - enabled: true - } - } - }), - scripts = browser.buildScripts(); - return assert.eventually.include(scripts, 'exports.collectCoverage'); - }); - - it('should not include coverage script when coverage is off', function() { - var browser = makeBrowser({browserName: 'browser', version: '1.0'}, { - system: { - coverage: { - enabled: false - } - } - }), - scripts = browser.buildScripts(); - return assert.eventually.notInclude(scripts, 'exports.collectCoverage'); + describe('buildScripts', () => { + beforeEach(() => sandbox.stub(ClientBridge, 'build').resolves()); + + it('should build client scripts', () => { + const browser = makeBrowser({browserName: 'bro'}, {calibrate: true, system: {coverage: {enabled: true}}}); + const calibrator = sinon.createStubInstance(Calibrator); + + calibrator.calibrate.resolves({foo: 'bar'}); + + return browser.launch(calibrator) + .then(() => assert.calledOnceWith(ClientBridge.build, browser, {calibration: {foo: 'bar'}, coverage: true, supportDeprecated: true})); }); }); - describe('findElement', function() { - beforeEach(function() { - this.wd = { - configureHttp: sinon.stub().returns(q()), - init: sinon.stub().returns(q({})), - get: sinon.stub().returns(q({})), - eval: sinon.stub().returns(q('')), - elementByCssSelector: sinon.stub().returns(q()), - on: sinon.stub() - }; - this.sinon.stub(wd, 'promiseRemote').returns(this.wd); - this.browser = makeBrowser({browserName: 'bro'}, { - calibrate: true - }); + describe('findElement', () => { + let browser; + let calibrator; + + beforeEach(() => { + browser = makeBrowser({browserName: 'bro'}, {calibrate: true}); + calibrator = sinon.createStubInstance(Calibrator); }); - describe('when browser supports CSS3 selectors', function() { - beforeEach(function() { - var calibrator = sinon.createStubInstance(Calibrator); - calibrator.calibrate.returns(q({ - hasCSS3Selectors: true - })); - return this.browser.launch(calibrator); + describe('in modern browser', () => { + beforeEach(() => { + calibrator.calibrate.returns(Promise.resolve({needsCompatLib: false})); + + return browser.launch(calibrator); }); - it('should return what wd.elementByCssSelector returns', function() { - var element = {element: 'elem'}; - this.wd.elementByCssSelector.withArgs('.class').returns(q(element)); - return assert.eventually.equal(this.browser.findElement('.class'), element); + it('should return what wd.elementByCssSelector returns', () => { + const element = {element: 'elem'}; + + wd.elementByCssSelector.withArgs('.class').returns(Promise.resolve(element)); + + return assert.eventually.equal(browser.findElement('.class'), element); }); - it('should add a selector property if element is not found', function() { - var error = new Error('Element not found'); + it('should add a selector property if element is not found', () => { + const error = new Error('Element not found'); error.status = WdErrors.ELEMENT_NOT_FOUND; - this.wd.elementByCssSelector.returns(q.reject(error)); - return assert.isRejected(this.browser.findElement('.class')) - .then(function(error) { - assert.equal(error.selector, '.class'); - }); + wd.elementByCssSelector.rejects(error); + + return assert.isRejected(browser.findElement('.class')) + .then((error) => assert.equal(error.selector, '.class')); }); }); - describe('when browser does not support CSS3 selectors', function() { - beforeEach(function() { - this.sinon.stub(ClientBridge.prototype, 'call').returns(q({})); - var calibrator = sinon.createStubInstance(Calibrator); - calibrator.calibrate.returns(q({ - hasCSS3Selectors: false - })); - return this.browser.launch(calibrator); + describe('in legacy browser', () => { + let clientBridge; + + beforeEach(() => { + clientBridge = {call: sandbox.stub().resolves()}; + + sandbox.stub(ClientBridge, 'build').resolves(clientBridge); + + calibrator.calibrate.returns(Promise.resolve({needsCompatLib: true})); + + return browser.launch(calibrator); }); - it('should return what client method returns', function() { - var element = {element: 'elem'}; - ClientBridge.prototype.call.withArgs('query.first', ['.class']).returns(q(element)); - return assert.eventually.equal(this.browser.findElement('.class'), element); + it('should return what client method returns', () => { + const element = {element: 'elem'}; + + clientBridge.call.withArgs('queryFirst', ['.class']).resolves(element); + + return assert.eventually.equal(browser.findElement('.class'), element); }); - it('should reject with element not found error if client method returns null', function() { - ClientBridge.prototype.call.returns(q(null)); - return assert.isRejected(this.browser.findElement('.class')) - .then(function(error) { + it('should reject with element not found error if client method returns null', () => { + clientBridge.call.resolves(null); + + return assert.isRejected(browser.findElement('.class')) + .then((error) => { assert.equal(error.status, WdErrors.ELEMENT_NOT_FOUND); assert.equal(error.selector, '.class'); }); @@ -430,17 +631,17 @@ describe('browser/new-browser', function() { }); }); - describe('serialize', function() { - it('should add config with browser id, gridUrl and httpTimeout to object', function() { - var browser = makeBrowser({}, { - id: 'someBrowser', - gridUrl: 'http://grid.url', - httpTimeout: 100500, - screenshotMode: 'viewport', - some: 'otherProperty' - }); + describe('serialize', () => { + it('should add config with browser id, gridUrl and httpTimeout to object', () => { + const browser = makeBrowser({}, { + id: 'someBrowser', + gridUrl: 'http://grid.url', + httpTimeout: 100500, + screenshotMode: 'viewport', + some: 'otherProperty' + }); - var obj = browser.serialize(); + const obj = browser.serialize(); assert.deepEqual(obj.config, { id: 'someBrowser', @@ -450,31 +651,23 @@ describe('browser/new-browser', function() { }); }); - it('should add sessionId to object', function() { - var browser = makeBrowser(); + it('should add sessionId to object', () => { + const browser = makeBrowser(); browser.sessionId = 'some-session-id'; - var obj = browser.serialize(); + const obj = browser.serialize(); assert.property(obj, 'sessionId', 'some-session-id'); }); - it('should add calibration results to object', function() { - var wdRemote = { - configureHttp: sinon.stub().returns(q()), - init: sinon.stub().returns(q({})), - eval: sinon.stub().returns(q('')), - on: sinon.stub() - }; - this.sinon.stub(wd, 'promiseRemote').returns(wdRemote); - - var calibrator = sinon.createStubInstance(Calibrator); - calibrator.calibrate.returns(q({some: 'data'})); + it('should add calibration results to object', () => { + const calibrator = sinon.createStubInstance(Calibrator); + calibrator.calibrate.returns(Promise.resolve({some: 'data'})); - var browser = makeBrowser({}, {calibrate: true}); + const browser = makeBrowser({}, {calibrate: true}); return browser.launch(calibrator) - .then(function() { - var obj = browser.serialize(); + .then(() => { + const obj = browser.serialize(); assert.deepEqual(obj.calibration, {some: 'data'}); }); @@ -482,29 +675,17 @@ describe('browser/new-browser', function() { }); describe('initSession', () => { - let wdRemote; - const settingOfTimeout = (timeout) => - wdRemote.configureHttp.withArgs({retries: 'never', timeout}).named('configureHttp'); - - beforeEach(function() { - wdRemote = { - configureHttp: sinon.stub().returns(q()), - init: sinon.stub().returns(q([])), - on: sinon.stub() - }; - - this.sinon.stub(wd, 'promiseRemote').returns(wdRemote); - }); + wd.configureHttp.withArgs({retries: 'never', timeout}).named('configureHttp'); it('should init a browser session', () => { return makeBrowser({browserName: 'some-browser'}) .initSession() - .then(() => assert.calledWith(wdRemote.init, {browserName: 'some-browser'})); + .then(() => assert.calledWith(wd.init, {browserName: 'some-browser'})); }); it('should set session id after getting of a session', () => { - wdRemote.init.returns(q(['100500'])); + wd.init.returns(Promise.resolve(['100500'])); const browser = makeBrowser(); return browser.initSession() @@ -514,19 +695,75 @@ describe('browser/new-browser', function() { it('should set session request timeout before getting of a session', () => { return makeBrowser(null, {sessionRequestTimeout: 100500}) .initSession() - .then(() => assert.callOrder(settingOfTimeout(100500), wdRemote.init)); + .then(() => assert.callOrder(settingOfTimeout(100500), wd.init)); }); it('should use http timeout for getting of a session if request session timeout is not specified', () => { return makeBrowser(null, {httpTimeout: 100500, sessionRequestTimeout: null}) .initSession() - .then(() => assert.callOrder(settingOfTimeout(100500), wdRemote.init)); + .then(() => assert.callOrder(settingOfTimeout(100500), wd.init)); }); it('should set http timeout for all other requests after getting of a session', () => { return makeBrowser(null, {httpTimeout: 100500}) .initSession() - .then(() => assert.callOrder(wdRemote.init, settingOfTimeout(100500))); + .then(() => assert.callOrder(wd.init, settingOfTimeout(100500))); + }); + }); + + describe('quit', () => { + const settingOfTimeout = (timeout) => + wd.configureHttp.withArgs({retries: 'never', timeout}).named('configureHttp'); + + const mkBrowser_ = (config, sessionId) => { + const browser = makeBrowser(null, config); + browser.sessionId = sessionId; + + return browser; + }; + + it('should return empty promise if browser session id is not set', () => { + const browser = mkBrowser_(); + + sinon.spy(browser, 'quit'); + + return browser.quit() + .then(() => assert.eventually.isUndefined(browser.quit.getCall(0).returnValue)); + }); + + it('should not close browser session without session id', () => { + const browser = mkBrowser_(); + + return browser.quit() + .then(() => assert.notCalled(wd.quit)); + }); + + it('should close browser session with given session id', () => { + const browser = mkBrowser_(null, 'some-session-id'); + + return browser.quit() + .then(() => assert.called(wd.quit)); + }); + + it('should set session quit timeout before closing session', () => { + const browser = mkBrowser_({sessionQuitTimeout: 100500}, 'some-session-id'); + + return browser.quit() + .then(() => assert.callOrder(settingOfTimeout(100500), wd.quit)); + }); + + it('should fall back to "http timeout" value', () => { + const browser = mkBrowser_({httpTimeout: 100500, sessionQuitTimeout: null}, 'some-session-id'); + + return browser.quit() + .then(() => assert.callOrder(settingOfTimeout(100500), wd.quit)); + }); + + it('should set http timeout for all other requests after closing a session', () => { + const browser = mkBrowser_({httpTimeout: 100500}, 'some-session-id'); + + return browser.quit() + .then(() => assert.callOrder(wd.quit, settingOfTimeout(100500))); }); }); }); diff --git a/test/unit/browser/util.js b/test/unit/browser/util.js deleted file mode 100644 index d7554e6f7..000000000 --- a/test/unit/browser/util.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -const _ = require('lodash'); -const util = require('lib/browser/util'); -const Image = require('lib/image'); - -describe('browser util.isFullPage', () => { - const sandbox = sinon.sandbox.create(); - - afterEach(() => sandbox.restore()); - - const isFullPage_ = (image, browserOpts, page) => { - page = _.defaults(page || {}, { - documentWidth: 100, - documentHeight: 100, - pixelRatio: 1 - }); - - return util.isFullPage(image, page, browserOpts.screenshotMode); - }; - - const imageStub_ = (imageSize) => { - const imageStub = sinon.createStubInstance(Image); - imageStub.getSize.returns(imageSize); - return imageStub; - }; - - it('should return true for "fullpage" screenshotMode', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'fullpage'}); - - assert.isTrue(result); - }); - - it('should return false for "viewport" screenshotMode', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'viewport'}); - - assert.isFalse(result); - }); - - describe('"auto" screenshotMode', () => { - it('should return true if image size is bigger than document size', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'auto'}, { - documentWidth: 99, - documentHeight: 99 - }); - - assert.isTrue(result); - }); - - it('should return true if image size and document size are the same', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'auto'}, { - documentWidth: 100, - documentHeight: 100 - }); - - assert.isTrue(result); - }); - - it('should return false if image width is smaller than document width', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'auto'}, { - documentWidth: 101, - documentHeight: 100 - }); - - assert.isFalse(result); - }); - - it('should return false if image height is smaller than document height', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'auto'}, { - documentWidth: 100, - documentHeight: 101 - }); - - assert.isFalse(result); - }); - - it('should apply scale for document size if usePixelRatio was set', () => { - const image = imageStub_({width: 100, height: 100}); - const result = isFullPage_(image, {screenshotMode: 'auto', usePixelRatio: true}, { - documentWidth: 51, - documentHeight: 51, - pixelRatio: 2 - }); - - assert.isFalse(result); - }); - }); -}); diff --git a/test/unit/browser/wd-bluebird.js b/test/unit/browser/wd-bluebird.js new file mode 100644 index 000000000..4dadbef80 --- /dev/null +++ b/test/unit/browser/wd-bluebird.js @@ -0,0 +1,69 @@ +'use strict'; + +const Promise = require('bluebird'); +const q = require('q'); +const proxyquire = require('proxyquire'); + +describe('wd-bluebird', () => { + const sandbox = sinon.sandbox.create(); + let original, wrapped; + + beforeEach(() => { + original = { + promiseMethod: () => q('result'), + emit() {}, + property: 'value' + }; + + const wd = proxyquire('lib/browser/wd-bluebird', { + wd: { + promiseRemote: () => original + } + }); + + wrapped = wd.promiseRemote(); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should cast original promise to Bluebird', () => { + assert.instanceOf( + wrapped.promiseMethod(), + Promise + ); + }); + + it('should resolve to original value', () => { + return assert.eventually.equal( + wrapped.promiseMethod(), + original.promiseMethod() + ); + }); + + it('should forward all arguments to original method', () => { + const arg = 'arg'; + sandbox.spy(original, 'promiseMethod'); + + wrapped.promiseMethod(arg); + + assert.calledWith(original.promiseMethod, arg); + }); + + it('should copy properties as is', () => { + assert.equal(wrapped.property, original.property); + }); + + it('should not cast event emitter methods results', () => { + assert.isUndefined( + wrapped.emit('event') + ); + }); + + it('should not cast Object.prototype methods results', () => { + assert.isString( + wrapped.toString() + ); + }); +}); diff --git a/test/unit/calibrator.test.js b/test/unit/calibrator.test.js deleted file mode 100644 index 14d11d14b..000000000 --- a/test/unit/calibrator.test.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; -var q = require('q'), - path = require('path'), - fs = require('fs'), - Calibrator = require('lib/calibrator'), - Image = require('lib/image'), - GeminiError = require('lib/errors/gemini-error'), - browserWithId = require('../util').browserWithId; - -describe('calibrator', function() { - var browser, calibrator; - - function setScreenshot(imageName) { - var imgPath = path.join(__dirname, '..', 'functional', 'data', 'image', imageName), - imgData = fs.readFileSync(imgPath); - - browser.captureViewportImage.returns(q(new Image(imgData))); - } - - beforeEach(function() { - browser = browserWithId('id'); - sinon.stub(browser); - browser.evalScript.returns(q({innerWidth: 984})); //width of viewport in test image - browser.open.returns(q()); - calibrator = new Calibrator(); - }); - - it('should calculate correct crop area', function() { - setScreenshot('calibrate.png'); - var result = calibrator.calibrate(browser); - return q.all([ - assert.eventually.propertyVal(result, 'top', 2), - assert.eventually.propertyVal(result, 'left', 2) - ]); - }); - - it('should return also features detected by script', function() { - setScreenshot('calibrate.png'); - browser.evalScript.returns(q({feature: 'value', innerWidth:984})); - var result = calibrator.calibrate(browser); - return assert.eventually.propertyVal(result, 'feature', 'value'); - }); - - it('should not perform the calibration process two times', function() { - setScreenshot('calibrate.png'); - return calibrator.calibrate(browser) - .then(function() { - return calibrator.calibrate(browser); - }) - .then(function() { - assert.calledOnce(browser.open); - assert.calledOnce(browser.evalScript); - assert.calledOnce(browser.captureViewportImage); - }); - }); - - it('should return cached result second time', function() { - setScreenshot('calibrate.png'); - var result = calibrator.calibrate(browser) - .then(function() { - return calibrator.calibrate(browser); - }); - return q.all([ - assert.eventually.propertyVal(result, 'top', 2), - assert.eventually.propertyVal(result, 'left', 2) - ]); - }); - - it('should fail on broken calibration page', function() { - setScreenshot('calibrate-broken.png'); - return assert.isRejected(calibrator.calibrate(browser), GeminiError); - }); -}); diff --git a/test/unit/capture-session.js b/test/unit/capture-session.js new file mode 100644 index 000000000..24413c621 --- /dev/null +++ b/test/unit/capture-session.js @@ -0,0 +1,239 @@ +'use strict'; + +const Promise = require('bluebird'); + +const CaptureSession = require('lib/capture-session'); +const ActionsBuilder = require('lib/tests-api/actions-builder'); +const StateError = require('lib/errors/state-error'); +const {temp, ScreenShooter} = require('gemini-core'); + +describe('capture session', () => { + const sandbox = sinon.sandbox.create(); + + beforeEach(() => { + sandbox.stub(temp); + + sandbox.spy(ScreenShooter, 'create'); + sandbox.stub(ScreenShooter.prototype, 'capture').resolves(); + }); + + afterEach(() => sandbox.restore()); + + describe('constructor', () => { + it('should create a screen shooter instance', () => { + CaptureSession.create({foo: 'bar'}); + + assert.calledOnceWith(ScreenShooter.create, {foo: 'bar'}); + }); + }); + + describe('runActions', () => { + let browser; + let session; + + beforeEach(() => { + browser = {config: {}}; + session = CaptureSession.create(browser); + }); + + it('should call action in associated browser', () => { + const action = sinon.spy().named('action'); + + return session.runActions([action]) + .then(() => assert.calledOnceWith(action, browser)); + }); + + it('should call action with "postActions"', () => { + const action = sinon.spy().named('action'); + + return session.runActions([action]) + .then(() => assert.calledOnceWith(action, sinon.match.any, sinon.match.instanceOf(ActionsBuilder))); + }); + + it('should perform all actions with the same "postActions" instance', () => { + const action = sinon.spy().named('action'); + sandbox.stub(ActionsBuilder, 'create').returnsArg(0); + + return session.runActions([action]) + .then(() => session.runActions([action])) + .then(() => assert.deepEqual(action.firstCall.args[1], action.secondCall.args[1])); + }); + + it('should perform passed actions in order', () => { + const mediator = sinon.spy().named('mediator'); + const action1 = sinon.stub().named('action1').callsFake(() => Promise.delay(1).then(mediator)); + const action2 = sinon.spy().named('action2'); + + return session.runActions([action1, action2]) + .then(() => assert.callOrder(action1, mediator, action2)); + }); + + it('should rejects if any of passed actions rejected', () => { + const action1 = sinon.stub().named('action1').resolves(); + const action2 = sinon.stub().named('action2').rejects('foo'); + + return assert.isRejected(session.runActions([action1, action2]), /foo/); + }); + }); + + describe('runPostActions', () => { + let browser; + let session; + + beforeEach(() => { + browser = {config: {}}; + session = CaptureSession.create(browser); + }); + + it('should call action in associated browser', () => { + const action = sinon.spy().named('action'); + + sandbox.stub(ActionsBuilder, 'create') + .callsFake((postActions) => postActions.push(action)); + + return session.runActions([action]) + .then(() => session.runPostActions()) + .then(() => assert.deepEqual(action.secondCall.args, [browser])); + }); + + it('should perform post actions in reverse order', () => { + const mediator = sinon.spy().named('mediator'); + const action1 = sinon.spy().named('action1'); + const action2 = sinon.stub().named('action2').callsFake(() => Promise.delay(1).then(mediator)); + + sandbox.stub(ActionsBuilder, 'create') + .callsFake((postActions) => postActions.push(action1, action2)); + + return session.runActions([action1, action2]) + .then(() => session.runPostActions()) + .then(() => assert.callOrder(action2, mediator, action1)); + }); + + it('should rejects if any of post actions rejected', () => { + const action1 = sinon.stub().named('action1').resolves(); + const action2 = sinon.stub().named('action2').rejects('foo'); + + sandbox.stub(ActionsBuilder, 'create') + .callsFake((postActions) => postActions.push(action1, action2)); + + return session.runActions([action1, action2]) + .catch(() => assert.isRejected(session.runPostActions(), /foo/)); + }); + }); + + describe('prepareScreenshot', () => { + it('should prepare screenshot', () => { + const browser = { + config: {}, + prepareScreenshot: sinon.stub().returns(Promise.resolve()) + }; + const session = CaptureSession.create(browser); + const state = { + captureSelectors: ['.selector1', '.selector2'], + ignoreSelectors: ['.ignore1', '.ignore2'] + }; + + return session.prepareScreenshot(state) + .then(() => assert.calledWith(browser.prepareScreenshot, + ['.selector1', '.selector2'], + {ignoreSelectors: ['.ignore1', '.ignore2']} + )); + }); + }); + + describe('extendWithPageScreenshot', () => { + let browser; + let session; + let error; + let image; + + beforeEach(() => { + image = { + save: sinon.stub().resolves(), + getSize: sinon.stub() + }; + browser = { + config: {}, + captureViewportImage: sinon.stub().returns(Promise.resolve(image)) + }; + session = CaptureSession.create(browser); + error = {}; + }); + + it('should call captureViewportImage method', () => { + return session.extendWithPageScreenshot(error) + .then(() => assert.called(browser.captureViewportImage)); + }); + + it('should add image to an error', () => { + temp.path.returns('/path/to/img'); + image.getSize.returns({width: 100, height: 200}); + + return session.extendWithPageScreenshot(error) + .then(() => { + assert.deepEqual(error.img, {path: '/path/to/img', size: {width: 100, height: 200}}); + }); + }); + + it('should not add image to an error if can not captureViewportImage', () => { + browser.captureViewportImage = sinon.stub().callsFake(() => Promise.reject({})); + + error = new StateError('some error'); + + return session.extendWithPageScreenshot(error) + .then((e) => assert.deepEqual(error, e)); + }); + }); + + describe('serialize', () => { + it('should create object with serialized browser and passed config', () => { + const browser = { + serialize: sinon.stub().returns({some: 'data'}), + config: {someKey: 'some-value'} + }; + + const session = CaptureSession.create(browser); + + const obj = session.serialize(); + + assert.deepEqual(obj, { + browser: {some: 'data'} + }); + }); + }); + + describe('capture', () => { + const capture = (page = {}) => CaptureSession.create({config: {}}).capture(page); + + beforeEach(() => { + sandbox.stub(CaptureSession.prototype, 'extendWithPageScreenshot').returns(Promise.resolve()); + }); + + it('should capture image', () => { + ScreenShooter.prototype.capture.withArgs({foo: 'bar'}).resolves('image'); + + return capture({foo: 'bar'}) + .then((capture) => assert.equal(capture.image, 'image')); + }); + + it('should return the information about the caret on image', () => { + return capture({canHaveCaret: true}) + .then((capture) => assert.isTrue(capture.canHaveCaret)); + }); + + it('should throw if capture fails', () => { + ScreenShooter.prototype.capture.rejects(new Error('capture fails')); + + return assert.isRejected(capture(), /capture fails/); + }); + + it('should extend an error with page screenshot if capture fails', () => { + const err = new Error('capture fails'); + + ScreenShooter.prototype.capture.rejects(err); + + return capture() + .catch(() => assert.calledOnceWith(CaptureSession.prototype.extendWithPageScreenshot, err)); + }); + }); +}); diff --git a/test/unit/capture-session/coord-validator.js b/test/unit/capture-session/coord-validator.js deleted file mode 100644 index f2a281a6a..000000000 --- a/test/unit/capture-session/coord-validator.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -const _ = require('lodash'); - -const CoordValidator = require('lib/capture-session/coord-validator'); -const HeightViewportError = require('lib/capture-session/coord-validator/errors/height-viewport-error'); -const OffsetViewportError = require('lib/capture-session/coord-validator/errors/offset-viewport-error'); - -describe('CoordValidator', () => { - let coordValidator; - - function validate_(areaModification) { - const viewport = { - width: 10, - height: 10 - }; - - areaModification = _.defaults(areaModification || {}, { - left: 0, - top: 0, - width: 0, - height: 0 - }); - - const captureArea = { - left: areaModification.left, - top: areaModification.top, - width: viewport.width + areaModification.width, - height: viewport.height + areaModification.height - }; - - return coordValidator.validate(viewport, captureArea); - } - - beforeEach(() => { - coordValidator = new CoordValidator({id: 'some-browser-id'}); - }); - - describe('validation failed', () => { - it('if crop area left boundary is outside of viewport', () => { - assert.throws(() => validate_({left: -1}), OffsetViewportError); - }); - - it('if crop area top boundary is outside of viewport', () => { - assert.throws(() => validate_({top: -1}), OffsetViewportError); - }); - - it('if crop area right boundary is outside of viewport', () => { - assert.throws(() => validate_({width: +1}), OffsetViewportError); - }); - - it('if crop area height bigger than viewport height', () => { - assert.throws(() => validate_({height: +1}), HeightViewportError); - }); - }); - - it('should not throw on passed validation', () => { - const fn = () => validate_({left: 0}); - - return assert.doesNotThrow(fn); - }); -}); diff --git a/test/unit/capture-session/index.js b/test/unit/capture-session/index.js deleted file mode 100644 index d86461013..000000000 --- a/test/unit/capture-session/index.js +++ /dev/null @@ -1,372 +0,0 @@ -'use strict'; - -const q = require('q'); -const _ = require('lodash'); -const promiseUtils = require('q-promise-utils'); - -const CaptureSession = require('lib/capture-session'); -const ActionsBuilder = require('lib/tests-api/actions-builder'); -const Viewport = require('lib/capture-session/viewport'); -const StateError = require('lib/errors/state-error'); -const temp = require('lib/temp'); -const Image = require('lib/image'); - -describe('capture session', () => { - const sandbox = sinon.sandbox.create(); - let imageStub; - - beforeEach(() => { - imageStub = sinon.createStubInstance(Image); - sandbox.stub(promiseUtils); - promiseUtils.sequence.returns(q()); - - sandbox.stub(temp); - }); - - afterEach(() => sandbox.restore()); - - describe('runActions', () => { - let browser; - let session; - - beforeEach(() => { - browser = {config: {}}; - session = new CaptureSession(browser); - }); - - it('should perform passed action sequence', () => { - const actions = []; - - session.runActions(actions); - - assert.calledOnce(promiseUtils.sequence); - assert.calledWith(promiseUtils.sequence, actions); - }); - - it('should perform actions sequence in associated browser', () => { - session.runActions([]); - - assert.calledWith(promiseUtils.sequence, sinon.match.any, browser); - }); - - it('should peform actions sequence with postActions', () => { - session.runActions([]); - - assert.calledWith(promiseUtils.sequence, - sinon.match.any, - sinon.match.any, - sinon.match.instanceOf(ActionsBuilder) - ); - }); - - it('should perform all actions with the same postActions instance', () => { - sandbox.stub(ActionsBuilder.prototype, '__constructor').returnsArg(0); - - session.runActions([]); - session.runActions([]); - - assert.equal( - promiseUtils.sequence.firstCall.args[2], - promiseUtils.sequence.secondCall.args[2] - ); - }); - }); - - describe('runPostActions', () => { - it('should not pass postActions while performing postActions', () => { - const browser = {config: {}}; - const session = new CaptureSession(browser); - - session.runPostActions(); - - assert.lengthOf(promiseUtils.sequence.firstCall.args, 2); - }); - - it('should perform post actions in reverse order', () => { - const browser = {config: {}}; - const session = new CaptureSession(browser); - - sandbox.stub(ActionsBuilder.prototype, '__constructor', (postActions) => { - postActions.push(1, 2, 3); - }); - session.runActions([]); - session.runActions([]); - - session.runPostActions(); - - assert.calledWith(promiseUtils.sequence, [3, 2, 1, 3, 2, 1]); - }); - }); - - describe('prepareScreenshot', () => { - it('should prepare screenshot', () => { - const browser = { - config: {}, - prepareScreenshot: sinon.stub().returns(q()) - }; - const session = new CaptureSession(browser); - const state = { - captureSelectors: ['.selector1', '.selector2'], - ignoreSelectors: ['.ignore1', '.ignore2'] - }; - - return session.prepareScreenshot(state, {some: 'opt'}) - .then(() => assert.calledWith(browser.prepareScreenshot, - ['.selector1', '.selector2'], - { - some: 'opt', - ignoreSelectors: ['.ignore1', '.ignore2'] - } - )); - }); - }); - - describe('extendWithPageScreenshot', () => { - let browser; - let session; - let error; - - beforeEach(() => { - browser = { - config: {}, - captureViewportImage: sinon.stub().returns(q({ - save: sinon.stub() - })) - }; - session = new CaptureSession(browser); - error = {}; - }); - - it('should call captureViewportImage method', () => { - return session.extendWithPageScreenshot(error) - .then(() => assert.called(browser.captureViewportImage)); - }); - - it('should add an image path to error', () => { - temp.path.returns('/path/to/img'); - - return session.extendWithPageScreenshot(error) - .then(() => assert.deepEqual(error.imagePath, '/path/to/img')); - }); - - it('should not add an image to error if can not captureViewportImage', () => { - browser.captureViewportImage = sinon.stub().returns(q.reject({})); - - error = new StateError('some error'); - - return session.extendWithPageScreenshot(error) - .then((e) => assert.deepEqual(error, e)); - }); - }); - - describe('serialize', () => { - it('should create object with serialized browser and passed config', () => { - const browser = { - serialize: sinon.stub().returns({some: 'data'}), - config: {someKey: 'some-value'} - }; - - const session = new CaptureSession(browser); - - const obj = session.serialize(); - - assert.deepEqual(obj, { - browser: {some: 'data'} - }); - }); - }); - - describe('capture', () => { - let page; - let browserStub; - let captureSession; - - beforeEach(() => { - imageStub.crop.returns(q({})); - imageStub.getSize.returns({}); - imageStub.save.returns(q()); - - temp.path.returns('/path/to/img'); - - browserStub = { - config: {}, - captureViewportImage: sinon.stub().returns(q(imageStub)), - scrollBy: sinon.stub().returns(q()) - }; - - page = { - documentWidth: 10, - documentHeight: 10, - captureArea: { - width: 2, - height: 3 - }, - viewport: {top: 1, left: 1, width: 10, height: 10}, - ignoreAreas: [{left: 4, top: 4, width: 1, height: 1}], - canHaveCaret: true - }; - - sandbox.stub(Viewport.prototype, 'crop').returns(q()); - sandbox.stub(Viewport.prototype, 'ignoreAreas'); - - sandbox.spy(Viewport, 'create'); - sandbox.spy(Viewport.prototype, 'extendBy'); - - captureSession = new CaptureSession(browserStub); - }); - - it('should take screenshot', () => { - return captureSession.capture(_.assign({}, page)) - .then(() => assert.called(browserStub.captureViewportImage)); - }); - - it('should create viewport instance', () => { - browserStub.captureViewportImage.withArgs(page).returns(q('image')); - - return captureSession.capture(page) - .then(() => { - assert.calledWith(Viewport.create, page.viewport, 'image', page.pixelRatio); - }); - }); - - it('should crop image of passed size', () => { - return captureSession - .capture(page) - .then(() => assert.calledWith(Viewport.prototype.crop, page.captureArea)); - }); - - it('should return object with cropped image and `canHaveCaret` property', () => { - Viewport.prototype.crop.returns(q('image')); - - assert.eventually.equal(captureSession.capture(page), { - image: 'image', - canHaveCaret: page.canHaveCaret - }); - }); - - it('should clear configured ignore area before cropping image', () => { - return captureSession.capture(page) - .then(() => assert.calledWith(Viewport.prototype.ignoreAreas, page.ignoreAreas)); - }); - - describe('if validation fails', () => { - const testValidationFail = () => { - it('should not crop image', () => { - return captureSession.capture(page) - .catch(() => assert.notCalled(imageStub.crop)); - }); - - it('should save page screenshot', () => { - return captureSession.capture(page) - .catch(() => assert.calledOnce(imageStub.save)); - }); - - it('should extend error with path to page screenshot', () => { - return captureSession.capture(page) - .catch((error) => assert.equal(error.imagePath, '/path/to/img')); - }); - - it('should return rejected promise', () => { - return assert.isRejected(captureSession.capture(page), StateError); - }); - }; - - describe('with NOT `HeightViewportError`', () => { - beforeEach(() => { - page = {captureArea: {top: -1}}; - }); - - testValidationFail(); - }); - - describe('with `HeightViewportError`', () => { - describe('option `compositeImage` is switched off', () => { - beforeEach(() => { - page = {captureArea: {height: 7}, viewport: {height: 5}}; - }); - - testValidationFail(); - }); - - describe('option `compositeImage` is switched on', () => { - beforeEach(() => { - browserStub.config.compositeImage = true; - }); - - it('should scroll vertically if capture area is higher then viewport', () => { - page = {captureArea: {height: 7}, viewport: {top: 0, height: 5}}; - - return captureSession.capture(page) - .then(() => assert.calledWith(browserStub.scrollBy, 0, 2)); - }); - - it('should scroll vertically until the end of capture area', () => { - page = {captureArea: {height: 11}, viewport: {top: 0, height: 5}}; - - return captureSession.capture(page) - .then(() => { - assert.calledTwice(browserStub.scrollBy); - assert.calledWith(browserStub.scrollBy, 0, 5); - assert.calledWith(browserStub.scrollBy, 0, 1); - }); - }); - - it('should capture scrolled viewport image', () => { - page = {captureArea: {height: 7}, viewport: {top: 0, height: 5}}; - - return captureSession.capture(page) - .then(() => assert.calledWithMatch(browserStub.captureViewportImage, {viewport: {top: 2}})); - }); - - // Test does not fairly check that `captureViewportImage` was called after resolving of `scrollBy` - it.skip('should capture viewport image after scroll', () => { - page = {captureArea: {height: 7}, viewport: {top: 0, height: 5}}; - - const scrolledPage = {captureArea: {height: 7}, viewport: {top: 2, height: 5}}; - - const scroll = browserStub.scrollBy.withArgs(0, 2).named('scroll'); - const captureViewportImage = browserStub.captureViewportImage - .withArgs(scrolledPage).named('captureViewportImage'); - - return captureSession.capture(page) - .then(() => assert.callOrder(scroll, captureViewportImage)); - }); - - it('should extend original image by scrolled viewport image', () => { - page = {captureArea: {height: 7}, viewport: {top: 0, height: 5}}; - - const scrolledPage = {captureArea: {height: 7}, viewport: {top: 2, height: 5}}; - const scrolledViewportScreenshot = imageStub; - - browserStub.captureViewportImage - .withArgs(scrolledPage).returns(q(scrolledViewportScreenshot)); - - return captureSession.capture(page) - .then(() => assert.calledWith(Viewport.prototype.extendBy, 2, scrolledViewportScreenshot)); - }); - - it('should crop capture area which is higher then viewport', () => { - page = {captureArea: {height: 7}, viewport: {top: 0, height: 5}}; - - return captureSession.capture(page) - .then(() => assert.calledWith(Viewport.prototype.crop, page.captureArea)); - }); - - it('should return object with cropped image and `canHaveCaret` property', () => { - Viewport.prototype.crop.returns(q('image')); - - assert.eventually.equal(captureSession.capture(page), { - image: 'image', - canHaveCaret: page.canHaveCaret - }); - }); - - it('should clear configured ignore area before cropping image', () => { - return captureSession.capture(page) - .then(() => assert.calledWith(Viewport.prototype.ignoreAreas, page.ignoreAreas)); - }); - }); - }); - }); - }); -}); diff --git a/test/unit/capture-session/viewport.js b/test/unit/capture-session/viewport.js deleted file mode 100644 index 9bf695851..000000000 --- a/test/unit/capture-session/viewport.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict'; - -const _ = require('lodash'); -const q = require('q'); - -const CoordValidator = require('lib/capture-session/coord-validator'); -const Image = require('lib/image'); -const Viewport = require('lib/capture-session/viewport'); - -describe('Viewport', () => { - const sandbox = sinon.sandbox.create(); - - const createViewport = (opts) => new Viewport(opts.coords || {top: 0, left:0}, opts.image, opts.pixelRatio); - - afterEach(() => sandbox.restore()); - - describe('validate', () => { - const validate = (opts) => { - opts = _.defaults(opts || {}, { - viewport: {}, - captureArea: {}, - browser: 'default-bro' - }); - - const viewport = createViewport(opts.viewport); - - viewport.validate(opts.captureArea, opts.browser); - }; - - beforeEach(() => { - sandbox.spy(CoordValidator, 'create'); - sandbox.stub(CoordValidator.prototype, 'validate'); - }); - - it('should create coordinates validator with passed browser', () => { - validate({browser: 'some-browser'}); - - assert.calledWith(CoordValidator.create, 'some-browser'); - }); - - it('should validate passed capture area', () => { - validate({ - viewport: {coords: {top: 0, left: 0}}, - captureArea: {top: 1, left: 1} - }); - - assert.calledWith(CoordValidator.prototype.validate, {top: 0, left: 0}, {top: 1, left: 1}); - }); - }); - - describe('ignoreAreas', () => { - let image; - - beforeEach(() => image = sinon.createStubInstance(Image)); - - it('should ignore passed areas', () => { - const viewport = createViewport({image, pixelRatio: 1}); - - viewport.ignoreAreas([{top: 1, left: 1}]); - - assert.calledWith(image.clear, {top: 1, left: 1}, {scaleFactor: 1}); - }); - - it('should transform area coordinates to a viewport origin', () => { - const viewport = createViewport({coords: {top: 1, left: 1}, image}); - - viewport.ignoreAreas([{top: 1, left: 1}]); - - assert.calledWith(image.clear, {top: 0, left: 0}); - }); - }); - - describe('crop', () => { - let image; - - beforeEach(() => { - image = sinon.createStubInstance(Image); - - image.crop.returns(q()); - }); - - it('should crop an image', () => { - const viewport = createViewport({image, pixelRatio: 1}); - - return viewport.crop({top: 1, left: 1}) - .then(() => assert.calledWith(image.crop, {top: 1, left: 1}, {scaleFactor: 1})); - }); - - it('should transform area coordinates to a viewport origin', () => { - const viewport = createViewport({image, coords: {top: 1, left: 1}}); - - return viewport.crop({top: 1, left: 1}) - .then(() => assert.calledWith(image.crop, {top: 0, left: 0})); - }); - }); - - describe('save', () => { - let image; - - beforeEach(() => image = sinon.createStubInstance(Image)); - - it('should save viewport image', () => { - const viewport = createViewport({image}); - - viewport.save('path/to/img'); - - assert.calledWith(image.save, 'path/to/img'); - }); - }); - - describe('extendBy', () => { - let image; - let newImage; - - beforeEach(() => { - image = sinon.createStubInstance(Image); - newImage = sinon.createStubInstance(Image); - - newImage.crop.returns(q()); - newImage.getSize.returns({}); - }); - - it('should increase viewport height value by scroll height', () => { - const viewport = createViewport({coords: {height: 5}, image}); - - return viewport.extendBy(2, newImage) - .then(() => assert.equal(viewport.getVerticalOverflow({height: 7}), 0)); - }); - - it('should crop new image by passed scroll height', () => { - const viewport = createViewport({image, pixelRatio: 0.5}); - - newImage.getSize.returns({height: 4, width: 2}); - - return viewport.extendBy(2, newImage) - .then(() => assert.calledWith(newImage.crop, {left: 0, top: 3, width: 2, height: 1})); - }); - - it('should join original image with cropped image', () => { - const viewport = createViewport({image}); - - newImage.crop.returns(q('cropped-image')); - - return viewport.extendBy(null, newImage) - .then(() => assert.calledWith(image.join, 'cropped-image')); - }); - }); - - describe('getVerticalOverflow', () => { - it('should get outside height', () => { - const viewport = createViewport({coords: {height: 5}}); - - assert.equal(viewport.getVerticalOverflow({height: 15}), 10); - }); - }); -}); diff --git a/test/unit/client-bridge.test.js b/test/unit/client-bridge.test.js deleted file mode 100644 index 0c02acc29..000000000 --- a/test/unit/client-bridge.test.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict'; -var q = require('q'), - ClientBridge = require('lib/browser/client-bridge'), - StateError = require('lib/errors/state-error'), - - browserWithId = require('../util').browserWithId, - CALL = '__gemini.example(1, "two")'; - -describe('ClientBridge', function() { - beforeEach(function() { - this.browser = sinon.stub(browserWithId('id')); - this.browser.evalScript.returns(q({})); - this.browser.injectScript.returns(q({})); - this.script = 'exampleScript()'; - this.bridge = new ClientBridge(this.browser, this.script); - }); - - describe('call', function() { - it('should try to call a method on __gemini namespace', function() { - var _this = this; - return this.bridge.call('example', [1, 'two']) - .then(function() { - assert.calledWith( - _this.browser.evalScript, - sinon.match(CALL) - ); - }); - }); - - it('should allow to not specify the arguments', function() { - var _this = this; - return this.bridge.call('example') - .then(function() { - assert.calledWith( - _this.browser.evalScript, - sinon.match('__gemini.example()') - ); - }); - }); - - it('should return what evalScript returns if succeeded', function() { - this.browser.evalScript.returns(q('result')); - return assert.becomes(this.bridge.call('example'), 'result'); - }); - - it('should reject if evalScript returns unexpected error', function() { - var message = 'Something happened'; - this.browser.evalScript.returns(q({error: message})); - var result = this.bridge.call('fail'); - return assert.isRejected(result, StateError, message); - }); - - it('should not attempt to call eval second if it return with unexpected error', function() { - var _this = this; - this.browser.evalScript.returns(q({error: 'unexpected'})); - return assert.isRejected(this.bridge.call('fail')) - .then(function() { - assert.calledOnce(_this.browser.evalScript); - }); - }); - - describe('if scripts were not injected', function() { - beforeEach(function() { - this.setupAsNonInjected = function(finalResult) { - this.browser.evalScript - .onFirstCall().returns(q({error: 'ERRNOFUNC'})) - .onSecondCall().returns(q(finalResult)); - - this.browser.injectScript - .withArgs(this.script) - .returns(q()); - }; - - this.performCall = function() { - return this.bridge.call('example'); - }; - }); - - it('should try to inject scripts', function() { - this.setupAsNonInjected(); - var _this = this; - return this.performCall() - .then(function() { - assert.calledWith(_this.browser.injectScript, _this.script); - }); - }); - - it('should try to eval again after inject', function() { - this.setupAsNonInjected(); - var _this = this; - return this.bridge.call('example', [1, 'two']) - .then(function() { - assert.calledTwice(_this.browser.evalScript); - assert.alwaysCalledWith(_this.browser.evalScript, sinon.match(CALL)); - }); - }); - - it('should return result of the succesfull call', function() { - this.setupAsNonInjected('success'); - return assert.becomes(this.performCall(), 'success'); - }); - - it('should fail if scripts failed to inject', function() { - this.setupAsNonInjected({error: 'ERRNOFUNC'}); - return assert.isRejected(this.performCall(), StateError); - }); - }); - }); -}); diff --git a/test/unit/config-options/config-options.test.js b/test/unit/config-options/config-options.test.js index ebf62c5c7..4585b1212 100644 --- a/test/unit/config-options/config-options.test.js +++ b/test/unit/config-options/config-options.test.js @@ -8,7 +8,13 @@ var Config = require('lib/config'), describe('config', function() { var VALID_OPTIONS = { system: { - projectRoot: '/some/path' + projectRoot: '/some/path', + plugins: { + plugin: {} + }, + ctx: { + variable: 'value' + } }, rootUrl: 'http://example.com/root', gridUrl: 'http://example.com/root', @@ -17,6 +23,7 @@ describe('config', function() { browser: {} } }; + function parseConfig(options) { return parser({ options: options, @@ -224,6 +231,38 @@ describe('config', function() { }); } + function testObjectOption(name) { + it('should parse any of primitive type from environment', () => { + ['string', 1.0, 1, false, null, [], {a: 1}].forEach((expected) => { + const value = JSON.stringify(expected); + assertParsesEnv({property: name, value, expected}); + }); + }); + + it('should throw if value from environment is not valid', () => { + ['{a:1}', '{', ']', '\'string\'', '\n'].forEach((value) => { + assert.throw(() => { + assertParsesEnv({property: name, value}); + }, GeminiError); + }); + }); + + it('should parse any of primitive type from cli', () => { + ['string', 1.0, 1, false, null, [], {a: 1}].forEach((expected) => { + const value = JSON.stringify(expected); + assertParsesCli({property: name, value, expected}); + }); + }); + + it('should throw if value from cli is not valid', () => { + ['{a:1}', '{', ']', '\'string\'', '\n'].forEach((value) => { + assert.throw(() => { + assertParsesCli({property: name, value}); + }, GeminiError); + }); + }); + } + beforeEach(function() { this.sinon = sinon.sandbox.create(); }); @@ -351,6 +390,42 @@ describe('config', function() { testBooleanOption('system.coverage.html', {default: true}); }); + describe('map', () => { + const createConfigWithCoverageMap = (map) => { + return () => { + createConfig({ + system: { + coverage: {map} + } + }); + }; + }; + + it('should cut browser root url from passed url by default', () => { + const config = new Config({ + rootUrl: 'http://some/root/url', + system: { + projectRoot: '/some/project/root' + } + }); + const resolvedPath = config.system.coverage + .map('http://some/root/url/rel/path', 'http://some/root/url'); + + assert.equal(resolvedPath, 'rel/path'); + }); + + it('should not accept non-function value types', () => { + assert.throws(createConfigWithCoverageMap(null), GeminiError); + assert.throws(createConfigWithCoverageMap(10), GeminiError); + assert.throws(createConfigWithCoverageMap('foo'), GeminiError); + assert.throws(createConfigWithCoverageMap({}), GeminiError); + }); + + it('should accept function', () => { + assert.doesNotThrow(createConfigWithCoverageMap(_.noop), GeminiError); + }); + }); + describe('exclude', function() { it('should be [] by default', function() { var config = createConfig(); @@ -402,6 +477,14 @@ describe('config', function() { }); }); }); + + describe('plugins', () => { + testObjectOption('system.plugins.plugin'); + }); + + describe('ctx', () => { + testObjectOption('system.ctx.variable'); + }); }); describe('browser options', function() { @@ -478,6 +561,34 @@ describe('config', function() { top: 'http://top.example.com', browser: 'http://browser.example.com' }); + + it('should append relative browser rootUrl to top level value', () => { + const config = createConfig({ + rootUrl: 'http://top.example.com', + browsers: { + browser: { + rootUrl: 'browser.example', + desiredCapabilities: {} + } + } + }); + + assert.propertyVal(config.browsers.browser, 'rootUrl', 'http://top.example.com/browser.example'); + }); + + it('should remove first slash from relative browser rootUrl', () => { + const config = createConfig({ + rootUrl: 'http://top.example.com', + browsers: { + browser: { + rootUrl: '/browser.example', + desiredCapabilities: {} + } + } + }); + + assert.propertyVal(config.browsers.browser, 'rootUrl', 'http://top.example.com/browser.example'); + }); }); describe('gridUrl', function() { @@ -596,46 +707,51 @@ describe('config', function() { }); }); - describe('tolerance', function() { - it('should not accept non-numbers', function() { - assert.throws(function() { - createBrowserConfig({ - tolerance: 'very tolerant' - }); - }, GeminiError); - }); + [ + {optionName: 'tolerance', defaultValue: 2.3}, + {optionName: 'antialiasingTolerance', defaultValue: 0} + ].forEach(({optionName, defaultValue}) => { + describe(`${optionName}`, function() { + it('should not accept non-numbers', function() { + assert.throws(function() { + createBrowserConfig({ + [optionName]: 'very tolerant' + }); + }, GeminiError); + }); - it('should accept numbers', function() { - var config = createBrowserConfig({ - tolerance: 2.8 + it('should accept numbers', function() { + var config = createBrowserConfig({ + [optionName]: 2.8 + }); + assert.equal(config[optionName], 2.8); }); - assert.equal(config.tolerance, 2.8); - }); - it('should be 2.3 by default', function() { - var config = createBrowserConfig({}); - assert.equal(config.tolerance, 2.3); - }); + it(`should be ${defaultValue} by default`, function() { + var config = createBrowserConfig({}); + assert.equal(config[optionName], defaultValue); + }); - shouldBeSettableFromTopLevel('tolerance', 3.0); - shouldOverrideTopLevelValue('tolerance', { - top: 4.0, - browser: 5.0 - }); + shouldBeSettableFromTopLevel(`${optionName}`, 3.0); + shouldOverrideTopLevelValue(`${optionName}`, { + top: 4.0, + browser: 5.0 + }); - it('should correctly parse env var', function() { - assertParsesEnv({ - property: 'browsers.browser.tolerance', - value: '100', - expected: 100 + it('should correctly parse env var', function() { + assertParsesEnv({ + property: `browsers.browser.${optionName}`, + value: '100', + expected: 100 + }); }); - }); - it('should correctly parse cli flag', function() { - assertParsesCli({ - property: 'browsers.browser.tolerance', - value: '100', - expected: 100 + it('should correctly parse cli flag', function() { + assertParsesCli({ + property: `browsers.browser.${optionName}`, + value: '100', + expected: 100 + }); }); }); }); @@ -800,6 +916,94 @@ describe('config', function() { }); }); + describe('buildDiffOpts', function() { + it('should throw error if "buildDiffOpts" is not a object', () => { + assert.throws(function() { + createBrowserConfig({ + buildDiffOpts: 'some-string' + }); + }, 'buildDiffOpts should be object'); + }); + + ['ignoreAntialiasing', 'ignoreCaret'].forEach(function(option) { + it(`should set "${option}" to "true" by default`, () => { + var config = createBrowserConfig(); + + assert.equal(config.buildDiffOpts[option], true); + }); + }); + + it('should set provided value', function() { + const config = createBrowserConfig({ + buildDiffOpts: {k1: 'v1', k2: 'v2'} + }); + + assert.deepEqual(config.buildDiffOpts, {k1: 'v1', k2: 'v2'}); + }); + }); + + describe('orientation', function() { + it('should be null by default', function() { + var config = createBrowserConfig(); + + assert.isNull(config.orientation); + }); + + it('should accept "portrait" value', function() { + var config = createBrowserConfig({ + orientation: 'portrait' + }); + + assert.equal(config.orientation, 'portrait'); + }); + + it('should accept "landscape" value', function() { + var config = createBrowserConfig({ + orientation: 'landscape' + }); + + assert.equal(config.orientation, 'landscape'); + }); + + it('should not accept any other string value', function() { + assert.throws(function() { + createBrowserConfig({ + orientation: 'lalalal' + }); + }, /"orientation" must be "landscape" or "portrait"/); + }); + + it('should not accept non-string value', function() { + assert.throws(function() { + createBrowserConfig({ + orientation: 100 + }); + }, /a value must be string/); + }); + + shouldBeSettableFromTopLevel('orientation', 'portrait'); + shouldOverrideTopLevelValue('orientation', { + top: 'portrait', + browser: 'landscape' + }); + + it('should correctly parse env var', function() { + assertParsesEnv({ + property: 'browsers.browser.orientation', + value: 'portrait', + expected: 'portrait' + }); + }); + + it('should correctly parse cli flag', function() { + assertParsesCli({ + property: 'browsers.browser.orientation', + value: 'portrait', + expected: 'portrait' + }); + }); + }); + describe('desiredCapabilities', function() { it('should accept objects', function() { var config = createBrowserConfig({ diff --git a/test/unit/config-options/sets.test.js b/test/unit/config-options/sets.test.js deleted file mode 100644 index 24fe24f26..000000000 --- a/test/unit/config-options/sets.test.js +++ /dev/null @@ -1,155 +0,0 @@ -'use strict'; -var parser = require('lib/config/options'), - GeminiError = require('lib/errors/gemini-error'), - _ = require('lodash'); - -describe('config.sets', function() { - /// - function createConfig(opts) { - var REQUIRED_OPTIONS = { - system: { - projectRoot: '/some/path' - }, - rootUrl: 'http://example.com/root', - desiredCapabilities: {} - }; - - var options = _.extend({}, REQUIRED_OPTIONS, opts); - - return parser({ - options: options, - env: {}, - argv: [] - }); - } - - describe('files', function() { - it('should be `gemini` by default', function() { - var config = createConfig({ - sets: { - someSet: {} - } - }); - - assert.deepEqual(config.sets.someSet.files, ['gemini']); - }); - - it('should convert string to array of strings', function() { - var config = createConfig({ - sets: { - someSet: { - files: 'some/path' - } - } - }); - - assert.deepEqual(config.sets.someSet.files, ['some/path']); - }); - - it('should not accept non-string arrays', function() { - assert.throws(function() { - createConfig({ - sets: { - someSet: { - files: [100500] - } - } - }); - }, GeminiError); - }); - - it('should accept array with strings', function() { - var config = createConfig({ - sets: { - someSet: { - files: [ - 'some/path', - 'other/path' - ] - } - } - }); - - assert.deepEqual(config.sets.someSet.files, [ - 'some/path', - 'other/path' - ]); - }); - }); - - describe('browsers', function() { - it('should contain all browsers by default', function() { - var config = createConfig({ - browsers: { - b1: {}, - b2: {} - }, - sets: { - someSet: {} - } - }); - - assert.deepEqual(config.sets.someSet.browsers, ['b1', 'b2']); - }); - - it('should not accept non-arrays', function() { - assert.throws(function() { - createConfig({ - sets: { - someSet: { - browsers: 'something' - } - } - }); - }, GeminiError); - }); - - it('should not accept unknown browsers', function() { - assert.throws(function() { - createConfig({ - browsers: { - b1: {}, - b2: {} - }, - sets: { - someSet: { - browsers: ['b3'] - } - } - }); - }, GeminiError); - }); - - it('should accept configured browsers', function() { - var config = createConfig({ - browsers: { - b1: {}, - b2: {} - }, - sets: { - set1: { - browsers: ['b1'] - }, - set2: { - browsers: ['b2'] - } - } - }); - - assert.deepEqual(config.sets.set1.browsers, ['b1']); - assert.deepEqual(config.sets.set2.browsers, ['b2']); - }); - }); - - it('should have `all` set with default values if no set specified', function() { - var config = createConfig({ - browsers: { - b1: {}, - b2: {} - } - }); - - assert.deepEqual(config.sets.all.files, ['gemini']); - assert.deepEqual(config.sets.all.browsers, ['b1', 'b2']); - }); -}); diff --git a/test/unit/config/config-reader.js b/test/unit/config/config-reader.js index 4d4118f10..de83b17a9 100644 --- a/test/unit/config/config-reader.js +++ b/test/unit/config/config-reader.js @@ -25,21 +25,31 @@ describe('config/config-reader', () => { } describe('default config (js|json)', () => { - function test_(fileName) { + const test_ = (fileName) => { it('should read ' + fileName, () => { - const files = {}; - files[fileName] = {some: 'data'}; - const reader = initReader_(files); - + const reader = initReader_({[fileName]: {foo: 'bar'}}); const result = reader.read(); - - assert.deepEqual(result, {some: 'data'}); + assert.deepEqual(result, {foo: 'bar'}); }); - } + }; test_('.gemini.conf.js'); test_('.gemini.js'); test_('.gemini.conf.json'); test_('.gemini.json'); }); + + describe('custom config (js|json)', () => { + const test_ = (fileName) => { + it('should read ' + fileName, () => { + const reader = initReader_({[fileName]: {foo: 'bar'}}); + const result = reader.read(fileName); + assert.deepEqual(result, {foo: 'bar'}); + }); + }; + test_('some-file.js'); + test_('some-file.json'); + test_('some-dir/some-file.js'); + test_('some-dir/some-file.json'); + }); }); diff --git a/test/unit/config/index.js b/test/unit/config/index.js index cd57eb1f5..c489c85a9 100644 --- a/test/unit/config/index.js +++ b/test/unit/config/index.js @@ -13,14 +13,26 @@ describe('config', function() { it('should read config file', function() { sandbox.stub(configReader, 'read').returns({rootUrl: ''}); - new Config('/some/path'); // jshint ignore:line + new Config('/some/path'); // eslint-disable-line assert.calledWith(configReader.read, '/some/path'); }); + it('should have static API for reading of a configuration file', () => { + sandbox.stub(configReader, 'read') + .withArgs('/some/path') + .returns({foo: 'bar'}); + + assert.deepEqual(Config.readRawConfig('/some/path'), { + foo: 'bar', + system: { + projectRoot: '/some' + } + }); + }); + describe('overrides', function() { beforeEach(function() { - /*jshint -W069*/ this.configValue = '/from/config'; this.envValue = '/from/env'; this.cliValue = '/from/cli'; @@ -42,7 +54,6 @@ describe('config', function() { }); afterEach(function() { - /*jshint -W069*/ delete process.env['gemini_system_project_root']; process.argv = this.oldArgv; }); diff --git a/test/unit/coverage-level.test.js b/test/unit/coverage-level.test.js deleted file mode 100644 index db10c3503..000000000 --- a/test/unit/coverage-level.test.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; -var level = require('lib/coverage-level'); - -describe('coverage level', function() { - describe('merge', function() { - it('NONE + NONE should equal NONE', function() { - assert.equal(level.merge(level.NONE, level.NONE), level.NONE); - }); - - it('NONE + PARTIAL should equal PARTIAL', function() { - assert.equal(level.merge(level.NONE, level.PARTIAL), level.PARTIAL); - }); - - it('PARTIAL + NONE should equal PARTIAL', function() { - assert.equal(level.merge(level.PARTIAL, level.NONE), level.PARTIAL); - }); - - it('NONE + FULL should equal FULL', function() { - assert.equal(level.merge(level.NONE, level.FULL), level.FULL); - }); - - it('FULL + NONE should equal FULL', function() { - assert.equal(level.merge(level.FULL, level.NONE), level.FULL); - }); - - it('PARTIAL + FULL should equal FULL', function() { - assert.equal(level.merge(level.PARTIAL, level.FULL), level.FULL); - }); - - it('FULL + PARTIAL should equal FULL', function() { - assert.equal(level.merge(level.FULL, level.PARTIAL), level.FULL); - }); - - it('FULL + FULL should equal FULL', function() { - assert.equal(level.merge(level.FULL, level.FULL), level.FULL); - }); - }); -}); diff --git a/test/unit/coverage.js b/test/unit/coverage.js new file mode 100644 index 000000000..597991038 --- /dev/null +++ b/test/unit/coverage.js @@ -0,0 +1,90 @@ +'use strict'; + +const _ = require('lodash'); +const path = require('path'); +const Coverage = require('lib/coverage'); + +describe('coverage', () => { + const sandbox = sinon.sandbox.create(); + + const createConfig = (opts) => { + return _.defaultsDeep(opts || {}, { + forBrowser: sinon.stub().returns({ + rootUrl: 'browser/root/url' + }), + system: {projectRoot: 'root/path'} + }); + }; + + beforeEach(() => { + sandbox.stub(path, 'resolve'); + }); + + afterEach(() => sandbox.restore()); + + describe('addStatsForBrowser', () => { + it('should resolve absolute path to a file on the file system', () => { + const config = createConfig({ + system: { + sourceRoot: 'source/root', + coverage: {map: () => 'rel/path'} + } + }); + const coverage = new Coverage(config); + + coverage.addStatsForBrowser({'http://some/url': {}}); + + assert.calledWith(path.resolve, 'source/root', 'rel/path'); + }); + + it('should correctly merge a coverage level', () => { + const config = createConfig(); + const coverage = new Coverage(config); + + coverage.byURL['http://some/url'] = { + coverage: {'.some-selector': 'full'} + }; + coverage.addStatsForBrowser({'http://some/url': {'.some-selector': 'none'}}); + + assert.deepEqual(coverage.byURL['http://some/url'].coverage, {'.some-selector': 'full'}); + }); + }); + + describe('getSourceMap', () => { + it('parse source map', () => { + const config = createConfig(); + const coverage = new Coverage(config); + + const ast = { + stylesheet: { + rules: [{ + type: 'comment', + comment: '# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzdHlsZXMuY3NzIiwic291cmNlUm9vdCI6IiJ9' + }] + } + }; + + const map = coverage.getSourceMap(ast, '', ''); + + assert.equal(map.file, 'styles.css'); + }); + + it('parse webpack source map', () => { + const config = createConfig(); + const coverage = new Coverage(config); + + const ast = { + stylesheet: { + rules: [{ + type: 'comment', + comment: '# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzdHlsZXMuY3NzIiwic291cmNlUm9vdCI6IiJ9' + }] + } + }; + + const map = coverage.getSourceMap(ast, '', ''); + + assert.equal(map.file, 'styles.css'); + }); + }); +}); diff --git a/test/unit/errors/cancelled-error.js b/test/unit/errors/cancelled-error.js new file mode 100644 index 000000000..f2fa71a7a --- /dev/null +++ b/test/unit/errors/cancelled-error.js @@ -0,0 +1,11 @@ +'use strict'; + +const CancelledError = require('lib/errors/cancelled-error'); + +describe('CancelledError', function() { + it('should include the error message in the stacktrace', function() { + const error = new CancelledError(); + + assert.match(error.stack, /^CancelledError: Browser request was cancelled\n/); + }); +}); diff --git a/test/unit/errors/gemini-error.js b/test/unit/errors/gemini-error.js new file mode 100644 index 000000000..75d34beb6 --- /dev/null +++ b/test/unit/errors/gemini-error.js @@ -0,0 +1,11 @@ +'use strict'; + +const GeminiError = require('lib/errors/gemini-error'); + +describe('GeminiError', function() { + it('should include the given error message in the stacktrace', function() { + const error = new GeminiError('MyCustomErrorMessage'); + + assert.match(error.stack, /^GeminiError: MyCustomErrorMessage\n/); + }); +}); diff --git a/test/unit/errors/no-ref-image-error.js b/test/unit/errors/no-ref-image-error.js new file mode 100644 index 000000000..5531680dd --- /dev/null +++ b/test/unit/errors/no-ref-image-error.js @@ -0,0 +1,11 @@ +'use strict'; + +const NoRefImageError = require('lib/errors/no-ref-image-error'); + +describe('NoRefImageError', () => { + it('should include the error message in the stacktrace', () => { + const error = new NoRefImageError({path: 'anyPath'}); + + assert.match(error.stack, /^NoRefImageError: Can not find reference image at anyPath.\n/); + }); +}); diff --git a/test/unit/errors/state-error.js b/test/unit/errors/state-error.js new file mode 100644 index 000000000..2d7b44d71 --- /dev/null +++ b/test/unit/errors/state-error.js @@ -0,0 +1,11 @@ +'use strict'; + +const StateError = require('lib/errors/state-error'); + +describe('StateError', function() { + it('should include the given error message in the stacktrace', function() { + const error = new StateError('MyCustomErrorMessage'); + + assert.match(error.stack, /^StateError: MyCustomErrorMessage\n/); + }); +}); diff --git a/test/unit/errors/utils.js b/test/unit/errors/utils.js index 470240c3b..c77e6401e 100644 --- a/test/unit/errors/utils.js +++ b/test/unit/errors/utils.js @@ -15,7 +15,7 @@ describe('errors utils', () => { }); it('should handle NoRefImageError', () => { - let obj = {name: 'NoRefImageError'}; + let obj = {name: 'NoRefImageError', refImg: {}, currImg: {}}; let error = errorUtils.fromPlainObject(obj); @@ -56,5 +56,12 @@ describe('errors utils', () => { const cloned = errorUtils.cloneError(err); assert.equal(cloned.key, 'value'); }); + + it('should keep original stack trace when cloning', () => { + const err = new Error(); + const cloned = errorUtils.cloneError(err); + + assert.equal(cloned.stack, err.stack); + }); }); }); diff --git a/test/unit/fail-collector.js b/test/unit/fail-collector.js deleted file mode 100644 index bb7c20413..000000000 --- a/test/unit/fail-collector.js +++ /dev/null @@ -1,284 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - Config = require('lib/config'), - FailCollector = require('lib/fail-collector'), - NoRefImageError = require('lib/errors/no-ref-image-error'); - -describe('FailCollector', function() { - var sandbox = sinon.sandbox.create(), - candidate; - - beforeEach(function() { - candidate = { - browserId: 'browser', - suite: {} - }; - }); - - afterEach(function() { - sandbox.restore(); - }); - - describe('tryToSubmitError', function() { - it('should throw if retry candidate missing `suite` field', function() { - var failCollector = createFailCollector_(); - - assert.throws(function() { - failCollector.tryToSubmitError({browserId: 'id'}); - }, 'suite'); - }); - - it('should throw if retry candidate missing `browserId` field', function() { - var failCollector = createFailCollector_(); - - assert.throws(function() { - failCollector.tryToSubmitError({suite: {}}); - }, 'browserId'); - }); - - it('should not submit NoRefImageError', function() { - var candidate = sinon.createStubInstance(NoRefImageError), - failCollector = createFailCollector_(); - - assert.equal(failCollector.tryToSubmitError(candidate), false); - }); - - it('should not submit candidate if no retries set for browser', function() { - var failCollector = createFailCollector_({browser: 0}); - - assert.equal(failCollector.tryToSubmitError(candidate), false); - }); - - it('should not submit candidate if performed more retries than available for browser', function() { - var failCollector = createFailCollector_({browser: 1}); - - failCollector.retry(_.noop); - - assert.equal(failCollector.tryToSubmitError(candidate), false); - }); - - it('should return true if candidate was submitted for retry', function() { - var failCollector = createFailCollector_(); - - assert.equal(failCollector.tryToSubmitError(candidate), true); - }); - - it('should emit `retry` event if candidate was submitted for retry', function() { - var failCollector = createFailCollector_(), - onRetry = sandbox.spy(); - - failCollector.on('retry', onRetry); - failCollector.tryToSubmitError(candidate); - - assert.calledOnce(onRetry); - }); - - it('should extend retry candidate with info about retry', function() { - var failCollector = createFailCollector_({browser: 1}), - onRetry = sandbox.spy(); - - failCollector.on('retry', onRetry); - failCollector.tryToSubmitError(candidate); - - assert.calledWithMatch(onRetry, { - attempt: 0, - retriesLeft: 1 - }); - }); - - it('should add suite to retry queue', function() { - var failCollector = createFailCollector_(), - suite = { - fullName: 'test_name' - }, - candidate = { - browserId: 'browser', - suite: suite - }, - retryFunc = sandbox.spy(); - - failCollector.tryToSubmitError(candidate); - failCollector.retry(retryFunc); - - assert.calledWith(retryFunc, [suite]); - }); - - it('should submit candidate with same suite for different browsers', function() { - var suite = { - fullName: 'test_name' - }, - firstCandidate = { - browserId: 'browser', - suite: suite - }, - secondCandidate = { - browserId: 'anotherBrowser', - suite: suite, - equal: false - }, - failCollector = createFailCollector_({ - browser: 1, - anotherBrowser: 1 - }), - retryFunc = sandbox.spy().named('retryFunc'); - - failCollector.tryToSubmitError(firstCandidate); - failCollector.tryToSubmitError(secondCandidate); - failCollector.retry(retryFunc); - - assert.calledWithMatch(retryFunc, [{ - fullName: 'test_name', - browsers: ['browser', 'anotherBrowser'] - }]); - }); - }); - - describe('tryToSubmitStateResult', function() { - it('should not submit candidate with missing `equal` property', function() { - var failCollector = createFailCollector_(); - - assert.equal(failCollector.tryToSubmitStateResult(candidate), false); - }); - - it('should not submit candidate with no diff', function() { - var failCollector = createFailCollector_(), - candidate = { - browserId: 'browser', - suite: {}, - equal: true - }; - - assert.equal(failCollector.tryToSubmitStateResult(candidate), false); - }); - - it('should submit candidate in case of diff', function() { - var failCollector = createFailCollector_(), - candidate = { - browserId: 'browser', - suite: {}, - equal: false - }; - - assert.equal(failCollector.tryToSubmitStateResult(candidate), true); - }); - }); - - describe('retry', function() { - it('should call `retry performer` function if suites for retry were added', function() { - var failCollector = createFailCollector_(), - retryFunc = sandbox.spy(); - - failCollector.tryToSubmitError(candidate); - failCollector.retry(retryFunc); - - assert.calledOnce(retryFunc); - }); - - it('should return result of `retry performer` function', function() { - var failCollector = createFailCollector_(), - retryFunc = sandbox.stub(); - - failCollector.tryToSubmitError(candidate); - retryFunc.returns('foo'); - - assert.equal(failCollector.retry(retryFunc), 'foo'); - }); - - it('should not call `retry performer` function if suites for retry are not added', function() { - var failCollector = createFailCollector_(), - retryFunc = sandbox.stub(); - - failCollector.retry(retryFunc); - - assert.notCalled(retryFunc); - }); - - it('should return resolved promise if suites for retry are not added', function() { - var failCollector = createFailCollector_(); - - return assert.isFulfilled(failCollector.retry()); - }); - - it('should pass suites to retry to `retry performer` function', function() { - var failCollector = createFailCollector_(), - suite = { - fullName: 'test_suite' - }, - candidate = { - browserId: 'browser', - suite: suite - }, - retryFunc = sandbox.stub().named('retryFunc'); - - failCollector.tryToSubmitError(candidate); - failCollector.retry(retryFunc); - - var suites = retryFunc.lastCall.args[0]; - - assert.lengthOf(suites, 1); - assert.include(suites, suite); - }); - - it('should clear previously submitted suites', function() { - var failCollector = createFailCollector_({ - browser: 10 - }), - firstSuite = { - fullName: 'first_suite' - }, - firstCandidate = { - browserId: 'browser', - suite: firstSuite - }, - secondSuite = { - fullName: 'second_suite' - }, - secondCandidate = { - browserId: 'browser', - suite: secondSuite - }, - retryFunc = sandbox.stub(); - - failCollector.tryToSubmitError(firstCandidate); - failCollector.retry(_.noop); - - failCollector.tryToSubmitError(secondCandidate); - failCollector.retry(retryFunc); - - var suitesToRetry = retryFunc.lastCall.args[0]; - - assert.notInclude(suitesToRetry, firstSuite); - assert.include(suitesToRetry, secondSuite); - }); - - it('should increase performed retries counter', function() { - var failCollector = createFailCollector_({ - browser: 10 - }), - onRetry = sandbox.stub(); - - failCollector.on('retry', onRetry); - failCollector.retry(_.noop); - failCollector.tryToSubmitError(candidate); - - assert.calledWithMatch(onRetry, {attempt: 1}); - }); - }); -}); - -function createFailCollector_(defaults) { - defaults = defaults || {browser: 1}; - - return new FailCollector(createConfig_(defaults)); -} - -function createConfig_(defaults) { - var config = sinon.createStubInstance(Config); - - _.forEach(defaults, function(retries, browserId) { - config.forBrowser.withArgs(browserId).returns({retry: retries}); - }); - - return config; -} diff --git a/test/unit/gemini.js b/test/unit/gemini.js new file mode 100644 index 000000000..97c2fccbe --- /dev/null +++ b/test/unit/gemini.js @@ -0,0 +1,626 @@ +'use strict'; + +const EventEmitter = require('events').EventEmitter; +const _ = require('lodash'); +const proxyquire = require('proxyquire'); +const Promise = require('bluebird'); +const pluginsLoader = require('plugins-loader'); + +const Config = require('lib/config'); +const Runner = require('lib/runner'); +const Events = require('lib/constants/events'); +const SuiteCollection = require('lib/suite-collection'); +const {temp} = require('gemini-core'); + +const mkSuiteStub = require('../util').makeSuiteStub; +const mkStateStub = require('../util').makeStateStub; + +describe('gemini', () => { + const sandbox = sinon.sandbox.create(); + + let Gemini; + let gemini; + let testReaderStub; + let signalHandler; + + const stubBrowsers = (browserIds) => { + return browserIds.reduce((fakeBrowsers, browser) => { + return _.set(fakeBrowsers, browser, {desiredCapabilities: {}}); + }, {}); + }; + + const initGemini = (opts) => { + opts = opts || {}; + + opts.rootSuite = opts.rootSuite || mkSuiteStub(); + + testReaderStub = sandbox.stub().named('TestReader').returns(Promise.resolve(opts.rootSuite)); + signalHandler = new EventEmitter(); + + Gemini = proxyquire('lib/gemini', { + './test-reader': testReaderStub, + './signal-handler': signalHandler + }); + + return new Gemini({ + rootUrl: 'http://localhost', + system: { + projectRoot: 'stub/project/root', + tempDir: opts.tempDir || 'stub/temp/dir', + plugins: opts.plugins || {} + }, + browsers: opts.browserIds ? stubBrowsers(opts.browserIds) : [] + }); + }; + + const runGeminiTest = (opts) => { + opts = _.defaults(opts || {}, { + browserIds: [] + }); + + gemini = initGemini(opts); + gemini.config.sets = opts.sets; + + return gemini.test([], opts.cliOpts); + }; + + beforeEach(() => { + sandbox.stub(Runner.prototype, 'cancel'); + sandbox.stub(console, 'warn'); + sandbox.stub(console, 'error'); + sandbox.stub(pluginsLoader, 'load'); + sandbox.stub(temp, 'init'); + }); + + afterEach(() => sandbox.restore()); + + [ + Events.START_RUNNER, + Events.END_RUNNER, + Events.BEGIN, + Events.END, + + Events.RETRY, + + Events.START_BROWSER, + Events.STOP_BROWSER, + + Events.BEGIN_SUITE, + Events.END_SUITE, + + Events.SKIP_STATE, + Events.BEGIN_STATE, + Events.END_STATE, + + Events.INFO, + Events.ERROR, + + Events.TEST_RESULT, + Events.UPDATE_RESULT + ].forEach((event) => { + it(`should passthrough '${event}' runner event`, () => { + const runner = new EventEmitter(); + runner.run = () => { + runner.emit(event, 'foo'); + return Promise.resolve(); + }; + sandbox.stub(Runner, 'create').returns(runner); + + const gemini = initGemini({}); + const spy = sinon.spy(); + gemini.on(event, spy); + + return gemini.test() + .then(() => assert.calledOnceWith(spy, 'foo')); + }); + }); + + it('should return statistic after the tests are completed', () => { + sandbox.stub(Runner.prototype, 'run').callsFake(function() { + this.emit(Events.END, {foo: 'bar'}); + return Promise.resolve(); + }); + const gemini = initGemini({}); + + return gemini.test() + .then((stats) => assert.deepEqual(stats, {foo: 'bar'})); + }); + + describe('load plugins', () => { + it('should load plugins on construction', () => { + initGemini(); + + assert.calledOnce(pluginsLoader.load); + }); + + it('should load plugins for gemini instance', () => { + const gemini = initGemini(); + + assert.calledWith(pluginsLoader.load, gemini); + }); + + it('should fail on plugin load error', () => { + pluginsLoader.load.throws(new Error('o.O')); + + assert.throws(() => initGemini(), /o.O/); + }); + + it('should load plugins from config', () => { + initGemini({plugins: {'some-plugin': true}}); + + assert.calledWith(pluginsLoader.load, sinon.match.any, {'some-plugin': true}); + }); + + it('should load plugins with appropriate prefix', () => { + const prefix = require('../../package').name + '-'; + + initGemini(); + + assert.calledWith(pluginsLoader.load, sinon.match.any, sinon.match.any, prefix); + }); + }); + + describe('extendCli', () => { + it ('should emit CLI event with passed parser', () => { + const gemini = initGemini({}); + const onCli = sinon.spy().named('onCli'); + const parser = {foo: 'bar'}; + + gemini.on(Events.CLI, onCli); + + gemini.extendCli(parser); + + assert.calledOnceWith(onCli, parser); + }); + }); + + describe('readTests', () => { + const readTests_ = (rootSuite, options) => { + gemini = initGemini({rootSuite}); + + return gemini.readTests(null, options); + }; + + beforeEach(() => { + sandbox.stub(Config.prototype); + + Config.prototype.getBrowserIds.returns([]); + }); + + describe('INIT', () => { + it('should emit INIT event on reading', () => { + const onInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, onInit); + + return gemini.readTests() + .then(() => assert.calledOnce(onInit)); + }); + + it('should wait INIT handler before reading any test', () => { + const afterInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, () => Promise.delay(10).then(afterInit)); + + return gemini.readTests() + .then(() => assert.callOrder(afterInit, testReaderStub)); + }); + + it('should fail on INIT handler reject', () => { + gemini = initGemini() + .on(Events.INIT, () => Promise.reject('o.O')); + + return assert.isRejected(gemini.readTests(), /o.O/); + }); + + it('should emit INIT only once', () => { + const onInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, onInit); + + return gemini.readTests() + .then(() => gemini.readTests()) + .then(() => assert.calledOnce(onInit)); + }); + }); + + it('should pass sets from cli to test-reader', () => { + const opts = { + cliOpts: {sets: ['set1']} + }; + + return runGeminiTest(opts) + .then(() => { + assert.calledWithMatch(testReaderStub, + sinon.match.any, + sinon.match.any, + sinon.match({sets: ['set1']}) + ); + }); + }); + + it('should pass browsers from cli to test-reader', () => { + const opts = { + cliOpts: {browsers: ['bro1']} + }; + + return runGeminiTest(opts) + .then(() => { + assert.calledWithMatch(testReaderStub, + sinon.match.any, + sinon.match.any, + sinon.match({browsers: ['bro1']}) + ); + }); + }); + + it('should return SuiteCollection instance', () => { + return readTests_() + .then((result) => assert.instanceOf(result, SuiteCollection)); + }); + + it('should emit AFTER_TESTS_READ event with created suite collection', () => { + const onAfterTestRead = sinon.spy(); + gemini = initGemini(); + gemini.on(Events.AFTER_TESTS_READ, onAfterTestRead); + + return gemini.readTests() + .then((suiteCollection) => assert.calledOnceWith(onAfterTestRead, {suiteCollection})); + }); + + it('should add to suite collection all read tests excluding root', () => { + const parent = mkSuiteStub(); + const child = mkSuiteStub({parent: parent}); + const anotherChild = mkSuiteStub({parent: parent}); + + parent.addChild(child); + parent.addChild(anotherChild); + + return readTests_(parent) + .then((collection) => { + const allSuites = collection.allSuites(); + + assert.notInclude(allSuites, parent); + assert.include(allSuites, child); + assert.include(allSuites, anotherChild); + }); + }); + + it('should grep leaf suites by fullname', () => { + const grandParent = mkSuiteStub(); + const parent = mkSuiteStub({parent: grandParent}); + grandParent.addChild(parent); + const matchingChild = mkSuiteStub({ + states: [mkStateStub()], + name: 'ok', + parent: parent + }); + const nonMatchingChild = mkSuiteStub({ + states: [mkStateStub()], + name: 'fail', + parent: parent + }); + parent.addChild(matchingChild); + parent.addChild(nonMatchingChild); + + return readTests_(parent, {grep: /ok/}) + .then((collection) => { + const allSuites = collection.allSuites(); + + assert.include(allSuites, matchingChild); + assert.notInclude(allSuites, nonMatchingChild); + }); + }); + + it('should remove tree branch if it does not have leaf suites', () => { + const grandParent = mkSuiteStub(); + const parent = mkSuiteStub({parent: grandParent}); + const nonMatchingBranchRoot = mkSuiteStub({ + name: 'nonMatchingBranchRoot', + parent: parent + }); + const nonMatchingBranchLeaf = mkSuiteStub({ + states: [mkStateStub()], + name: 'nonMatchingBranchLeaf', + parent: nonMatchingBranchRoot + }); + + return readTests_(grandParent, {grep: /matchingBranchLeaf/}) + .then((collection) => { + const allSuites = collection.allSuites(); + + assert.notInclude(allSuites, nonMatchingBranchRoot); + assert.notInclude(allSuites, nonMatchingBranchLeaf); + }); + }); + + it('should keep in tree branch that have matching leaf suites', () => { + const grandParent = mkSuiteStub(); + const parent = mkSuiteStub({parent: grandParent}); + grandParent.addChild(parent); + const matchingBranchRoot = mkSuiteStub({ + name: 'matchingBranchRoot', + parent: parent + }); + parent.addChild(matchingBranchRoot); + const matchingBranchLeaf = mkSuiteStub({ + states: [mkStateStub()], + name: 'matchingBranchLeaf', + parent: matchingBranchRoot + }); + matchingBranchRoot.addChild(matchingBranchLeaf); + + return readTests_(grandParent, {grep: /matchingBranchLeaf/}) + .then((collection) => { + const allSuites = collection.allSuites(); + + assert.include(allSuites, matchingBranchRoot); + assert.include(allSuites, matchingBranchLeaf); + }); + }); + }); + + describe('test', () => { + beforeEach(() => { + sandbox.stub(Runner.prototype, 'run').returns(Promise.resolve()); + }); + + it('should initialize temp with specified temp dir', () => { + return runGeminiTest({tempDir: '/some/dir'}) + .then(() => assert.calledOnceWith(temp.init, '/some/dir')); + }); + + it('should initialize temp before start runner', () => { + return runGeminiTest() + .then(() => { + assert.callOrder( + temp.init, + Runner.prototype.run + ); + }); + }); + + it('should emit AFTER_TESTS_READ event with suite collection', () => { + const onAfterTestRead = sinon.spy(); + gemini = initGemini(); + gemini.on(Events.AFTER_TESTS_READ, onAfterTestRead); + + return gemini.test() + .then(() => assert.calledOnceWith(onAfterTestRead, {suiteCollection: sinon.match.instanceOf(SuiteCollection)})); + }); + + describe('INIT', () => { + it('should emit INIT event on run', () => { + const onInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, onInit); + + return gemini.test() + .then(() => assert.calledOnce(onInit)); + }); + + it('should wait INIT handler before run', () => { + const afterInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, () => Promise.delay(10).then(afterInit)); + + return gemini.test() + .then(() => assert.callOrder(afterInit, Runner.prototype.run)); + }); + + it('should fail on INIT handler reject', () => { + gemini = initGemini() + .on(Events.INIT, () => Promise.reject('o.O')); + + return assert.isRejected(gemini.test(), /o.O/); + }); + + it('should emit INIT only once', () => { + const onInit = sinon.spy(); + + gemini = initGemini() + .on(Events.INIT, onInit); + + return gemini.test() + .then(() => gemini.test()) + .then(() => assert.calledOnce(onInit)); + }); + }); + }); + + describe('halt', () => { + let gemini; + + beforeEach(() => { + sandbox.stub(process, 'exit'); + sandbox.stub(Runner.prototype, 'run').callsFake(() => gemini.emitAndWait(Events.START_RUNNER)); + + gemini = initGemini(); + }); + + it('should throw provided error', () => { + gemini.on(Events.START_RUNNER, () => { + gemini.halt(new Error('test error')); + }); + + return assert.isRejected(gemini.test(), /Error: test error/); + }); + + it('should cancel test runner', () => { + gemini.on(Events.START_RUNNER, () => { + gemini.halt(new Error('test error')); + }); + + return gemini.test() + .catch(() => { + assert.calledOnce(Runner.prototype.cancel); + }); + }); + + describe('shutdown timeout', () => { + it('should force exit if timeout is reached', () => { + gemini.on(Events.START_RUNNER, () => { + gemini.halt(new Error('test error'), 250); + }); + + return gemini.test() + .catch(() => Promise.delay(300)) + .then(() => { + assert.calledWithMatch(console.error, /Forcing shutdown.../); + assert.calledOnceWith(process.exit, 1); + }); + }); + + it('should do nothing if timeout is set to zero', () => { + sandbox.spy(global, 'setTimeout'); + gemini.on(Events.START_RUNNER, () => { + gemini.halt(new Error('test error'), 0); + }); + + return gemini.test() + .catch(() => { + assert.notCalled(global.setTimeout); + }); + }); + }); + }); + + describe('environment variables', () => { + beforeEach(() => { + sandbox.stub(SuiteCollection.prototype, 'skipBrowsers'); + }); + + afterEach(() => { + delete process.env.GEMINI_BROWSERS; + delete process.env.GEMINI_SKIP_BROWSERS; + }); + + it('should use browsers from GEMINI_BROWSERS', () => { + process.env.GEMINI_BROWSERS = 'b1'; + + return runGeminiTest({browserIds: ['b1', 'b2']}) + .then(() => { + assert.calledWithMatch(testReaderStub, + sinon.match.any, + sinon.match.any, + {browsers: ['b1']} + ); + }); + }); + + it('should handle spaces in value of GEMINI_BROWSERS', () => { + process.env.GEMINI_BROWSERS = 'b1, b2'; + + return runGeminiTest({browserIds: ['b1', 'b2']}) + .then(() => { + assert.calledWithMatch(testReaderStub, + sinon.match.any, + sinon.match.any, + {browsers: ['b1', 'b2']} + ); + }); + }); + + it('should warn about unknown browsers in GEMINI_BROWSERS', () => { + process.env.GEMINI_BROWSERS = 'b1, b2'; + + return runGeminiTest({browserIds: ['b1']}) + .then(() => { + assert.calledWith(console.warn, sinon.match('Unknown browsers id: b2')); + }); + }); + + it('should skip browsers from GEMINI_SKIP_BROWSERS', () => { + process.env.GEMINI_SKIP_BROWSERS = 'b1'; + + return runGeminiTest({browserIds: ['b1', 'b2']}) + .then(() => assert.calledWith(SuiteCollection.prototype.skipBrowsers, ['b1'])); + }); + + it('should remove spaces from GEMINI_SKIP_BROWSERS', () => { + process.env.GEMINI_SKIP_BROWSERS = 'b1, b2'; + + return runGeminiTest({browserIds: ['b1', 'b2']}) + .then(() => assert.calledWith(SuiteCollection.prototype.skipBrowsers, ['b1', 'b2'])); + }); + + it('should warn about unknown browsers in GEMINI_SKIP_BROWSERS', () => { + process.env.GEMINI_SKIP_BROWSERS = 'b1,b2'; + + return runGeminiTest({browserIds: ['b1']}) + .then(() => assert.calledWith(console.warn, sinon.match('Unknown browsers id: b2'))); + }); + }); + + describe('readRawConfig', () => { + beforeEach(() => { + sandbox.stub(Config, 'readRawConfig'); + }); + + it('should read configuration object from file by given path', () => { + Config.readRawConfig + .withArgs('some/file/path') + .returns({foo: 'bar'}); + + assert.deepEqual(Gemini.readRawConfig('some/file/path'), {foo: 'bar'}); + }); + }); + + describe('on "INTERRUPT"', () => { + const stubRunner = (scenario) => { + sandbox.stub(Runner.prototype, 'run').callsFake(() => Promise.resolve(scenario())); + }; + + const emulateRunnerInterrupt = (exitCode) => stubRunner(() => signalHandler.emit(Events.INTERRUPT, {exitCode})); + + it('should emit "INTERRUPT" event from gemini', () => { + const gemini = initGemini(); + const onCancel = sinon.spy().named('onCancel'); + + emulateRunnerInterrupt(); + + gemini.on(Events.INTERRUPT, onCancel); + + return gemini.test() + .then(() => assert.calledOnce(onCancel)); + }); + + it('should pass exit code when emitting "INTERRUPT" event', () => { + const gemini = initGemini(); + const onCancel = sinon.spy().named('onCancel'); + + emulateRunnerInterrupt(130); + + gemini.on(Events.INTERRUPT, onCancel); + + return gemini.test() + .then(() => assert.calledWith(onCancel, {exitCode: 130})); + }); + + it('should cancel gemini runner', () => { + const gemini = initGemini(); + + emulateRunnerInterrupt(); + + return gemini.test() + .then(() => assert.calledOnce(Runner.prototype.cancel)); + }); + + it('should emit "INTERRUPT" event from gemini before cancelling of gemini runner', () => { + const gemini = initGemini(); + const onCancel = sinon.spy().named('onCancel'); + + emulateRunnerInterrupt(); + + gemini.on(Events.INTERRUPT, onCancel); + + return gemini.test() + .then(() => assert.callOrder(onCancel, Runner.prototype.cancel)); + }); + }); +}); diff --git a/test/unit/gemini.test.js b/test/unit/gemini.test.js deleted file mode 100644 index 586a2e81c..000000000 --- a/test/unit/gemini.test.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -var q = require('q'), - proxyquire = require('proxyquire'), - SuiteCollection = require('lib/suite-collection'), - Config = require('lib/config'), - Runner = require('lib/runner'), - temp = require('lib/temp'), - - mkSuiteStub = require('../util').makeSuiteStub; - -describe('gemini', function() { - var sandbox = sinon.sandbox.create(); - - afterEach(function() { - sandbox.restore(); - }); - - describe('readTests', function() { - function readTests_(rootSuite, grep) { - rootSuite = rootSuite || mkSuiteStub(); - - var testReaderStub = sandbox.stub().named('TestReader').returns(q(rootSuite)), - Gemini = proxyquire('lib/gemini', { - './test-reader': testReaderStub - }); - - return new Gemini({ - rootUrl: 'stubRootUrl', - system: {projectRoot: 'stubProjectRoot'} - }) - .readTests(null, grep); - } - - beforeEach(function() { - sandbox.stub(Config.prototype); - }); - - it('should return SuiteCollection instance', function() { - return readTests_() - .then(function(result) { - assert.instanceOf(result, SuiteCollection); - }); - }); - - it('should add to suite collection all read tests excluding root', function() { - var parent = mkSuiteStub(), - child = mkSuiteStub({parent: parent}), - anotherChild = mkSuiteStub({parent: parent}); - - return readTests_(parent) - .then(function(collection) { - var allSuites = collection.allSuites(); - - assert.notInclude(allSuites, parent); - assert.include(allSuites, child); - assert.include(allSuites, anotherChild); - }); - }); - - it('should grep leaf suites by fullname', function() { - var grandParent = mkSuiteStub(), - parent = mkSuiteStub({parent: grandParent}), - matchingChild = mkSuiteStub({ - states: [1], - name: 'ok', - parent: parent - }), - nonMatchingChild = mkSuiteStub({ - states: [1], - name: 'fail', - parent: parent - }); - - return readTests_(parent, /ok/) - .then(function(collection) { - var allSuites = collection.allSuites(); - - assert.include(allSuites, matchingChild); - assert.notInclude(allSuites, nonMatchingChild); - }); - }); - - it('should remove tree branch if it does not have leaf suites', function() { - var grandParent = mkSuiteStub(), - parent = mkSuiteStub({parent: grandParent}), - nonMatchingBranchRoot = mkSuiteStub({ - name: 'nonMatchingBranchRoot', - parent: parent - }), - nonMatchingBranchLeaf = mkSuiteStub({ - states: [1], - name: 'nonMatchingBranchLeaf', - parent: nonMatchingBranchRoot - }); - - return readTests_(grandParent, /matchingBranchLeaf/) - .then(function(collection) { - var allSuites = collection.allSuites(); - - assert.notInclude(allSuites, nonMatchingBranchRoot); - assert.notInclude(allSuites, nonMatchingBranchLeaf); - }); - }); - - it('should keep in tree branch that have matching leaf suites', function() { - var grandParent = mkSuiteStub(), - parent = mkSuiteStub({parent: grandParent}), - matchingBranchRoot = mkSuiteStub({ - name: 'matchingBranchRoot', - parent: parent - }), - matchingBranchLeaf = mkSuiteStub({ - states: [1], - name: 'matchingBranchLeaf', - parent: matchingBranchRoot - }); - - return readTests_(grandParent, /matchingBranchLeaf/) - .then(function(collection) { - var allSuites = collection.allSuites(); - - assert.include(allSuites, matchingBranchRoot); - assert.include(allSuites, matchingBranchLeaf); - }); - }); - }); - - describe('test', function() { - beforeEach(function() { - sandbox.stub(temp); - }); - - function test_(opts) { - opts = opts || {}; - var Gemini = require('lib/gemini'); - - sandbox.stub(Runner.prototype); - Runner.prototype.on.returnsThis(); - Runner.prototype.run.returns(q()); - - return new Gemini({ - rootUrl: 'stubRootUrl', - system: { - projectRoot: 'stubProjectRoot', - tempDir: opts.tempDir - } - }) - .test([]); - } - - it('should initialize temp with specified temp dir', function() { - test_({tempDir: '/some/dir'}); - - assert.calledOnce(temp.init); - assert.calledWith(temp.init, '/some/dir'); - }); - - it('should initialize temp before start runner', function() { - return test_() - .then(function() { - assert.callOrder( - temp.init, - Runner.prototype.run - ); - }); - }); - }); -}); diff --git a/test/unit/image.test.js b/test/unit/image.test.js deleted file mode 100644 index a9fc0d384..000000000 --- a/test/unit/image.test.js +++ /dev/null @@ -1,145 +0,0 @@ -'use strict'; - -const PngImg = require('png-img'); -const utils = require('png-img/utils'); -const proxyquire = require('proxyquire'); - -const looksSameStub = sinon.stub(); -const Image = proxyquire('lib/image', { - 'looks-same': looksSameStub -}); - -describe('unit-image', () => { - const sandbox = sinon.sandbox.create(); - let image; - - beforeEach(() => { - // Image 1x1 pixel - const bufferString = `iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAA - CQd1PeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjw - v8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAMSUR - BVBhXY2BgYAAAAAQAAVzN/2kAAAAASUVORK5CYII=`; - const imgBuffer = new Buffer(bufferString, 'base64'); - - image = new Image(imgBuffer); - - sandbox.stub(PngImg.prototype, 'size').returns({width: 100500, height: 500100}); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('should crop image', () => { - sandbox.stub(PngImg.prototype, 'crop'); - - const rect = {top: 1, left: 2, width: 3, height: 4}; - - return image.crop(rect) - .then(() => { - assert.calledOnce(PngImg.prototype.crop); - assert.calledWith(PngImg.prototype.crop, 2, 1, 3, 4); - }); - }); - - it('should return correct size', () => { - PngImg.prototype.size.returns({w: 10, h: 20}); - const result = image.getSize(); - - assert.deepEqual(result, {w: 10, h: 20}); - }); - - it('should return RGBA', () => { - const color = {r: 123, g: 234, b: 231, a: 132}; - - sandbox.stub(PngImg.prototype, 'get').returns(color); - const result = image.getRGBA(0, 0); - - assert.calledWith(PngImg.prototype.get, 0, 0); - assert.deepEqual(result, color); - }); - - it('should clear a region of an image according to scale factor', () => { - sandbox.stub(PngImg.prototype, 'fill'); - - const clearArea = {top: 10, left: 20, width: 40, height: 30}; - const scaleOpts = {scaleFactor: 5}; - - image.clear(clearArea, scaleOpts); - - assert.calledWith(PngImg.prototype.fill, 20 * 5, 10 * 5, 40 * 5, 30 * 5, '#000000'); - }); - - it('should convert RGB to string', () => { - sandbox.stub(utils, 'RGBToString'); - - const rgb = {r: 111, g: 222, b: 123}; - - Image.RGBToString(rgb); - - assert.calledWith(utils.RGBToString, rgb); - }); - - it('should save file', () => { - const stubSave = sandbox.stub(PngImg.prototype, 'save').yields(); - - return image.save('some/path') - .then(() => { - assert.calledOnce(stubSave); - assert.calledWith(stubSave, 'some/path'); - }); - }); - - it('should join new image to current image', () => { - sandbox.stub(PngImg.prototype, 'insert'); - sandbox.stub(PngImg.prototype, 'setSize').returns(PngImg.prototype); - PngImg.prototype.size.returns({width: 150, height: 200}); - - image.join(image); - - assert.calledWith(PngImg.prototype.setSize, 150, 200 + 200); - assert.calledWith(PngImg.prototype.insert, sinon.match.any, 0, 200); - }); - - it('should compare two images', () => { - looksSameStub.yields(); - - return Image.compare('some/path', 'other/path', { - canHaveCaret: true, - tolerance: 250, - pixelRatio: 11 - }) - .then(() => { - assert.calledOnce(looksSameStub); - assert.calledWith(looksSameStub, 'some/path', 'other/path', { - ignoreCaret: true, - tolerance: 250, - pixelRatio: 11 - }); - }); - }); - - it('should build diff image', () => { - const createDiffStub = sinon.stub(); - looksSameStub.createDiff = createDiffStub; - createDiffStub.yields(); - - return Image.buildDiff({ - reference: 100, - current: 200, - diff: 500, - tolerance: 300, - diffColor: 400 - }) - .then(() => { - assert.calledOnce(createDiffStub); - assert.calledWith(createDiffStub, { - reference: 100, - current: 200, - diff: 500, - tolerance: 300, - highlightColor: 400 - }); - }); - }); -}); diff --git a/test/unit/image/safe-rect.js b/test/unit/image/safe-rect.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/unit/passthrough-emitter.js b/test/unit/passthrough-emitter.js new file mode 100644 index 000000000..c36bfd6b4 --- /dev/null +++ b/test/unit/passthrough-emitter.js @@ -0,0 +1,50 @@ +'use strict'; +const PassthroughEmitter = require('lib/passthrough-emitter'); + +describe('PassthroughEmitter', () => { + let runner, + child; + + beforeEach(function() { + runner = new PassthroughEmitter(); + child = new PassthroughEmitter(); + }); + + it('should emit event emitted by child', () => { + let onSomeEvent = sinon.spy(); + runner.on('some-event', onSomeEvent); + runner.passthroughEvent(child, 'some-event'); + + child.emit('some-event', 'some-data'); + + assert.calledWith(onSomeEvent, 'some-data'); + }); + + it('should emit all events emitted by child', () => { + let onSomeEvent = sinon.spy(), + onOtherEvent = sinon.spy(); + + runner.on('some-event', onSomeEvent); + runner.on('other-event', onOtherEvent); + runner.passthroughEvent(child, ['some-event', 'other-event']); + + child.emit('some-event', 'some-data'); + child.emit('other-event', 'other-data'); + + assert.calledWith(onSomeEvent, 'some-data'); + assert.calledWith(onOtherEvent, 'other-data'); + }); + + it('should not break promise chain on event emitted by emitAndWait', () => { + runner.passthroughEvent(child, 'some-event'); + runner.on('some-event', function() { + return 'some-data'; + }); + + return child.emitAndWait('some-event') + .then((data) => { + assert.equal(data, 'some-data'); + }); + }); +}); + diff --git a/test/unit/plugins.test.js b/test/unit/plugins.test.js deleted file mode 100644 index 61ed2f8e8..000000000 --- a/test/unit/plugins.test.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; -var plugins, - proxyquire = require('proxyquire'); - -describe('plugins', function() { - beforeEach(function() { - this.foobarPlugin = sinon.spy(); - this.gemini = sinon.spy(); - - plugins = proxyquire - .noCallThru() - .load('lib/plugins', { - 'gemini-foobar': this.foobarPlugin - }); - }); - - describe('load', function() { - it('should load plugin without prefix', function() { - var options = {system: {plugins: {foobar: true}}}; - plugins.load(this.gemini, options); - - assert.calledWith(this.foobarPlugin, this.gemini, {}); - }); - - it('should load plugin with prefix', function() { - var options = {system: {plugins: {'gemini-foobar': true}}}; - plugins.load(this.gemini, options); - - assert.calledWith(this.foobarPlugin, this.gemini, {}); - }); - - it('should throw error if plugin not found', function() { - var options = {system: {plugins: {'gemini-foo': true}}}; - - assert.throws(function() { - plugins.load(this.gemini, options); - }); - }); - - it('should not load disabled plugins', function() { - var options = {system: {plugins: {foobar: false}}}; - plugins.load(this.gemini, options); - - assert.notCalled(this.foobarPlugin); - }); - - it('should load plugin with empty configuration', function() { - var options = {system: {plugins: {foobar: {}}}}; - plugins.load(this.gemini, options); - - assert.calledWith(this.foobarPlugin, this.gemini, {}); - }); - - it('should handle empty plugins', function() { - var _this = this.gemini, - options = {system: {plugins: {}}}; - - assert.doesNotThrow(function() { - plugins.load(_this.gemini, options); - }); - }); - - it('should pass plugin its configuration', function() { - var options = {system: {plugins: {foobar: {foo: 'bar'}}}}; - plugins.load(this.gemini, options); - - assert.calledWith(this.foobarPlugin, this.gemini, {foo: 'bar'}); - }); - }); -}); diff --git a/test/unit/rect.test.js b/test/unit/rect.test.js deleted file mode 100644 index a221962c6..000000000 --- a/test/unit/rect.test.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -var Rect = require('lib/browser/client-scripts/rect').Rect; - -describe('Rect', function() { - describe('constructor', function() { - it('should create instance using width/height properties', function() { - assert.doesNotThrow(function() { - return new Rect({ - top: 10, - left: 20, - width: 100, - height: 100 - }); - }); - }); - - it('should create instance using bottom/right properties', function() { - assert.doesNotThrow(function() { - return new Rect({ - top: 10, - left: 20, - bottom: 100, - right: 100 - }); - }); - }); - - it('should fail when there are no bottom/right or width/height properties', function() { - assert.throws(function() { - return new Rect({top: 10, left: 20}); - }); - }); - }); - - describe('rectInside', function() { - var rect = new Rect({ - top: 10, - left: 20, - width: 100, - height: 100 - }); - - it('should return true when rect is inside', function() { - assert.isTrue(rect.rectInside( - new Rect({ - top: rect.top + 10, - left: rect.left + 10, - width: rect.width - 50, - height: rect.height - 50 - }) - )); - }); - - it('should return false when rect is not inside', function() { - assert.isFalse(rect.rectInside( - new Rect({ - top: rect.top - 5, - left: rect.left - 5, - width: rect.width, - height: rect.width - }) - )); - }); - }); -}); diff --git a/test/unit/reporters/flat-factory/flat-verbose.js b/test/unit/reporters/flat-factory/flat-verbose.js new file mode 100644 index 000000000..71cd54f50 --- /dev/null +++ b/test/unit/reporters/flat-factory/flat-verbose.js @@ -0,0 +1,64 @@ +'use strict'; + +const chalk = require('chalk'); + +const EventEmitter = require('events').EventEmitter; +const FlatVerboseReporter = require('lib/reporters/flat-factory/flat-verbose'); +const Events = require('lib/constants/events'); +const logger = require('lib/utils').logger; + +describe('Reporter#FlatVerbose', () => { + const sandbox = sinon.sandbox.create(); + let emitter; + + function getTestLog(test) { + emitter.emit(Events.BEGIN); + emitter.emit(Events.UPDATE_RESULT, test); + emitter.emit(Events.END, {}); + + return chalk + .stripColor(logger.log.firstCall.args[0]) + .substr(2); // remove first symbol (icon) + } + + beforeEach(() => { + const reporter = new FlatVerboseReporter(); + + emitter = new EventEmitter(); + reporter.attachRunner(emitter); + sandbox.stub(logger); + }); + + afterEach(() => { + sandbox.restore(); + emitter.removeAllListeners(); + }); + + it('should correctly do the rendering', () => { + const test = { + suite: { + path: ['block', 'size', 'big'], + shouldSkip: () => false + }, + state: {name: 'hover'}, + browserId: 'chrome', + sessionId: '0fc23des' + }; + + assert.equal(getTestLog(test), 'block size big hover [chrome: 0fc23des]'); + }); + + it('should not render session identifier for skipped tests', () => { + const test = { + suite: { + path: ['some-path'], skipped: {}, + shouldSkip: () => true + }, + state: {name: 'some-name'}, + browserId: 'chrome', + sessionId: '0fc23des' + }; + + assert.equal(getTestLog(test), 'some-path some-name [chrome]'); + }); +}); diff --git a/test/unit/reporters/flat-factory/flat.js b/test/unit/reporters/flat-factory/flat.js new file mode 100644 index 000000000..0da232282 --- /dev/null +++ b/test/unit/reporters/flat-factory/flat.js @@ -0,0 +1,94 @@ +'use strict'; + +const chalk = require('chalk'); + +const EventEmitter = require('events').EventEmitter; +const FlatReporter = require('lib/reporters/flat-factory/flat'); +const logger = require('lib/utils').logger; +const Events = require('lib/constants/events'); + +describe('Reporter#Flat', () => { + const sandbox = sinon.sandbox.create(); + + let test; + let emitter; + + const emit = (event, data) => { + emitter.emit(Events.BEGIN); + + if (event) { + emitter.emit(event, data); + } + + emitter.emit(Events.END, {}); + }; + + beforeEach(() => { + test = { + suite: {path: []}, + state: {name: 'test'}, + browserId: 0, + retriesLeft: 1 + }; + + const reporter = new FlatReporter(); + + emitter = new EventEmitter(); + reporter.attachRunner(emitter); + sandbox.stub(logger); + }); + + afterEach(() => { + sandbox.restore(); + emitter.removeAllListeners(); + }); + + describe('should print an error if it there is in', () => { + it('result', () => { + test.message = 'Error from result'; + + emit(Events.ERROR, test); + + assert.calledWith(logger.error, test.message); + }); + + it('originalError', () => { + test.originalError = {stack: 'Error from originalError'}; + + emit(Events.ERROR, test); + + assert.calledWith(logger.error, test.originalError.stack); + }); + }); + + it('should log result from stats', () => { + emit(Events.END, { + total: 15, + updated: 1, + passed: 2, + failed: 3, + skipped: 4, + retries: 5 + }); + + const deserealizedResult = chalk.stripColor(logger.log.firstCall.args[0]); + + assert.equal(deserealizedResult, 'Total: 15 Updated: 1 Passed: 2 Failed: 3 Skipped: 4 Retries: 5'); + }); + + it('should correctly do the rendering', () => { + test = { + suite: {path: ['block', 'size', 'big']}, + state: {name: 'hover'}, + browserId: 'chrome' + }; + + emit(Events.UPDATE_RESULT, test); + + const deserealizedResult = chalk + .stripColor(logger.log.firstCall.args[0]) + .substr(2); // remove first symbol (icon) + + assert.equal(deserealizedResult, 'block size big hover [chrome]'); + }); +}); diff --git a/test/unit/reporters/flat/flat-verbose.test.js b/test/unit/reporters/flat/flat-verbose.test.js deleted file mode 100644 index 8b2161545..000000000 --- a/test/unit/reporters/flat/flat-verbose.test.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var EventEmitter = require('events').EventEmitter, - FlatVerboseReporter = require('lib/reporters/flat-factory/flat-verbose'), - RunnerEvents = require('lib/constants/runner-events'), - logger = require('lib/utils').logger, - chalk = require('chalk'); - -describe('Reporter#FlatVerbose', function() { - var sandbox = sinon.sandbox.create(), - emitter; - - beforeEach(function() { - var reporter = new FlatVerboseReporter(); - - emitter = new EventEmitter(); - reporter.attachRunner(emitter); - sandbox.stub(logger); - }); - - afterEach(function() { - sandbox.restore(); - emitter.removeAllListeners(); - }); - - it('should correctly do the rendering', function() { - var test = { - suite: {path: ['block', 'size', 'big']}, - state: {name: 'hover'}, - browserId: 'chrome', - sessionId: '0fc23des' - }; - - emitter.emit(RunnerEvents.BEGIN); - emitter.emit(RunnerEvents.CAPTURE, test); - emitter.emit(RunnerEvents.END); - - var deserealizedResult = chalk - .stripColor(logger.log.firstCall.args[0]) - .substr(2); // remove first symbol (icon) - - assert.equal(deserealizedResult, 'block size big hover [chrome: 0fc23des]'); - }); -}); diff --git a/test/unit/reporters/flat/flat.test.js b/test/unit/reporters/flat/flat.test.js deleted file mode 100644 index 56c720f2e..000000000 --- a/test/unit/reporters/flat/flat.test.js +++ /dev/null @@ -1,172 +0,0 @@ -'use strict'; - -var EventEmitter = require('events').EventEmitter, - FlatReporter = require('lib/reporters/flat-factory/flat'), - RunnerEvents = require('lib/constants/runner-events'), - logger = require('lib/utils').logger, - chalk = require('chalk'); - -describe('Reporter#Flat', function() { - var sandbox = sinon.sandbox.create(), - test, - emitter; - - function getCounters(args) { - return { - total: chalk.stripColor(args[1]), - passed: chalk.stripColor(args[2]), - failed: chalk.stripColor(args[3]), - skipped: chalk.stripColor(args[4]), - retries: chalk.stripColor(args[5]) - }; - } - - function emit(event, data) { - emitter.emit(RunnerEvents.BEGIN); - if (event) { - emitter.emit(event, data); - } - emitter.emit(RunnerEvents.END); - } - - beforeEach(function() { - test = { - suite: {path: []}, - state: {name: 'test'}, - browserId: 0, - retriesLeft: 1 - }; - - var reporter = new FlatReporter(); - - emitter = new EventEmitter(); - reporter.attachRunner(emitter); - sandbox.stub(logger); - }); - - afterEach(function() { - sandbox.restore(); - emitter.removeAllListeners(); - }); - - it('should initialize counters with 0', function() { - emit(); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.total, 0); - assert.equal(counters.passed, 0); - assert.equal(counters.failed, 0); - assert.equal(counters.skipped, 0); - assert.equal(counters.retries, 0); - }); - - describe('should correctly calculate counters for', function() { - it('successed', function() { - emit(RunnerEvents.CAPTURE, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.total, 1); - assert.equal(counters.passed, 1); - assert.equal(counters.failed, 0); - assert.equal(counters.skipped, 0); - }); - - it('failed', function() { - emit(RunnerEvents.ERROR, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.total, 1); - assert.equal(counters.passed, 0); - assert.equal(counters.failed, 1); - assert.equal(counters.skipped, 0); - }); - - describe('skipped', function() { - it('should increment skipped count on WARNING event', function() { - emit(RunnerEvents.WARNING, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.total, 1); - assert.equal(counters.skipped, 1); - }); - - it('should increment skipped count on SKIP_STATE event', function() { - emit(RunnerEvents.SKIP_STATE, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.total, 1); - assert.equal(counters.skipped, 1); - }); - }); - - it('retry', function() { - emit(RunnerEvents.RETRY, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.retries, 1); - }); - }); - - describe('should correctly choose a handler if `equal` is', function() { - it('true', function() { - test.equal = true; - - emit(RunnerEvents.END_TEST, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.passed, 1); - assert.equal(counters.failed, 0); - }); - it('false', function() { - test.equal = false; - - emit(RunnerEvents.END_TEST, test); - - var counters = getCounters(logger.log.lastCall.args); - - assert.equal(counters.passed, 0); - assert.equal(counters.failed, 1); - }); - }); - - describe('should print an error if it there is in', function() { - it('result', function() { - test.message = 'Error from result'; - - emit(RunnerEvents.ERROR, test); - - assert.calledWith(logger.error, test.message); - }); - - it('originalError', function() { - test.originalError = {stack: 'Error from originalError'}; - - emit(RunnerEvents.ERROR, test); - - assert.calledWith(logger.error, test.originalError.stack); - }); - }); - - it('should correctly do the rendering', function() { - test = { - suite: {path: ['block', 'size', 'big']}, - state: {name: 'hover'}, - browserId: 'chrome' - }; - - emit(RunnerEvents.CAPTURE, test); - - var deserealizedResult = chalk - .stripColor(logger.log.firstCall.args[0]) - .substr(2); // remove first symbol (icon) - - assert.equal(deserealizedResult, 'block size big hover [chrome]'); - }); -}); diff --git a/test/unit/reporters/html/html.test.js b/test/unit/reporters/html/html.test.js deleted file mode 100644 index 622ec96ba..000000000 --- a/test/unit/reporters/html/html.test.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -const EventEmitter = require('events').EventEmitter; -const HtmlReporter = require('lib/reporters/html/index.js'); -const RunnerEvents = require('lib/constants/runner-events'); -const logger = require('lib/utils').logger; -const chalk = require('chalk'); -const path = require('path'); -const view = require('lib/reporters/html/view'); - -describe('HTML Reporter', () => { - const sandbox = sinon.sandbox.create(); - let emitter; - - beforeEach(() => { - sandbox.stub(view, 'save'); - - emitter = new EventEmitter(); - - // calling constructor for its side effect - new HtmlReporter(emitter); // jshint ignore:line - }); - - afterEach(() => sandbox.restore()); - - it('should log correct path to html report', () => { - sandbox.stub(logger, 'log'); - - emitter.emit(RunnerEvents.END); - - const reportPath = `file://${path.resolve('gemini-report/index.html')}`; - assert.calledWith(logger.log, `Your HTML report is here: ${chalk.yellow(reportPath)}`); - }); -}); diff --git a/test/unit/reporters/utils/test-counter.js b/test/unit/reporters/utils/test-counter.js deleted file mode 100644 index 086be1bf2..000000000 --- a/test/unit/reporters/utils/test-counter.js +++ /dev/null @@ -1,129 +0,0 @@ -'use strict'; - -var TestCounter = require('lib/reporters/utils/test-counter'); - -describe('TestCounter', function() { - var counter; - - beforeEach(function() { - counter = new TestCounter(); - }); - - describe('onPassed', function() { - testCounter_('Passed'); - }); - - describe('onFailed', function() { - testCounter_('Failed'); - }); - - describe('onSkipped', function() { - testCounter_('Skipped'); - }); - - describe('onRetry', function() { - it('should increase `retries` count', function() { - var completed = mkCompleted_({state: 'defaultState'}); - - counter.onRetry(completed); - - assert.equal(counter.getResult().retries, 1); - }); - - it('should clear stats for retried suite', function() { - var completed = mkCompleted_({state: 'defaultState'}); - - counter.onPassed(completed); - counter.onRetry(completed); - - assert.equal(counter.getResult().passed, 0); - }); - }); - - describe('getResult', function() { - it('should return object with collected results', function() { - var result = counter.getResult(); - - ['passed', 'failed', 'skipped', 'retries', 'total'].forEach(function(key) { - assert.property(result, key); - }); - }); - - it('should calculate total from `passed`, `failed` and `skipped`', function() { - var passed = mkCompleted_({state: 'passed'}), - failed = mkCompleted_({state: 'failed'}), - skipped = mkCompleted_({state: 'skipped'}); - - counter.onPassed(passed); - counter.onFailed(failed); - counter.onSkipped(skipped); - - assert.equal(counter.getResult().total, 3); - }); - - it('should not add retries to total', function() { - var passed = mkCompleted_({state: 'some_state'}), - retried = mkCompleted_({ - state: 'some_other_state', - browserId: 'some_browser' - }); - - counter.onPassed(passed); - counter.onRetry(retried); - - assert.equal(counter.getResult().total, 1); - }); - }); -}); - -function testCounter_(name) { - it('should count test result if it has state', function() { - var completed = mkCompleted_({state: 'defaultState'}), - counter = new TestCounter(); - - counter['on' + name](completed); - - assert.equal(counter.getResult()[name.toLowerCase()], 1); - }); - - it('should count test result if it does not have state', function() { - var completed = mkCompleted_({state: undefined}), - counter = new TestCounter(); - - counter['on' + name](completed); - - assert.equal(counter.getResult()[name.toLowerCase()], 1); - }); - - it('should not count test result if it does not have state or suite', function() { - var completed = {browserId: 'some_browser'}, - counter = new TestCounter(); - - counter['on' + name](completed); - - assert.equal(counter.getResult()[name.toLowerCase()], 0); - }); - - it('should not count test result twice for same suite and browser', function() { - var counter = new TestCounter(), - completed = mkCompleted_({ - browserId: 'test_browser', - state: 'test_state' - }); - - counter['on' + name](completed); - counter['on' + name](completed); - - assert.equal(counter.getResult()[name.toLowerCase()], 1); - }); -} - -function mkCompleted_(opts) { - opts = opts || {}; - - return { - suite: {fullName: 'default_suite'}, - browserId: opts.browserId || 'default_browser', - state: opts.state && {name: opts.state} - }; -} diff --git a/test/unit/runner/browser-runner/browser-agent.js b/test/unit/runner/browser-runner/browser-agent.js deleted file mode 100644 index 7727c31ff..000000000 --- a/test/unit/runner/browser-runner/browser-agent.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -var BrowserAgent = require('lib/runner/browser-runner/browser-agent'), - BasicPool = require('lib/browser-pool/basic-pool'); - -describe('runner/browser-runner/browser-agent', function() { - var sandbox = sinon.sandbox.create(), - browserPool; - - beforeEach(function() { - browserPool = sinon.createStubInstance(BasicPool); - }); - - afterEach(function() { - sandbox.restore(); - }); - - it('should return browser associated with agent', function() { - var browserAgent = BrowserAgent.create('browser', browserPool); - - browserAgent.getBrowser(); - - assert.calledWith(browserPool.getBrowser, 'browser'); - }); - - it('should free passed browser', function() { - var browserAgent = BrowserAgent.create(undefined, browserPool), - browser = sinon.spy().named('browser'); - - browserAgent.freeBrowser(browser); - - assert.calledWith(browserPool.freeBrowser, browser); - }); -}); diff --git a/test/unit/runner/browser-runner/index.js b/test/unit/runner/browser-runner/index.js index 7345bc02c..567407b33 100644 --- a/test/unit/runner/browser-runner/index.js +++ b/test/unit/runner/browser-runner/index.js @@ -1,215 +1,181 @@ 'use strict'; -var q = require('q'), - BrowserRunner = require('lib/runner/browser-runner'), - BrowserAgent = require('lib/runner/browser-runner/browser-agent'), - SuiteRunner = require('lib/runner/suite-runner/suite-runner'), - suiteRunnerFabric = require('lib/runner/suite-runner'), - pool = require('lib/browser-pool'), - BasicPool = require('lib/browser-pool/basic-pool'), - Config = require('lib/config'), - - makeSuiteStub = require('../../../util').makeSuiteStub; - -describe('runner/BrowserRunner', function() { - var sandbox = sinon.sandbox.create(), - suiteRunner; - - beforeEach(function() { + +const _ = require('lodash'); +const Promise = require('bluebird'); +const BrowserAgent = require('gemini-core').BrowserAgent; +const BrowserRunner = require('lib/runner/browser-runner'); +const SuiteRunner = require('lib/runner/suite-runner/suite-runner'); +const suiteRunnerFabric = require('lib/runner/suite-runner'); +const createSuite = require('lib/suite').create; +const Config = require('lib/config'); +const SuiteCollection = require('lib/suite-collection'); + +const makeSuiteStub = require('../../../util').makeSuiteStub; + +describe('runner/BrowserRunner', () => { + const sandbox = sinon.sandbox.create(); + + let suiteRunner; + + beforeEach(() => { suiteRunner = sinon.createStubInstance(SuiteRunner); - suiteRunner.run.returns(q.resolve()); + suiteRunner.run.returns(Promise.resolve()); sandbox.stub(suiteRunnerFabric, 'create'); suiteRunnerFabric.create.returns(suiteRunner); - - sandbox.stub(BrowserAgent.prototype); }); - afterEach(function() { - sandbox.restore(); - }); + afterEach(() => sandbox.restore()); + + const mkRunner_ = (browser, config) => { + const configStub = sinon.createStubInstance(Config); + const browserConfig = _.get(config, 'browser', {}); + const browserPool = {}; + configStub.forBrowser.returns(browserConfig); - function mkRunner_(browser, browserPool) { return BrowserRunner.create( browser || 'default-browser', - sinon.createStubInstance(Config), - browserPool || sinon.createStubInstance(BasicPool) + configStub, + browserPool ); - } - - describe('constructor', function() { - it('should create browser agent associated with passed browser id', function() { - var browserPool = sinon.createStubInstance(BasicPool); + }; - mkRunner_('browser', browserPool); + describe('run', () => { + let suiteCollection; - assert.calledWith(BrowserAgent.prototype.__constructor, 'browser', browserPool); - }); - }); - - describe('run', function() { - it('should emit `startBrowser` event when starting browser', function() { - var onStartBrowser = sinon.spy().named('onStartBrowser'), - runner = mkRunner_('browser'); - runner.on('startBrowser', onStartBrowser); - - return runner.run([]) - .then(function() { - assert.calledWith(onStartBrowser, {browserId: 'browser'}); - }); + beforeEach(() => { + suiteCollection = { + clone: () => suiteCollection, + allSuites: () => [] + }; }); - it('should run only suites expected to be run in current browser', function() { - var someSuite = makeSuiteStub({browsers: ['browser1', 'browser2']}), - suites = [ - someSuite, - makeSuiteStub({browsers: ['browser2']}) - ]; + it('should run only suites expected to be run in current browser', () => { + const someSuite = makeSuiteStub({browsers: ['browser1', 'browser2']}); + const suiteCollection = new SuiteCollection([ + someSuite, + makeSuiteStub({browsers: ['browser2']}) + ]); + const runner = mkRunner_('browser1'); - var runner = mkRunner_('browser1'); - - return runner.run(suites) - .then(function() { + return runner.run(suiteCollection) + .then(() => { assert.calledOnce(suiteRunnerFabric.create); - assert.calledWith(suiteRunnerFabric.create, someSuite); + assert.calledWithMatch(suiteRunnerFabric.create, someSuite); }); }); - it('should pass to suite runner browser agent associated with current browser', function() { - var browserAgent = new BrowserAgent('browser'), - suites = [makeSuiteStub({browsers: ['browser']})]; + it('should pass to suite runner browser agent associated with current browser', () => { + const browserAgent = new BrowserAgent('browser'); + const suiteCollection = new SuiteCollection([makeSuiteStub({browsers: ['browser']})]); sandbox.stub(BrowserAgent, 'create'); BrowserAgent.create.returns(browserAgent); - var runner = mkRunner_('browser'); + const runner = mkRunner_('browser'); - return runner.run(suites) - .then(function() { - assert.calledWith(suiteRunnerFabric.create, sinon.match.any, browserAgent); - }); + return runner.run(suiteCollection) + .then(() => assert.calledWith(suiteRunnerFabric.create, sinon.match.any, browserAgent)); }); - it('should passthrough stateProcessor to suite runner', function() { - var suites = [makeSuiteStub({browsers: ['browser']})], - runner = mkRunner_('browser'); - - return runner.run(suites, 'stateProcessor') - .then(function() { - assert.calledWith(suiteRunner.run, 'stateProcessor'); + it('should create browser agent instance for each suite', () => { + const suiteCollection = new SuiteCollection([ + makeSuiteStub({browsers: ['bro']}), + makeSuiteStub({browsers: ['bro']}) + ]); + sandbox.spy(BrowserAgent, 'create'); + + return mkRunner_('bro') + .run(suiteCollection) + .then(() => { + assert.calledTwice(BrowserAgent.create); + assert.notEqual( + suiteRunnerFabric.create.firstCall.args[1], + suiteRunnerFabric.create.secondCall.args[1] + ); }); }); - it('should not run suites after cancel', function() { - var runner = mkRunner_('browser'), - suites = [ - {browsers: ['browser']} - ]; - runner.cancel(); + it('should passthrough stateProcessor to suite runner', () => { + const suiteCollection = new SuiteCollection([makeSuiteStub({browsers: ['browser']})]); + const runner = mkRunner_('browser'); - return runner.run(suites) - .then(function() { - assert.notCalled(suiteRunner.run); - }); + return runner.run(suiteCollection, 'stateProcessor') + .then(() => assert.calledWith(suiteRunner.run, 'stateProcessor')); }); - it('should cancel suite runners on cancel', function() { - var runner = mkRunner_('browser'), - suites = [ - makeSuiteStub({browsers: ['browser']}), - makeSuiteStub({browsers: ['browser']}) - ]; + it('should cancel suite runners on cancel', () => { + const runner = mkRunner_('browser'); + const suiteCollection = new SuiteCollection([ + makeSuiteStub({browsers: ['browser']}), + makeSuiteStub({browsers: ['browser']}) + ]); - return runner.run(suites) - .then(function() { + return runner.run(suiteCollection) + .then(() => { runner.cancel(); assert.calledTwice(suiteRunner.cancel); }); }); - it('should emit `stopBrowser` after all suites', function() { - var onStopBrowser = sinon.spy().named('onStopBrowser'), - runner = mkRunner_('browser'); - runner.on('startBrowser', onStopBrowser); - - return runner.run([]) - .then(function() { - assert.calledWith(onStopBrowser, {browserId: 'browser'}); - }); - }); - - it('should emit events in correct order', function() { - var startBrowser = sinon.spy().named('onStartBrowser'), - stopBrowser = sinon.spy().named('onStopBrowser'), - suites = [ - makeSuiteStub({browsers: ['browser']}) - ]; - - var runner = mkRunner_('browser'); - runner.on('startBrowser', startBrowser); - runner.on('stopBrowser', stopBrowser); - - return runner.run(suites) - .then(function() { - assert.callOrder( - startBrowser, - suiteRunner.run, - stopBrowser - ); - }); - }); - }); - - describe('critical error', function() { - it('should emit `criticalError` event on error', function() { - var onCriticalError = sinon.spy().named('onCriticalError'), - suites = [ - makeSuiteStub({browsers: ['browser']}) - ]; - - var runner = mkRunner_('browser'); - runner.on('criticalError', onCriticalError); - suiteRunner.run.onFirstCall().returns(q.reject(new Error('error'))); + describe('add "fullUrl" to suite', () => { + const makeChildSuiteStub = (browsers) => { + const parentSuite = makeSuiteStub(browsers); + return createSuite('child', parentSuite); + }; - return runner.run(suites) - .then(function() { - assert.calledOnce(onCriticalError); + const run_ = (opts) => { + _.defaults(opts || {}, { + browser: 'browser', + rootUrl: 'http://default/url' }); - }); - - it('should not emit `criticalError` if it was manually stopped', function() { - var onCriticalError = sinon.spy().named('onCriticalError'), - suites = [ - makeSuiteStub() - ], - runner = mkRunner_(); - - runner.on('criticalError', onCriticalError); - suiteRunner.run.onFirstCall().returns(q.reject(new pool.CancelledError())); - return runner.run(suites) - .then(function() { - assert.notCalled(onCriticalError); - }); - }); - - it('should pass suite and browser id as critical error event data', function() { - var onCriticalError = sinon.spy().named('onCriticalError'), - suite = makeSuiteStub({browsers: ['browser']}), - suites = [ - suite - ], - runner = mkRunner_('browser'); - - runner.on('criticalError', onCriticalError); - suiteRunner.run.onFirstCall().returns(q.reject(new Error('error'))); - - return runner.run(suites) - .then(function() { - var err = onCriticalError.firstCall.args[0]; - assert.equal(suite, err.suite); - assert.equal('browser', err.browserId); - }); + const config = {[opts.browser]: {rootUrl: opts.rootUrl}}; + + const someSuite = opts.suiteUrl + ? makeSuiteStub({browsers: [opts.browser], url: opts.suiteUrl}) + : makeChildSuiteStub({browsers: [opts.browser]}); + + const suiteCollection = new SuiteCollection([someSuite]); + const runner = mkRunner_(opts.browser, config); + + return runner.run(suiteCollection) + .then(() => suiteRunnerFabric.create.args[0][0]); // resolve with modified suite + }; + + it('should resolve url in runtime', () => { + return run_({rootUrl: 'http://localhost/', suiteUrl: 'testUrl'}) + .then((suite) => { + suite.url += '/?query=value'; + assert.equal(suite.fullUrl, '/testUrl/?query=value'); + }); + }); + + it('should not modify suite without "url" as own property', () => { + return run_({rootUrl: 'http://localhost/foo/bar/'}) + .then((suite) => assert.isUndefined(suite.fullUrl)); + }); + + it('should concatenate rootUrl and suiteUrl', () => { + return run_({rootUrl: 'http://localhost/foo/bar/', suiteUrl: 'testUrl'}) + .then((suite) => assert.equal(suite.fullUrl, '/foo/bar/testUrl')); + }); + + it('should concatenate with slash between rootUrl and suiteUrl', () => { + return run_({rootUrl: 'http://localhost/foo/baz', suiteUrl: 'testUrl'}) + .then((suite) => assert.equal(suite.fullUrl, '/foo/baz/testUrl')); + }); + + it('should remove consecutive slashes', () => { + return run_({rootUrl: 'http://localhost/foo/qux/', suiteUrl: '/testUrl'}) + .then((suite) => assert.equal(suite.fullUrl, '/foo/qux/testUrl')); + }); + + it('should cut latest slashes from url', () => { + return run_({rootUrl: 'http://localhost/foo/bat/', suiteUrl: 'testUrl//'}) + .then((suite) => assert.equal(suite.fullUrl, '/foo/bat/testUrl')); + }); }); }); }); diff --git a/test/unit/runner/index.js b/test/unit/runner/index.js new file mode 100644 index 000000000..1c77b217f --- /dev/null +++ b/test/unit/runner/index.js @@ -0,0 +1,538 @@ +'use strict'; + +const Promise = require('bluebird'); +const pool = require('lib/browser-pool'); +const Config = require('lib/config'); +const Events = require('lib/constants/events'); +const Coverage = require('lib/coverage'); +const Runner = require('lib/runner'); +const BrowserRunner = require('lib/runner/browser-runner'); +const StateProcessor = require('lib/state-processor/state-processor'); +const RunnerStats = require('lib/stats'); +const SuiteMonitor = require('lib/suite-monitor'); +const makeStateResult = require('../../util').makeStateResult; + +describe('runner', () => { + const sandbox = sinon.sandbox.create(); + + const createRunner = (opts) => { + opts = opts || {}; + + const config = opts.config || sinon.createStubInstance(Config); + config.getBrowserIds.returns(['default-bro']); + + const stateProcessor = opts.stateProcessor || sinon.createStubInstance(StateProcessor); + + return Runner.create(config, stateProcessor); + }; + + const run = (runner, suiteCollection) => runner.run(suiteCollection || {allSuites: sinon.stub()}); + + const stubConfig = (opts) => { + const config = sinon.createStubInstance(Config); + + config.isCoverageEnabled.returns(opts.isCoverageEnabled); + config.system = {projectRoot: 'default'}; + + return config; + }; + + const stubBrowserRunner = (scenario) => { + BrowserRunner.prototype.run.callsFake(function() { + return Promise.resolve(scenario(this)); + }); + }; + + const stubBrowserPool = () => { + return { + getBrowser: sinon.stub(), + freeBrowser: sinon.stub(), + cancel: sinon.stub() + }; + }; + + beforeEach(() => { + const browserPool = stubBrowserPool(); + sandbox.stub(pool, 'create').returns(browserPool); + browserPool.cancel.returns(Promise.resolve()); + + sandbox.spy(Coverage, 'create'); + sandbox.stub(Coverage.prototype, 'processStats'); + sandbox.stub(Coverage.prototype, 'addStatsForBrowser'); + + sandbox.spy(SuiteMonitor, 'create'); + + sandbox.spy(BrowserRunner, 'create'); + sandbox.stub(BrowserRunner.prototype, 'run').returns(Promise.resolve()); + sandbox.stub(BrowserRunner.prototype, 'cancel'); + }); + + afterEach(() => sandbox.restore()); + + describe('constructor', () => { + it('should create browser pool', () => { + const runner = createRunner(); + + assert.calledOnce(pool.create); + assert.calledWith(pool.create, runner.config, runner); + }); + + it('should create "Coverage" instance if coverage is enabled', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + + assert.calledOnce(Coverage.create); + assert.calledWith(Coverage.create, runner.config); + }); + + it('should not create "Coverage" instance if coverage is disabled', () => { + createRunner({config: stubConfig({isCoverageEnabled: false})}); + + assert.notCalled(Coverage.create); + }); + + it('should create "SuiteMonitor" instance', () => { + const runner = createRunner(); + + assert.calledOnce(SuiteMonitor.create); + assert.calledWith(SuiteMonitor.create, runner); + }); + }); + + describe('run', () => { + describe('functionality', () => { + it('should emit "START_RUNNER" event', () => { + const runner = createRunner(); + const onStartRunner = sinon.spy().named('onStartRunner'); + + runner.on(Events.START_RUNNER, onStartRunner); + + return run(runner).then(() => assert.calledOnce(onStartRunner)); + }); + + it('should pass runner when emitting "START_RUNNER" event', () => { + const runner = createRunner(); + const onStartRunner = sinon.spy().named('onStartRunner'); + + runner.on(Events.START_RUNNER, onStartRunner); + + return run(runner).then(() => assert.calledWith(onStartRunner, runner)); + }); + + it('should wait until all "START_RUNNER" handlers have finished', () => { + const runner = createRunner(); + const onStartRunner = sinon.spy().named('onStartRunner'); + const onStartRannerWithDelay = () => Promise.delay(50).then(onStartRunner); + const onBegin = sinon.spy().named('onBegin'); + + runner.on(Events.START_RUNNER, onStartRannerWithDelay); + runner.on(Events.BEGIN, onBegin); + + return run(runner).then(() => assert.callOrder(onStartRunner, onBegin)); + }); + + it('should emit "BEGIN" event', () => { + const runner = createRunner(); + const onBegin = sinon.spy().named('onBegin'); + + runner.on(Events.BEGIN, onBegin); + + return run(runner).then(() => assert.calledOnce(onBegin)); + }); + + it('should pass suite collection on "BEGIN" event', () => { + const runner = createRunner(); + const suiteCollection = {allSuites: sinon.stub()}; + const onBegin = sinon.spy().named('onBegin'); + + runner.on(Events.BEGIN, onBegin); + + return run(runner, suiteCollection) + .then(() => assert.calledWithMatch(onBegin, {suiteCollection})); + }); + + it('should pass total number of states on "BEGIN" event', () => { + const runner = createRunner(); + const suiteCollection = {allSuites: sinon.stub()}; + const suites = [ + {states: []}, + {states: [1, 2]}, + {states: [3]} + ]; + const onBegin = sinon.spy().named('onBegin'); + + suiteCollection.allSuites.returns(suites); + + runner.on(Events.BEGIN, onBegin); + + return run(runner, suiteCollection).then(() => assert.calledWithMatch(onBegin, {totalStates: 3})); + }); + + it('should pass all browser ids on "BEGIN" event', () => { + const runner = createRunner(); + const onBegin = sinon.spy().named('onBegin'); + + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + runner.on(Events.BEGIN, onBegin); + + return run(runner).then(() => assert.calledWithMatch(onBegin, {browserIds: ['bro1', 'bro2']})); + }); + + it('should pass config on "BEGIN" event', () => { + const runner = createRunner(); + const config = runner.config; + const onBegin = sinon.spy().named('onBegin'); + + runner.on(Events.BEGIN, onBegin); + + return run(runner).then(() => assert.calledWithMatch(onBegin, {config})); + }); + + it('should prepare state processor before running of tests', () => { + const stateProcessor = sinon.createStubInstance(StateProcessor); + const runner = createRunner({stateProcessor}); + + return run(runner).then(() => assert.callOrder(stateProcessor.prepare, BrowserRunner.prototype.run)); + }); + + it('should create all browser runners', () => { + pool.create.returns('some-pool'); + + const runner = createRunner(); + const config = runner.config; + + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + return run(runner) + .then(() => { + assert.calledTwice(BrowserRunner.create); + + assert.calledWith(BrowserRunner.create, 'bro1', config, 'some-pool'); + assert.calledWith(BrowserRunner.create, 'bro2', config, 'some-pool'); + }); + }); + + it('should run tests in all browsers', () => { + const stateProcessor = sinon.createStubInstance(StateProcessor); + const runner = createRunner({stateProcessor}); + const suiteCollection = {allSuites: sinon.stub()}; + + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + return run(runner, suiteCollection) + .then(() => { + assert.calledTwice(BrowserRunner.prototype.run); + assert.alwaysCalledWith(BrowserRunner.prototype.run, suiteCollection, stateProcessor); + assert.notEqual( + BrowserRunner.prototype.run.firstCall.thisValue, + BrowserRunner.prototype.run.secondCall.thisValue + ); + }); + }); + + it('should aggregate statistic for all browsers', () => { + const emitStateResult_ = (name) => function() { + this.emit(Events.ERROR, makeStateResult({name})); + return Promise.resolve(); + }; + + BrowserRunner.prototype.run + .onFirstCall().callsFake(emitStateResult_('some-name')) + .onSecondCall().callsFake(emitStateResult_('other-name')); + + const runner = createRunner(); + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + let testsStatistic; + runner.on(Events.END, (stat) => testsStatistic = stat); + + return run(runner) + .then(() => assert.equal(testsStatistic.total, 2)); + }); + + it('should include tests state data emitted from main runner to the statistic', () => { + const runner = createRunner(); + + runner.emit(Events.ERROR, makeStateResult({name: 'some-name'})); + + let testsStatistic; + runner.on(Events.END, (stat) => testsStatistic = stat); + + return run(runner) + .then(() => assert.equal(testsStatistic.total, 1)); + }); + + it('should not be immediately rejected if running of tests in some browser was rejected', () => { + const runner = createRunner(); + const spy = sinon.spy(); + + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + BrowserRunner.prototype.run.onFirstCall().callsFake(() => Promise.reject()); + BrowserRunner.prototype.run.onSecondCall().callsFake(() => Promise.delay(50).then(spy)); + + return run(runner) + .catch(() => {}) + .then(() => assert.called(spy)); + }); + + it('should be rejected with the first error if running of tests in several browsers were rejected', () => { + const runner = createRunner(); + + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + BrowserRunner.prototype.run.onFirstCall().callsFake(() => Promise.reject('first-runner')); + BrowserRunner.prototype.run.onSecondCall().callsFake(() => Promise.reject('second-runner')); + + return assert.isRejected(run(runner), /first-runner/); + }); + + it('should collect coverage', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + + return run(runner).then(() => assert.calledOnce(Coverage.prototype.processStats)); + }); + + it('should be rejected if collecting of coverage fails', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + + Coverage.prototype.processStats.rejects(); + + return assert.isRejected(run(runner)); + }); + + it('should collect coverage after running of tests', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + + return run(runner) + .then(() => assert.callOrder(BrowserRunner.prototype.run, Coverage.prototype.processStats)); + }); + + it('should emit "END" event with tests statistic', () => { + sandbox.stub(RunnerStats.prototype, 'getResult').returns({foo: 'bar'}); + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + const onEnd = sinon.spy().named('onEnd'); + + runner.on(Events.END, onEnd); + + return run(runner).then(() => { + assert.calledOnce(onEnd); + assert.calledWith(onEnd, {foo: 'bar'}); + }); + }); + + it('should emit "END" event after collecting of a coverage', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + const onEnd = sinon.spy().named('onEnd'); + + runner.on(Events.END, onEnd); + + return run(runner).then(() => assert.callOrder(Coverage.prototype.processStats, onEnd)); + }); + + it('should emit "END" event after running of tests if coverage is disabled', () => { + const runner = createRunner({config: stubConfig({isCoverageEnabled: false})}); + const onEnd = sinon.spy().named('onEnd'); + + runner.on(Events.END, onEnd); + + return run(runner).then(() => assert.callOrder(BrowserRunner.prototype.run, onEnd)); + }); + + it('should unconditionally emit "END" event even if something was rejected earlier', () => { + const runner = createRunner(); + const onEnd = sinon.spy().named('onEnd'); + + runner.on(Events.END, onEnd); + + BrowserRunner.prototype.run.callsFake(() => Promise.reject()); + + return run(runner) + .catch(() => {}) + .then(() => assert.calledOnce(onEnd)); + }); + + it('should emit "END_RUNNER" event', () => { + const runner = createRunner(); + const onEndRunner = sinon.spy().named('onEndRunner'); + + runner.on(Events.END_RUNNER, onEndRunner); + + return run(runner).then(() => assert.calledOnce(onEndRunner)); + }); + + it('should emit "END_RUNNER" event after "END" one', () => { + const runner = createRunner(); + const onEnd = sinon.spy().named('onEnd'); + const onEndRunner = sinon.spy().named('onEndRunner'); + + runner.on(Events.END, onEnd); + runner.on(Events.END_RUNNER, onEndRunner); + + return run(runner).then(() => assert.callOrder(onEnd, onEndRunner)); + }); + + it('should pass runner when emitting "END_RUNNER" event', () => { + const runner = createRunner(); + const onEndRunner = sinon.spy().named('onEndRunner'); + + runner.on(Events.END_RUNNER, onEndRunner); + + return run(runner).then(() => assert.calledWith(onEndRunner, runner)); + }); + + it('should unconditionally emit "END_RUNNER" event even if something was rejected earlier', () => { + const runner = createRunner(); + const onEndRunner = sinon.spy().named('onEndRunner'); + + runner.on(Events.END_RUNNER, onEndRunner); + + BrowserRunner.prototype.run.callsFake(() => Promise.reject()); + + return run(runner) + .catch(() => {}) + .then(() => assert.calledOnce(onEndRunner)); + }); + + it('should wait until all "END_RUNNER" handlers have finished', () => { + const runner = createRunner(); + const onEndRunner = sinon.spy().named('onEndRunner'); + const onEndRunnerWithDelay = () => Promise.delay(50).then(onEndRunner); + + runner.on(Events.END_RUNNER, onEndRunnerWithDelay); + + return run(runner).then(() => assert.called(onEndRunner)); + }); + }); + + describe('handling of events from browser runner', () => { + beforeEach(() => { + sandbox.stub(RunnerStats.prototype, 'attachRunner'); + }); + + const testPassthrough = (event, msg) => { + it(msg || `${event}`, () => { + stubBrowserRunner((runner) => runner.emit(event, {foo: 'bar'})); + + const runner = createRunner(); + const onEvent = sinon.spy().named(event); + + runner.on(event, onEvent); + + return run(runner) + .then(() => { + assert.calledOnce(onEvent); + assert.calledWith(onEvent, {foo: 'bar'}); + }); + }); + }; + + const testCoverage = (event) => { + it('should save coverage if it is enabled', () => { + stubBrowserRunner((runner) => runner.emit(event, {coverage: 'foo', browserId: 'bar'})); + + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + + return run(runner) + .then(() => { + assert.calledOnce(Coverage.prototype.addStatsForBrowser); + assert.calledWith(Coverage.prototype.addStatsForBrowser, 'foo', 'bar'); + }); + }); + + it(`should emit "${event}" event after saving of coverage`, () => { + stubBrowserRunner((runner) => runner.emit(event, {})); + + const runner = createRunner({config: stubConfig({isCoverageEnabled: true})}); + const onEvent = sinon.spy().named(event); + + runner.on(event, onEvent); + + return run(runner) + .then(() => assert.callOrder(Coverage.prototype.addStatsForBrowser, onEvent)); + }); + + it('should not save coverage if it is disabled', () => { + stubBrowserRunner((runner) => runner.emit(event)); + + const runner = createRunner({config: stubConfig({isCoverageEnabled: false})}); + + return run(runner).then(() => assert.notCalled(Coverage.prototype.addStatsForBrowser)); + }); + }; + + describe('should passthrough', () => { + [ + Events.RETRY, + Events.BEGIN_SUITE, + Events.SKIP_STATE, + Events.BEGIN_STATE, + Events.END_STATE, + Events.INFO, + Events.ERROR + ].forEach((event) => testPassthrough(event)); + }); + + [ + Events.TEST_RESULT, + Events.UPDATE_RESULT + ].forEach((event) => { + describe(`on ${event}`, () => { + testPassthrough(event, `should passthrough "${event}" event`); + + testCoverage(event); + }); + }); + }); + }); + + describe('cancel', () => { + it('should cancel all created browser runners', () => { + const runner = createRunner(); + runner.config.getBrowserIds.returns(['bro1', 'bro2']); + + return run(runner) + .then(() => runner.cancel()) + .then(() => { + assert.calledTwice(BrowserRunner.prototype.cancel); + + assert.notEqual( + BrowserRunner.prototype.run.firstCall.thisValue, + BrowserRunner.prototype.run.secondCall.thisValue + ); + }); + }); + + it('should cancel browser pool', () => { + const browserPool = stubBrowserPool(); + + pool.create.returns(browserPool); + + const runner = createRunner(); + + runner.cancel(); + + assert.calledOnce(browserPool.cancel); + }); + + it('should cancel browser pool after cancelling of browser runners', () => { + const browserPool = stubBrowserPool(); + + pool.create.returns(browserPool); + + const runner = createRunner(); + + return run(runner) + .then(() => runner.cancel()) + .then(() => assert.callOrder(BrowserRunner.prototype.cancel, browserPool.cancel)); + }); + + it('should not run tests after cancel', () => { + const runner = createRunner(); + + runner.cancel(); + + return run(runner).then(() => assert.notCalled(BrowserRunner.prototype.run)); + }); + }); +}); diff --git a/test/unit/runner/index.test.js b/test/unit/runner/index.test.js deleted file mode 100644 index 9ff0b0435..000000000 --- a/test/unit/runner/index.test.js +++ /dev/null @@ -1,252 +0,0 @@ -'use strict'; -var q = require('q'), - QEmitter = require('qemitter'), - Runner = require('lib/runner'), - TestSessionRunner = require('lib/runner/test-session-runner'), - StateProcessor = require('lib/state-processor/state-processor'), - Config = require('lib/config'), - FailCollector = require('lib/fail-collector'), - util = require('../../util'); - -describe('runner', function() { - var sandbox = sinon.sandbox.create(), - config, - stateProcessor, - testSessionRunner, - runner; - - function run_(suites) { - return runner.run(suites || []); - } - - function createStateProcessor_() { - var stateProcessor = sinon.createStubInstance(StateProcessor); - - stateProcessor.jobDoneEvent = 'onCaptureProcessed'; - stateProcessor.exec.returns(q()); - return stateProcessor; - } - - function createTestSessionRunner_() { - var runner = new QEmitter(); - runner.run = function() { - return q(); - }; - return runner; - } - - beforeEach(function() { - config = sinon.createStubInstance(Config); - testSessionRunner = createTestSessionRunner_(); - stateProcessor = createStateProcessor_(); - runner = new Runner(config, stateProcessor); - - sandbox.stub(TestSessionRunner, 'create'); - TestSessionRunner.create.returns(testSessionRunner); - - sandbox.stub(FailCollector.prototype, 'tryToSubmitStateResult'); - sandbox.stub(FailCollector.prototype, 'tryToSubmitError'); - }); - - afterEach(function() { - sandbox.restore(); - }); - - describe('run', function() { - it('should emit `begin` event when tests start', function() { - var onBegin = sandbox.spy().named('onBegin'); - runner.on('begin', onBegin); - return run_().then(function() { - assert.calledOnce(onBegin); - }); - }); - - it('should pass total number of states when emitting `begin`', function() { - var suites = [ - {states: []}, - {states: [1, 2]}, - {states: [3]} - ]; - - var onBegin = sandbox.spy().named('onBegin'); - runner.on('begin', onBegin); - - return run_(suites).then(function() { - assert.calledWith(onBegin, sinon.match({totalStates: 3})); - }); - }); - - it('should pass all browser ids when emitting `begin`', function() { - runner.config.getBrowserIds - .returns(['browser1', 'browser2']); - - var onBegin = sandbox.spy().named('onBegin'); - runner.on('begin', onBegin); - - return run_().then(function() { - assert.calledWith(onBegin, sinon.match({ - browserIds: ['browser1', 'browser2'] - })); - }); - }); - - it('should pass config when emitting `begin`', function() { - var onBegin = sandbox.spy().named('onBegin'); - runner.on('begin', onBegin); - - return run_().then(function() { - assert.calledWith(onBegin, sinon.match({ - config: runner.config - })); - }); - }); - - it('should launch only browsers specified in testBrowsers', function() { - runner.config.getBrowserIds - .returns(['browser1', 'browser2']); - runner.setTestBrowsers(['browser1']); - - return run_().then(function() { - assert.calledWith(TestSessionRunner.create, sinon.match.any, ['browser1']); - }); - }); - - it('should run suites in test session runner', function() { - var suites = [util.makeSuiteStub()]; - - sandbox.stub(testSessionRunner, 'run').returns(q()); - - return run_(suites) - .then(function() { - assert.calledOnce(testSessionRunner.run); - assert.calledWith(testSessionRunner.run, suites, stateProcessor); - }); - }); - - it('should emit `end`', function() { - var onEnd = sandbox.spy(); - runner.on('end', onEnd); - - return run_().then(function() { - assert.calledOnce(onEnd); - }); - }); - - it('should emit events in correct order', function() { - var begin = sandbox.spy().named('onBegin'), - end = sandbox.spy().named('onEnd'); - - runner.on('begin', begin); - runner.on('end', end); - - return run_().then(function() { - assert.callOrder(begin, end); - }); - }); - - describe('retries', function() { - function mkRetryCandidate_() { - return { - browserId: 'id', - suite: {fullName: 'default_name'}, - equal: false - }; - } - - function runAndEmit_(event, data) { - return run_().then(function() { - return testSessionRunner.emitAndWait(event, data); - }); - } - - beforeEach(function() { - config.forBrowser.returns({retry: Infinity}); - }); - - it('should try to submit state result for retry', function() { - return runAndEmit_('stateResult') - .then(function() { - assert.called(FailCollector.prototype.tryToSubmitStateResult); - }); - }); - - it('should emit state result event if it was not submitted for retry', function() { - var onProcessedCapture = sandbox.spy(); - - runner.on('onCaptureProcessed', onProcessedCapture); - - return runAndEmit_('stateResult') - .then(function() { - assert.called(onProcessedCapture); - }); - }); - - it('should try to submit non-critical error for retry', function() { - return runAndEmit_('err') - .then(function() { - assert.called(FailCollector.prototype.tryToSubmitError); - }); - }); - - it('should emit `err` event if non-critical error was not submit for retry', function() { - var onErr = sandbox.spy(); - - runner.on('err', onErr); - return runAndEmit_('err') - .then(function() { - assert.called(onErr); - }); - }); - - it('should reject promise if critical error was not submitted for retry', function() { - FailCollector.prototype.tryToSubmitError.returns(false); - return assert.isRejected(runAndEmit_('criticalError')); - }); - - it('should try to submit critical error for retry', function() { - FailCollector.prototype.tryToSubmitError.returns(false); - return runAndEmit_('criticalError') - .fail(function() { - assert.called(FailCollector.prototype.tryToSubmitError); - }); - }); - - it('should emit `err` event before failing on critical error', function() { - var onErr = sandbox.spy(); - - runner.on('err', onErr); - return runAndEmit_('err') - .fail(function() { - assert.called(onErr); - }); - }); - - describe('`retry` event', function() { - beforeEach(function() { - FailCollector.prototype.tryToSubmitStateResult.restore(); - FailCollector.prototype.tryToSubmitError.restore(); - }); - - it('should emit `retry` event if candidate was submitted for retry', function() { - var onRetry = sandbox.spy(); - runner.on('retry', onRetry); - - return runAndEmit_('stateResult', mkRetryCandidate_()) - .then(function() { - assert.called(onRetry); - }); - }); - - it('should add info about retry to `retry` event data', function() { - var onRetry = sandbox.spy(); - runner.on('retry', onRetry); - - return runAndEmit_('stateResult', mkRetryCandidate_()) - .then(function() { - assert.calledWithMatch(onRetry, {attempt: 1, retriesLeft: Infinity}); - }); - }); - }); - }); - }); -}); diff --git a/test/unit/runner/runner.js b/test/unit/runner/runner.js deleted file mode 100644 index b23eb307d..000000000 --- a/test/unit/runner/runner.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; -var Runner = require('lib/runner/runner'); - -describe('runner/base', function() { - describe('passthroughEvent', function() { - var runner, - child; - - beforeEach(function() { - runner = new Runner(); - child = new Runner(); - }); - - it('should emit event emitted by child', function() { - var onSomeEvent = sinon.spy(); - runner.on('some-event', onSomeEvent); - runner.passthroughEvent(child, 'some-event'); - - child.emit('some-event', 'some-data'); - - assert.calledWith(onSomeEvent, 'some-data'); - }); - - it('should emit all events emitted by child', function() { - var onSomeEvent = sinon.spy(), - onOtherEvent = sinon.spy(); - - runner.on('some-event', onSomeEvent); - runner.on('other-event', onOtherEvent); - runner.passthroughEvent(child, ['some-event', 'other-event']); - - child.emit('some-event', 'some-data'); - child.emit('other-event', 'other-data'); - - assert.calledWith(onSomeEvent, 'some-data'); - assert.calledWith(onOtherEvent, 'other-data'); - }); - - it('should not break promise chain on event emitted by emitAndWait', function() { - runner.passthroughEvent(child, 'some-event'); - runner.on('some-event', function() { - return 'some-data'; - }); - - return child.emitAndWait('some-event') - .then(function(data) { - assert.equal(data, 'some-data'); - }); - }); - }); -}); diff --git a/test/unit/runner/state-runner/disabled-state-runner.js b/test/unit/runner/state-runner/disabled-state-runner.js index e91d0f4fb..9a0e28652 100644 --- a/test/unit/runner/state-runner/disabled-state-runner.js +++ b/test/unit/runner/state-runner/disabled-state-runner.js @@ -1,19 +1,18 @@ 'use strict'; -var q = require('q'), - DisabledStateRunner = require('lib/runner/state-runner/disabled-state-runner'), - CaptureSession = require('lib/capture-session'), - Config = require('lib/config'), - util = require('../../../util'); +const Promise = require('bluebird'); +const DisabledStateRunner = require('lib/runner/state-runner/disabled-state-runner'); +const CaptureSession = require('lib/capture-session'); +const util = require('../../../util'); -describe('runner/state-runner/disabled-state-runner', function() { +describe('runner/state-runner/disabled-state-runner', () => { function mkBrowserSessionStub_(opts) { opts = opts || {}; - var session = sinon.createStubInstance(CaptureSession); + const session = sinon.createStubInstance(CaptureSession); session.browser = util.browserWithId(opts.browserId || 'default-browser-id'); session.browser.sessionId = opts.sessionId || 'default-session-id'; - session.runActions.returns(q.resolve()); - session.capture.returns(q.resolve()); + session.runActions.returns(Promise.resolve()); + session.capture.returns(Promise.resolve()); return session; } @@ -21,31 +20,28 @@ describe('runner/state-runner/disabled-state-runner', function() { function mkRunner_(state, browserSession) { state = state || util.makeStateStub(); browserSession = browserSession || mkBrowserSessionStub_(); - var config = sinon.createStubInstance(Config); - return new DisabledStateRunner(state, browserSession, config); + return new DisabledStateRunner(state, browserSession); } - it('should perform state actions', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should perform state actions', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); return runner.run() - .then(function() { + .then(() => { assert.calledOnce(browserSession.runActions); assert.calledWith(browserSession.runActions, state.actions); }); }); - it('should not perform capture', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should not perform capture', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); return runner.run() - .then(function() { - assert.notCalled(browserSession.capture); - }); + .then(() => assert.notCalled(browserSession.capture)); }); }); diff --git a/test/unit/runner/state-runner/index.js b/test/unit/runner/state-runner/index.js index 4d46259b4..03ca81ed5 100644 --- a/test/unit/runner/state-runner/index.js +++ b/test/unit/runner/state-runner/index.js @@ -1,37 +1,53 @@ 'use strict'; -var stateRunner = require('lib/runner/state-runner'), - StateRunner = require('lib/runner/state-runner/state-runner'), - DisabledStateRunner = require('lib/runner/state-runner/disabled-state-runner'), - util = require('../../../util'); +const proxyquire = require('proxyquire'); -describe('runner/state-runner', function() { - var sandbox = sinon.sandbox.create(), - sessionStub; +const StateRunner = require('lib/runner/state-runner/state-runner'); +const util = require('../../../util'); - beforeEach(function() { +describe('runner/state-runner', () => { + const sandbox = sinon.sandbox.create(); + + let StateRunnerFactory; + let DisabledStateRunner; + + let sessionStub; + + beforeEach(() => { sessionStub = {browser: {}}; - }); - afterEach(function() { - sandbox.restore(); + DisabledStateRunner = sandbox.stub(); + + StateRunnerFactory = proxyquire('lib/runner/state-runner', { + './disabled-state-runner': DisabledStateRunner + }); }); - it('should create DisabledStateRunner for state with no browsers', function() { - var state = util.makeStateStub(); + afterEach(() => sandbox.restore()); - var runner = stateRunner.create(state, sessionStub); + it('should create DisabledStateRunner for state with no browsers', () => { + const state = util.makeStateStub(); + + const runner = StateRunnerFactory.create(state, sessionStub); assert.instanceOf(runner, DisabledStateRunner); }); - it('should create StateRunner by default', function() { - var suite = util.makeSuiteStub({browsers: ['some-browser']}), - state = util.makeStateStub(suite); + it('should pass state, browser session and config to the constructor of DisabledStateRunner', () => { + const state = util.makeStateStub(); + + StateRunnerFactory.create(state, sessionStub); + + assert.calledWith(DisabledStateRunner, state, sessionStub); + }); + + it('should create StateRunner by default', () => { + const suite = util.makeSuiteStub({browsers: ['some-browser']}); + const state = util.makeStateStub(suite); sessionStub.browser.id = 'some-browser'; - var runner = stateRunner.create(state, sessionStub); + const runner = StateRunnerFactory.create(state, sessionStub); assert.instanceOf(runner, StateRunner); }); diff --git a/test/unit/runner/state-runner/state-runner.js b/test/unit/runner/state-runner/state-runner.js index 31ccc4155..a0d55d3d8 100644 --- a/test/unit/runner/state-runner/state-runner.js +++ b/test/unit/runner/state-runner/state-runner.js @@ -1,22 +1,21 @@ 'use strict'; -var q = require('q'), - StateRunner = require('lib/runner/state-runner/state-runner'), - CaptureSession = require('lib/capture-session'), - StateError = require('lib/errors/state-error'), - StateProcessor = require('lib/state-processor/state-processor'), - Config = require('lib/config'), - util = require('../../../util'); - -describe('runner/state-runner/state-runner', function() { +const Promise = require('bluebird'); +const StateRunner = require('lib/runner/state-runner/state-runner'); +const CaptureSession = require('lib/capture-session'); +const StateError = require('lib/errors/state-error'); +const StateProcessor = require('lib/state-processor/state-processor'); +const util = require('../../../util'); + +describe('runner/state-runner/state-runner', () => { function mkBrowserSessionStub_(opts) { opts = opts || {}; - var session = sinon.createStubInstance(CaptureSession); + const session = sinon.createStubInstance(CaptureSession); session.browser = util.browserWithId(opts.browserId || 'default-browser-id'); session.browser.sessionId = opts.sessionId || 'default-session-id'; - session.runActions.returns(q.resolve()); - session.capture.returns(q.resolve({})); - session.extendWithPageScreenshot.returns(q.resolve()); + session.runActions.returns(Promise.resolve()); + session.capture.returns(Promise.resolve({})); + session.extendWithPageScreenshot.returns(Promise.resolve()); return session; } @@ -24,14 +23,13 @@ describe('runner/state-runner/state-runner', function() { function mkRunner_(state, browserSession) { state = state || util.makeStateStub(); browserSession = browserSession || mkBrowserSessionStub_(); - var config = sinon.createStubInstance(Config); - return new StateRunner(state, browserSession, config); + return new StateRunner(state, browserSession); } function mkStateProcessor_() { - var stateProcessor = sinon.createStubInstance(StateProcessor); - stateProcessor.exec.returns(q()); + const stateProcessor = sinon.createStubInstance(StateProcessor); + stateProcessor.exec.returns(Promise.resolve()); return stateProcessor; } @@ -40,20 +38,20 @@ describe('runner/state-runner/state-runner', function() { return runner.run(stateProcessor); } - describe('run', function() { - it('should emit `beginState` event', function() { - var onBeginState = sinon.spy().named('onBeginState'), - browserSession = mkBrowserSessionStub_({ - browserId: 'browser', - sessionId: 'session' - }), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + describe('run', () => { + it('should emit `beginState` event', () => { + const onBeginState = sinon.spy().named('onBeginState'); + const browserSession = mkBrowserSessionStub_({ + browserId: 'browser', + sessionId: 'session' + }); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); runner.on('beginState', onBeginState); return run_(runner) - .then(function() { + .then(() => { assert.calledWith(onBeginState, { suite: state.suite, state: state, @@ -63,19 +61,19 @@ describe('runner/state-runner/state-runner', function() { }); }); - it('should emit `endState` event', function() { - var onEndState = sinon.spy().named('onEndState'), - browserSession = mkBrowserSessionStub_({ - browserId: 'browser', - sessionId: 'session' - }), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should emit `endState` event', () => { + const onEndState = sinon.spy().named('onEndState'); + const browserSession = mkBrowserSessionStub_({ + browserId: 'browser', + sessionId: 'session' + }); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); runner.on('endState', onEndState); return run_(runner) - .then(function() { + .then(() => { assert.calledWith(onEndState, { suite: state.suite, state: state, @@ -85,29 +83,29 @@ describe('runner/state-runner/state-runner', function() { }); }); - it('should perform state actions', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should perform state actions', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); return run_(runner) - .then(function() { + .then(() => { assert.calledOnce(browserSession.runActions); assert.calledWith(browserSession.runActions, state.actions); }); }); - it('should perform state actions before processing state', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession), - mediator = sinon.spy().named('mediator'), - stateProcessor = mkStateProcessor_(); + it('should perform state actions before processing state', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); + const mediator = sinon.spy().named('mediator'); + const stateProcessor = mkStateProcessor_(); - browserSession.runActions.returns(q.delay(1).then(mediator)); + browserSession.runActions.returns(Promise.delay(50).then(mediator)); return run_(runner, stateProcessor) - .then(function() { + .then(() => { assert.callOrder( browserSession.runActions, mediator, @@ -116,32 +114,32 @@ describe('runner/state-runner/state-runner', function() { }); }); - it('should extend error in state actions with page screenshot', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should extend error in state actions with page screenshot', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); - var error = new StateError('some error'); - browserSession.runActions.returns(q.reject(error)); + const error = new StateError('some error'); + browserSession.runActions.callsFake(() => Promise.reject(error)); return run_(runner) - .then(function() { + .then(() => { assert.calledOnce(browserSession.extendWithPageScreenshot); assert.calledWith(browserSession.extendWithPageScreenshot, error); }); }); - it('should prepare screenshot before processing state', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession), - mediator = sinon.spy().named('mediator'), - stateProcessor = mkStateProcessor_(); + it('should prepare screenshot before processing state', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); + const mediator = sinon.spy().named('mediator'); + const stateProcessor = mkStateProcessor_(); - browserSession.prepareScreenshot.returns(q.delay(1).then(mediator)); + browserSession.prepareScreenshot.returns(Promise.delay(500).then(mediator)); return run_(runner, stateProcessor) - .then(function() { + .then(() => { assert.callOrder( browserSession.prepareScreenshot, mediator, @@ -150,69 +148,64 @@ describe('runner/state-runner/state-runner', function() { }); }); - it('should extend prepare screenshot error with page screenshot', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession); + it('should extend prepare screenshot error with page screenshot', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); - var error = new StateError('some error'); - browserSession.prepareScreenshot.returns(q.reject(error)); + const error = new StateError('some error'); + browserSession.prepareScreenshot.rejects(error); return run_(runner) - .then(function() { + .then(() => { assert.calledOnce(browserSession.extendWithPageScreenshot); assert.calledWith(browserSession.extendWithPageScreenshot, error); }); }); - it('should process state', function() { - var browserSession = mkBrowserSessionStub_(), - state = util.makeStateStub(), - runner = mkRunner_(state, browserSession), - stateProcessor = mkStateProcessor_(); + it('should process state', () => { + const browserSession = mkBrowserSessionStub_(); + const state = util.makeStateStub(); + const runner = mkRunner_(state, browserSession); + const stateProcessor = mkStateProcessor_(); - stateProcessor.exec.returns(q()); + stateProcessor.exec.returns(Promise.resolve()); return runner.run(stateProcessor) - .then(function() { + .then(() => { assert.calledOnce(stateProcessor.exec); - assert.calledWithMatch(stateProcessor.exec, state, browserSession); + assert.calledWith(stateProcessor.exec, state, browserSession); }); }); - it('should extend state errors with metadata', function() { - var onStateError = sinon.spy().named('onError'), - state = util.makeStateStub(), - runner = mkRunner_(state), - stateProcessor = mkStateProcessor_(); + it('should extend state errors with metadata', () => { + const onStateError = sinon.spy().named('onError'); + const state = util.makeStateStub(); + const runner = mkRunner_(state); + const stateProcessor = mkStateProcessor_(); runner.on('err', onStateError); - stateProcessor.exec.returns(q.reject(new StateError())); + stateProcessor.exec.rejects(new StateError()); return run_(runner, stateProcessor) - .then(function() { - var error = onStateError.firstCall.args[0]; + .then(() => { + const error = onStateError.firstCall.args[0]; assert.equal(error.state, state); assert.equal(error.suite, state.suite); }); }); - it('should emit events in correct order', function() { - var onBeginState = sinon.spy().named('onBeginState'), - onEndState = sinon.spy().named('onEndState'), - runner = mkRunner_(); + it('should emit events in correct order', () => { + const onBeginState = sinon.spy().named('onBeginState'); + const onEndState = sinon.spy().named('onEndState'); + const runner = mkRunner_(); runner.on('beginState', onBeginState); runner.on('endState', onEndState); return run_(runner) - .then(function() { - assert.callOrder( - onBeginState, - onEndState - ); - }); + .then(() => assert.callOrder(onBeginState, onEndState)); }); }); }); diff --git a/test/unit/runner/suite-runner/index.js b/test/unit/runner/suite-runner/index.js index 910c619a7..8bfcc208f 100644 --- a/test/unit/runner/suite-runner/index.js +++ b/test/unit/runner/suite-runner/index.js @@ -1,45 +1,90 @@ 'use strict'; -var suiteRunner = require('lib/runner/suite-runner'), - RegularSuiteRunner = require('lib/runner/suite-runner/regular-suite-runner'), - StatelessSuiteRunner = require('lib/runner/suite-runner/stateless-suite-runner'), - SkippedSuiteRunner = require('lib/runner/suite-runner/skipped-suite-runner'), - suiteUtil = require('lib/suite-util'), - util = require('../../../util'); - -describe('runner/suite-runner/create', function() { - var sandbox = sinon.sandbox.create(); - - afterEach(function() { - sandbox.restore(); +const proxyquire = require('proxyquire'); +const util = require('../../../util'); + +describe('runner/suite-runner/create', () => { + const sandbox = sinon.sandbox.create(); + + let StatelessRunner; + let SkippedRunner; + let InsistentRunner; + + let SuiteRunnerFactory; + + const makeStatelessSuite = () => util.makeSuiteStub(); + const makeSuite = () => util.makeSuiteStub({states: [util.makeStateStub()]}); + + const makeSuiteRunner = (suite) => { + return SuiteRunnerFactory.create(suite, {}, {}); + }; + + beforeEach(() => { + StatelessRunner = sandbox.stub(); + SkippedRunner = sandbox.stub(); + InsistentRunner = sandbox.stub(); + + SuiteRunnerFactory = proxyquire('lib/runner/suite-runner', { + './stateless-suite-runner': StatelessRunner, + './skipped-suite-runner': SkippedRunner, + './insistent-suite-runner': InsistentRunner + }); }); - it('should create StatelessSuiteRunner for suite without states', function() { - var suite = util.makeSuiteStub(); + afterEach(() => sandbox.restore()); - var runner = suiteRunner.create(suite, {}); + describe('StatelessSuiteRunner', () => { + it('should create StatelessSuiteRunner', () => { + makeSuiteRunner(makeStatelessSuite()); - assert.instanceOf(runner, StatelessSuiteRunner); + assert.calledOnce(StatelessRunner); + assert.notCalled(SkippedRunner); + assert.notCalled(InsistentRunner); + }); + + it('should return StatelessSuiteRunner for suite without states', () => { + const runner = makeSuiteRunner(makeStatelessSuite(), {}, {}); + + assert.instanceOf(runner, StatelessRunner); + }); }); - it('should create RegularSuiteRunner for suite with states', function() { - var suite = util.makeSuiteStub({ - states: [util.makeStateStub()] - }); + describe('SkippedSuiteRunner', () => { + let suite; + + beforeEach(() => { + suite = makeSuite(); + suite.shouldSkip = sinon.stub().returns(true); + }); - var runner = suiteRunner.create(suite, {}); + it('should create SkippedSuiteRunner', () => { + makeSuiteRunner(suite); - assert.instanceOf(runner, RegularSuiteRunner); + assert.calledOnce(SkippedRunner); + assert.notCalled(StatelessRunner); + assert.notCalled(InsistentRunner); + }); + + it('should return SkippedSuiteRunner for skipped suite', () => { + const runner = makeSuiteRunner(suite, {}); + + assert.instanceOf(runner, SkippedRunner); + }); }); - it('should create SkippedSuiteRunner for skipped suite', function() { - var suite = util.makeSuiteStub({ - states: [util.makeStateStub()] - }); - sandbox.stub(suiteUtil, 'shouldSkip').returns(true); + describe('InsistentSuiteRunner', () => { + it('should create InsistentSuiteRunner', () => { + makeSuiteRunner(makeSuite()); + + assert.calledOnce(InsistentRunner); + assert.notCalled(StatelessRunner); + assert.notCalled(SkippedRunner); + }); - var runner = suiteRunner.create(suite, {}); + it('should return InsistentSuiteRunner for other suites', () => { + const runner = makeSuiteRunner(makeSuite()); - assert.instanceOf(runner, SkippedSuiteRunner); + assert.instanceOf(runner, InsistentRunner); + }); }); }); diff --git a/test/unit/runner/suite-runner/insistent-suite-runner.js b/test/unit/runner/suite-runner/insistent-suite-runner.js new file mode 100644 index 000000000..c84e2cf13 --- /dev/null +++ b/test/unit/runner/suite-runner/insistent-suite-runner.js @@ -0,0 +1,558 @@ +'use strict'; + +const Promise = require('bluebird'); +const _ = require('lodash'); + +const {BrowserAgent} = require('gemini-core'); +const Events = require('lib/constants/events'); +const InsistentSuiteRunner = require('lib/runner/suite-runner/insistent-suite-runner'); +const RegularSuiteRunner = require('lib/runner/suite-runner/regular-suite-runner'); +const CancelledError = require('lib/errors/cancelled-error'); +const NoRefImageError = require('lib/errors/no-ref-image-error'); +const {makeStateStub, makeSuiteStub, makeSuiteTree} = require('../../../util'); + +describe('runner/suite-runner/insistent-suite-runner', () => { + const sandbox = sinon.sandbox.create(); + + const mkConfigStub_ = (opts) => opts || {foo: 'default-bar'}; + + const mkBrowserAgentStub_ = (browserId) => { + const browserAgent = new BrowserAgent(); + browserAgent.browserId = browserId || 'default-bro'; + return browserAgent; + }; + + const mkInsistentRunner_ = (opts) => { + opts = opts || {}; + + return InsistentSuiteRunner.create( + opts.suite || makeSuiteStub({states: [makeStateStub()]}), + opts.browserAgent || mkBrowserAgentStub_(), + opts.config || mkConfigStub_({retry: 0}) + ); + }; + + const stubWrappedRun_ = (scenario) => { + RegularSuiteRunner.prototype.run.callsFake(function() { + return Promise.resolve(scenario(this)); + }); + }; + + beforeEach(() => { + sandbox.stub(RegularSuiteRunner.prototype, 'run').returns(Promise.resolve()); + }); + + afterEach(() => sandbox.restore()); + + it('should create regular suite runner', () => { + const suite = makeSuiteStub(); + const browserAgent = mkBrowserAgentStub_(); + const config = mkConfigStub_(); + + sandbox.spy(RegularSuiteRunner, 'create'); + + return InsistentSuiteRunner.create(suite, browserAgent, config) + .run() + .then(() => { + assert.calledOnce(RegularSuiteRunner.create); + assert.calledWith(RegularSuiteRunner.create, suite, browserAgent); + }); + }); + + [ + Events.BEGIN_STATE, + Events.SKIP_STATE, + Events.END_STATE, + Events.TEST_RESULT, + Events.UPDATE_RESULT + ].forEach((stateEvent) => it(`should passthrough ${stateEvent} state`, () => { + stubWrappedRun_((runner) => runner.emit(stateEvent, {foo: 'bar'})); + const handler = sinon.spy().named(stateEvent + 'Handler'); + + return mkInsistentRunner_() + .on(stateEvent, handler) + .run() + .then(() => { + assert.calledOnce(handler); + assert.calledWithMatch(handler, {foo: 'bar'}); + }); + })); + + [ + Events.BEGIN_SUITE, + Events.END_SUITE + ].forEach((suiteEvent) => it(`should not passthrough ${suiteEvent}`, () => { + stubWrappedRun_((runner) => runner.emit(suiteEvent, {foo: 'bar'})); + const handler = sinon.spy().named(suiteEvent + 'Handler'); + + return mkInsistentRunner_() + .on(suiteEvent, handler) + .run() + .then(() => assert.neverCalledWithMatch(handler, {foo: 'bar'})); + })); + + it('should emit suite begin/end events', () => { + const onBeginSuite = sinon.spy().named('onBeginSuite'); + const onEndSuite = sinon.spy().named('onEndSuite'); + + return mkInsistentRunner_() + .on(Events.BEGIN_SUITE, onBeginSuite) + .on(Events.END_SUITE, onEndSuite) + .run() + .then(() => assert.callOrder(onBeginSuite, onEndSuite)); + }); + + it('should run wrapped regular suite runner', () => { + const stateProcessor = {some: 'object'}; + + return mkInsistentRunner_() + .run(stateProcessor) + .then(() => { + assert.calledOnce(RegularSuiteRunner.prototype.run); + assert.calledWith(RegularSuiteRunner.prototype.run, stateProcessor); + }); + }); + + it('should provide the ability to mutate the passed config', () => { + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {state: makeStateStub()})); + + const config = mkConfigStub_({retry: 1}); + const runner = mkInsistentRunner_({config}); + + config.retry = 0; + + return runner.run() + .then(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + + describe('run without retries', () => { + describe('on ERROR', () => { + it('should emit ERROR', () => { + const onError = sinon.spy().named('onError'); + + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {foo: 'bar'})); + + return mkInsistentRunner_() + .on(Events.ERROR, onError) + .run() + .then(() => { + assert.calledOnce(onError); + assert.calledWithMatch(onError, {foo: 'bar'}); + }); + }); + + it('should not retry', () => { + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {})); + + return mkInsistentRunner_() + .run() + .then(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + }); + + describe('on TEST_RESULT with diff', () => { + it('should emit same TEST_RESULT', () => { + const onTestResult = sinon.spy().named('onTestResult'); + + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: false})); + + return mkInsistentRunner_() + .on(Events.TEST_RESULT, onTestResult) + .run() + .then(() => { + assert.calledOnce(onTestResult); + assert.calledWithMatch(onTestResult, {equal: false}); + }); + }); + + it('should not retry', () => { + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: false})); + + return mkInsistentRunner_() + .run() + .then(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + }); + }); + + describe('run with retries', () => { + const mkRunnerWithRetries_ = (opts) => { + return mkInsistentRunner_(_.extend(opts || {}, { + config: mkConfigStub_({retry: 1}) + })); + }; + + describe('on ERROR', () => { + it('should emit RETRY instead of ERROR', () => { + const suite = makeSuiteStub(); + const state = makeStateStub(suite); + + let count = 0; + stubWrappedRun_((runner) => { + if (count++ === 0) { // only first time + runner.emit(Events.ERROR, {foo: 'bar', state}); + } + }); + + const browserAgent = mkBrowserAgentStub_('bro'); + const config = mkConfigStub_({retry: 3}); + const onError = sinon.spy().named('onError'); + const onRetry = sinon.spy().named('onRetry'); + + return mkInsistentRunner_({suite, browserAgent, config}) + .on(Events.ERROR, onError) + .on(Events.RETRY, onRetry) + .run() + .then(() => { + assert.notCalled(onError); + + assert.calledOnce(onRetry); + assert.calledWith(onRetry, { + foo: 'bar', + suite, + state, + browserId: 'bro', + attempt: 0, + retriesLeft: 3 + }); + }); + }); + + it('should retry as much times as specified in config', () => { + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {state: makeStateStub()})); + const config = mkConfigStub_({retry: 2}); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert.callCount(RegularSuiteRunner.prototype.run, 1 + 2)); + }); + + it('should count few errors during run for one', () => { + const state = makeStateStub(); + + stubWrappedRun_((runner) => { + runner.emit(Events.ERROR, {state}); + runner.emit(Events.ERROR, {state}); + }); + const config = mkConfigStub_({retry: 2}); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert.callCount(RegularSuiteRunner.prototype.run, 1 + 2)); + }); + + it('should not retry on NoRefImageError', () => { + const onError = sinon.spy().named('onError'); + const onRetry = sinon.spy().named('onRetry'); + + stubWrappedRun_((runner) => runner.emit(Events.ERROR, new NoRefImageError())); + + return mkRunnerWithRetries_() + .on(Events.ERROR, onError) + .on(Events.RETRY, onRetry) + .run() + .then(() => { + assert.notCalled(onRetry); + assert.calledOnce(onError); + assert.calledOnce(RegularSuiteRunner.prototype.run); + }); + }); + + it('should not retry if retries count is below zero', () => { + const onError = sinon.spy().named('onError'); + const onRetry = sinon.spy().named('onRetry'); + + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {state: makeStateStub()})); + + return mkInsistentRunner_({config: mkConfigStub_({retry: -1})}) + .on(Events.ERROR, onError) + .on(Events.RETRY, onRetry) + .run() + .then(() => { + assert.notCalled(onRetry); + assert.calledOnce(onError); + assert.calledOnce(RegularSuiteRunner.prototype.run); + }); + }); + + it('should not retry if config shouldRetry() told so', () => { + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {state: makeStateStub()})); + const config = mkConfigStub_({ + retry: 100, + shouldRetry: () => false + }); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert(RegularSuiteRunner.prototype.run.calledOnce)); + }); + + it('shouldRetry() should have proper argument', () => { + stubWrappedRun_((runner) => runner.emit(Events.ERROR, {state: makeStateStub()})); + const rule = sandbox.spy(); + const config = mkConfigStub_({ + retry: 1, + shouldRetry: rule + }); + + return mkInsistentRunner_({config}) + .run() + .then(() => { + const firstCallArgs = rule.firstCall.args; + const arg = firstCallArgs[0]; + assert.equal(firstCallArgs.length, 1, 'shouldRetry() expect one argument'); + assert.typeOf(arg.retriesLeft, 'number', 'No "retriesLeft" property in shouldRetry argument'); + assert.typeOf(arg.attempt, 'number', 'No "attempt" property in shouldRetry argument'); + }); + }); + }); + + describe('on TEST_RESULT without diff', () => { + it('should emit same TEST_RESULT', () => { + const onTestResult = sinon.spy().named('onTestResult'); + + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: true})); + + return mkRunnerWithRetries_() + .on(Events.TEST_RESULT, onTestResult) + .run() + .then(() => { + assert.calledOnce(onTestResult); + assert.calledWithMatch(onTestResult, {equal: true}); + }); + }); + + it('should not retry', () => { + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: true})); + + return mkRunnerWithRetries_() + .run() + .then(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + }); + + describe('on TEST_RESULT with diff', () => { + it('should emit RETRY instead of TEST_RESULT', () => { + const suite = makeSuiteStub(); + const state = makeStateStub(suite); + + let count = 0; + stubWrappedRun_((runner) => { + if (count++ === 0) { // only first time + runner.emit(Events.TEST_RESULT, {equal: false, state}); + } + }); + + const browserAgent = mkBrowserAgentStub_('bro'); + const config = mkConfigStub_({retry: 3}); + const onTestResult = sinon.spy().named('onTestResult'); + const onRetry = sinon.spy().named('onRetry'); + + return mkInsistentRunner_({suite, browserAgent, config}) + .on(Events.TEST_RESULT, onTestResult) + .on(Events.RETRY, onRetry) + .run() + .then(() => { + assert.notCalled(onTestResult); + + assert.calledOnce(onRetry); + assert.calledWithMatch(onRetry, { + equal: false, + suite, + state, + browserId: 'bro', + attempt: 0, + retriesLeft: 3 + }); + }); + }); + + it('should retry as much times as specified in config', () => { + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: false, state: makeStateStub()})); + const config = mkConfigStub_({retry: 2}); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert.callCount(RegularSuiteRunner.prototype.run, 1 + 2)); + }); + + it('should count few diffs during run for one', () => { + const state = makeStateStub(); + + stubWrappedRun_((runner) => { + runner.emit(Events.TEST_RESULT, {equal: false, state}); + runner.emit(Events.TEST_RESULT, {equal: false, state}); + }); + const config = mkConfigStub_({retry: 2}); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert.callCount(RegularSuiteRunner.prototype.run, 1 + 2)); + }); + + it('should not retry on cancel after diff', () => { + stubWrappedRun_((runner) => { + runner.emit(Events.TEST_RESULT, {equal: false, state: makeStateStub()}); + return Promise.reject(new CancelledError()); + }); + + return mkRunnerWithRetries_() + .run() + .catch(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + + it('should not retry if retries count is below zero', () => { + const onTestResult = sinon.spy().named('onTestResult'); + const onRetry = sinon.spy().named('onRetry'); + + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: false, state: makeStateStub()})); + + return mkInsistentRunner_({config: mkConfigStub_({retry: -1})}) + .on(Events.TEST_RESULT, onTestResult) + .on(Events.RETRY, onRetry) + .run() + .then(() => { + assert.notCalled(onRetry); + assert.calledOnce(onTestResult); + assert.calledOnce(RegularSuiteRunner.prototype.run); + }); + }); + + it('should not retry if config shouldRetry() told so', () => { + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {state: makeStateStub()})); + const config = mkConfigStub_({ + retry: 100, + shouldRetry: () => false + }); + + return mkInsistentRunner_({config}) + .run() + .then(() => assert(RegularSuiteRunner.prototype.run.calledOnce)); + }); + + it('shouldRetry() should have proper argument', () => { + stubWrappedRun_((runner) => runner.emit(Events.TEST_RESULT, {equal: false, state: makeStateStub()})); + const rule = sandbox.spy(); + const config = mkConfigStub_({ + retry: 1, + shouldRetry: rule + }); + + return mkInsistentRunner_({config}) + .run() + .then(() => { + const firstCallArgs = rule.firstCall.args; + const arg = firstCallArgs[0]; + assert.equal(firstCallArgs.length, 1, 'shouldRetry() expect one argument'); + assert.typeOf(arg.retriesLeft, 'number', 'No "retriesLeft" property in shouldRetry argument'); + assert.typeOf(arg.attempt, 'number', 'No "attempt" property in shouldRetry argument'); + assert.typeOf(arg.equal, 'boolean', 'No "equal" property in shouldRetry argument'); + }); + }); + }); + + it('should retry only failed states', () => { + sandbox.spy(RegularSuiteRunner, 'create'); + + const suite = makeSuiteTree({suite: ['1st', '2nd', '3rd']}, {browsers: ['bro', 'firefox']}).suite; + stubWrappedRun_((runner) => { + runner.emit(Events.TEST_RESULT, {state: {name: '1st'}, equal: true}); + runner.emit(Events.ERROR, {state: {name: '2nd'}}); + runner.emit(Events.TEST_RESULT, {state: {name: '3rd'}, equal: false}); + }); + + return mkRunnerWithRetries_({suite, browserAgent: mkBrowserAgentStub_('bro')}) + .run() + .then(() => { + const retriedSuite = RegularSuiteRunner.create.secondCall.args[0]; + assert.deepEqual(retriedSuite.states[0].browsers, []); + assert.deepEqual(retriedSuite.states[1].browsers, ['bro']); + assert.deepEqual(retriedSuite.states[2].browsers, ['bro']); + }); + }); + + it('should not affect child states', () => { + sandbox.spy(RegularSuiteRunner, 'create'); + + const suite = makeSuiteTree({ + suite: { + child: ['childState'] + } + }, {browsers: ['bro', 'firefox']}).suite; + makeStateStub(suite, {name: 'rootState'}); + + stubWrappedRun_((runner) => { + runner.emit(Events.TEST_RESULT, {state: {name: 'rootState'}, equal: false}); + }); + + return mkRunnerWithRetries_({suite, browserAgent: mkBrowserAgentStub_('bro')}) + .run() + .then(() => { + const childState = suite.children[0].states[0]; + assert.deepEqual(childState.browsers, ['bro', 'firefox']); + }); + }); + }); + + describe('cancel', () => { + it('should not retry after cancel', () => { + const config = mkConfigStub_({retry: 1}); + const insistantRunner = mkInsistentRunner_({config}); + + stubWrappedRun_((runner) => { + runner.emit(Events.TEST_RESULT, {state: makeStateStub(), equal: false}); + + insistantRunner.cancel(); + }); + + return insistantRunner + .run() + .then(() => assert.calledOnce(RegularSuiteRunner.prototype.run)); + }); + + it('should not emit retry events after cancel', () => { + const config = mkConfigStub_({retry: 1}); + const insistantRunner = mkInsistentRunner_({config}); + const onRetry = sinon.spy().named('onRetry'); + + stubWrappedRun_((runner) => { + insistantRunner.cancel(); + + runner.emit(Events.TEST_RESULT, {state: makeStateStub(), equal: false}); + }); + + return insistantRunner + .on(Events.RETRY, onRetry) + .run() + .then(() => assert.notCalled(onRetry)); + }); + + describe('should not passthrough event after cancel', () => { + [ + Events.BEGIN_STATE, + Events.SKIP_STATE, + Events.END_STATE, + Events.UPDATE_RESULT, + Events.TEST_RESULT, + Events.ERROR + ].forEach((event) => { + it(`${event}`, () => { + const config = mkConfigStub_({retry: 0}); + const insistantRunner = mkInsistentRunner_({config}); + const onEventHandler = sinon.spy().named(event); + + stubWrappedRun_((runner) => { + insistantRunner.cancel(); + + runner.emit(event, {state: makeStateStub()}); + }); + + return insistantRunner + .on(event, onEventHandler) + .run() + .then(() => assert.notCalled(onEventHandler)); + }); + }); + }); + }); +}); diff --git a/test/unit/runner/suite-runner/regular-suite-runner.js b/test/unit/runner/suite-runner/regular-suite-runner.js index 876e733ef..e8e58eec6 100644 --- a/test/unit/runner/suite-runner/regular-suite-runner.js +++ b/test/unit/runner/suite-runner/regular-suite-runner.js @@ -1,403 +1,334 @@ 'use strict'; -var q = require('q'), - CaptureSession = require('lib/capture-session'), - suiteRunner = require('lib/runner/suite-runner'), - StateRunner = require('lib/runner/state-runner/state-runner'), - BrowserAgent = require('lib/runner/browser-runner/browser-agent'), - Config = require('lib/config'), - util = require('../../../util'), - makeSuiteStub = util.makeSuiteStub; - -describe('runner/suite-runner/regular-suite-runner', function() { - var sandbox = sinon.sandbox.create(), - browser; - - beforeEach(function() { + +const Promise = require('bluebird'); +const BrowserAgent = require('gemini-core').BrowserAgent; + +const RegularSuiteRunner = require('lib/runner/suite-runner/regular-suite-runner'); +const StateRunnerFactory = require('lib/runner/state-runner'); +const StateRunner = require('lib/runner/state-runner/state-runner'); +const CaptureSession = require('lib/capture-session'); +const NoRefImageError = require('lib/errors/no-ref-image-error'); +const util = require('../../../util'); +const makeSuiteStub = util.makeSuiteStub; +const rejectedPromise = util.rejectedPromise; + +describe('runner/suite-runner/regular-suite-runner', () => { + const sandbox = sinon.sandbox.create(); + + let stateRunner; + let stateRunnerFactory; + + let browser; + + beforeEach(() => { browser = util.browserWithId('default-browser'); sandbox.stub(browser, 'openRelative'); - browser.openRelative.returns(q.resolve()); + browser.openRelative.returns(Promise.resolve()); - sandbox.stub(BrowserAgent.prototype); - BrowserAgent.prototype.getBrowser.returns(q.resolve(browser)); - BrowserAgent.prototype.freeBrowser.returns(q.resolve()); + sandbox.stub(BrowserAgent.prototype, 'getBrowser'); + sandbox.stub(BrowserAgent.prototype, 'freeBrowser'); - sandbox.stub(StateRunner.prototype); - StateRunner.prototype.run.returns(q.resolve()); + BrowserAgent.prototype.getBrowser.returns(Promise.resolve(browser)); + BrowserAgent.prototype.freeBrowser.returns(Promise.resolve()); sandbox.stub(CaptureSession.prototype); - CaptureSession.prototype.runActions.returns(q.resolve()); + CaptureSession.prototype.runActions.returns(Promise.resolve()); CaptureSession.prototype.browser = browser; - }); - afterEach(function() { - sandbox.restore(); + stateRunner = sinon.createStubInstance(StateRunner); + stateRunnerFactory = sandbox.stub(StateRunnerFactory); + stateRunnerFactory.create.returns(stateRunner); }); - function mkRunner_(suite, browserId) { - var browserAgent = new BrowserAgent(); + afterEach(() => sandbox.restore()); + + const mkRunner_ = (suite, browserId) => { + const browserAgent = new BrowserAgent(); browserAgent.browserId = browserId || browser.id; - return suiteRunner.create( + return RegularSuiteRunner.create( suite || makeSuiteStub(), - browserAgent, - sinon.createStubInstance(Config) + browserAgent ); - } + }; - function run_(suite, stateProcessor) { + const run_ = (suite, stateProcessor) => { suite = suite || makeSuiteStub({ states: [util.makeStateStub()] }); - var runner = mkRunner_(suite); + const runner = mkRunner_(suite); + return runner.run(stateProcessor); - } + }; - describe('run', function() { - it('should emit `beginSuite` event', function() { - var onBeginSuite = sinon.spy().named('onBeginSuite'), - suite = makeSuiteStub(), - runner = mkRunner_(suite, 'browser'); + describe('run', () => { + it('should emit `beginSuite` event', () => { + const onBeginSuite = sinon.spy().named('onBeginSuite'); + const suite = makeSuiteStub(); + const runner = mkRunner_(suite, 'browser'); runner.on('beginSuite', onBeginSuite); return runner.run() - .then(function() { - assert.calledWith(onBeginSuite, { - suite: suite, - browserId: 'browser' - }); - }); + .then(() => assert.calledWith(onBeginSuite, {suite, browserId: 'browser'})); }); - it('should emit `endSuite` event', function() { - var onEndSuite = sinon.spy().named('onEndSuite'), - suite = makeSuiteStub(), - runner = mkRunner_(suite, 'browser'); + it('should emit `endSuite` event', () => { + const onEndSuite = sinon.spy().named('onEndSuite'); + const suite = makeSuiteStub(); + const runner = mkRunner_(suite, 'browser'); runner.on('endSuite', onEndSuite); return runner.run() - .then(function() { - assert.calledWith(onEndSuite, { - suite: suite, - browserId: 'browser' - }); - }); + .then(() => assert.calledWith(onEndSuite, {suite, browserId: 'browser'})); }); - it('should emit events in correct order', function() { - var onBeginSuite = sinon.spy().named('onBeginSuite'), - onEndSuite = sinon.spy().named('onEndSuite'), - runner = mkRunner_(); + it('should emit events in correct order', () => { + const onBeginSuite = sinon.spy().named('onBeginSuite'); + const onEndSuite = sinon.spy().named('onEndSuite'); + const runner = mkRunner_(); runner.on('beginSuite', onBeginSuite); runner.on('endSuite', onEndSuite); return runner.run() - .then(function() { - assert.callOrder( - onBeginSuite, - onEndSuite - ); - }); + .then(() => assert.callOrder(onBeginSuite, onEndSuite)); }); - it('should get new browser before open url', function() { + it('should get new browser before open url', () => { return run_() - .then(function() { - assert.callOrder( - BrowserAgent.prototype.getBrowser, - browser.openRelative - ); - }); + .then(() => assert.callOrder( + BrowserAgent.prototype.getBrowser, + browser.openRelative + )); }); - it('should open suite url in browser', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()], - url: '/path' - }); + it('should open suite url in browser', () => { + const suite = makeSuiteStub({ + states: [util.makeStateStub()], + url: '/path' + }); return run_(suite) - .then(function() { - assert.calledWith(browser.openRelative, '/path'); - }); + .then(() => assert.calledWith(browser.openRelative, '/path')); }); - it('should not call any actions if no states', function() { - var suite = makeSuiteStub(); + it('should run `before` actions', () => { + const suite = makeSuiteStub({ + states: [util.makeStateStub()] + }); return run_(suite) - .then(function() { - assert.notCalled(CaptureSession.prototype.runActions); - }); + .then(() => assert.calledWith(CaptureSession.prototype.runActions, suite.beforeActions)); }); - it('should run `before` actions if there are some states', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()] - }); - - return run_(suite) - .then(function() { - assert.calledWith(CaptureSession.prototype.runActions, suite.beforeActions); - }); - }); + it('should run states', () => { + const state = util.makeStateStub(); + const suite = makeSuiteStub({states: [state]}); - it('should run states', function() { - var state = util.makeStateStub(), - suite = makeSuiteStub({ - states: [state] - }); + stateRunnerFactory.create.withArgs(state).returns(stateRunner); return run_(suite) - .then(function() { - assert.calledWith(StateRunner.prototype.__constructor, state); - assert.calledOnce(StateRunner.prototype.run); - }); + .then(() => assert.calledOnce(stateRunner.run)); }); - it('should passthrough capture processor to state runner', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()] - }); + it('should passthrough capture processor to state runner', () => { + const suite = makeSuiteStub({states: [util.makeStateStub()]}); return run_(suite, 'stateProcessor') - .then(function() { - assert.calledWith(StateRunner.prototype.run, 'stateProcessor'); - }); + .then(() => assert.calledWith(stateRunner.run, 'stateProcessor')); }); - describe('if can not get a browser', function() { - beforeEach(function() { - BrowserAgent.prototype.getBrowser.returns(q.reject(new Error())); - }); + describe('if can not get a browser', () => { + beforeEach(() => BrowserAgent.prototype.getBrowser.returns(rejectedPromise())); - it('should pass an error to all states', function() { - var suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}), - runner = mkRunner_(suiteTree.suite), - onErrorHandler = sinon.spy(); + it('should pass an error to all states', () => { + const suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}); + const runner = mkRunner_(suiteTree.suite); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledTwice(onErrorHandler); assert.calledWithMatch(onErrorHandler, {state: {name: 'first-state'}}); assert.calledWithMatch(onErrorHandler, {state: {name: 'second-state'}}); }); }); - it('should pass a browser id to an error', function() { - var state = util.makeStateStub(), - runner = mkRunner_(state.suite, 'browser'), - onErrorHandler = sinon.spy(); + it('should pass a browser id to an error', () => { + const state = util.makeStateStub(); + const runner = mkRunner_(state.suite, 'browser'); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); return runner.run() - .then(function() { - assert.calledWithMatch(onErrorHandler, {browserId: 'browser'}); - }); + .then(() => assert.calledWithMatch(onErrorHandler, {browserId: 'browser'})); }); - it('should not run states', function() { + it('should not run states', () => { return run_() - .then(function() { - assert.notCalled(StateRunner.prototype.run); - }); + .then(() => assert.notCalled(stateRunner.run)); }); }); - describe('if can not open url in a browser', function() { - beforeEach(function() { - browser.openRelative.returns(q.reject(new Error())); + describe('if can not open url in a browser', () => { + beforeEach(() => { + browser.openRelative.returns(rejectedPromise()); }); - it('should pass an error to all states', function() { - var suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}), - runner = mkRunner_(suiteTree.suite), - onErrorHandler = sinon.spy(); + it('should pass an error to all states', () => { + const suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}); + const runner = mkRunner_(suiteTree.suite); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledTwice(onErrorHandler); assert.calledWithMatch(onErrorHandler, {state: {name: 'first-state'}}); assert.calledWithMatch(onErrorHandler, {state: {name: 'second-state'}}); }); }); - it('should pass a session id to an error', function() { - var state = util.makeStateStub(), - runner = mkRunner_(state.suite), - onErrorHandler = sinon.spy(); + it('should pass a session id to an error', () => { + const state = util.makeStateStub(); + const runner = mkRunner_(state.suite); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); browser.sessionId = 100500; return runner.run() - .then(function() { - assert.calledWithMatch(onErrorHandler, {sessionId: 100500}); - }); + .then(() => assert.calledWithMatch(onErrorHandler, {sessionId: 100500})); }); - it('should not run states', function() { + it('should not run states', () => { return run_() - .then(function() { - assert.notCalled(StateRunner.prototype.run); - }); + .then(() => assert.notCalled(stateRunner.run)); }); }); - describe('if `beforeActions` failed', function() { - var suite; + describe('if `beforeActions` failed', () => { + let suite; - beforeEach(function() { + beforeEach(() => { suite = makeSuiteStub({ states: [util.makeStateStub()] }); - CaptureSession.prototype.runActions.withArgs(suite.beforeActions).returns(q.reject(new Error())); + CaptureSession.prototype.runActions.withArgs(suite.beforeActions).returns(rejectedPromise()); }); - it('should pass an error to all states', function() { - var suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}), - runner = mkRunner_(suiteTree.suite), - onErrorHandler = sinon.spy(); + it('should pass an error to all states', () => { + const suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}); + const runner = mkRunner_(suiteTree.suite); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledTwice(onErrorHandler); assert.calledWithMatch(onErrorHandler, {state: {name: 'first-state'}}); assert.calledWithMatch(onErrorHandler, {state: {name: 'second-state'}}); }); }); - it('should pass a session id to an error', function() { - var runner = mkRunner_(suite), - onErrorHandler = sinon.spy(); + it('should pass a session id to an error', () => { + const runner = mkRunner_(suite); + const onErrorHandler = sinon.spy(); runner.on('err', onErrorHandler); browser.sessionId = 100500; return runner.run() - .then(function() { - assert.calledWithMatch(onErrorHandler, {sessionId: 100500}); - }); + .then(() => assert.calledWithMatch(onErrorHandler, {sessionId: 100500})); }); - it('should not run states', function() { + it('should not run states', () => { return run_(suite) - .fail(function() { - assert.notCalled(StateRunner.prototype.run); - }); + .catch(() => assert.notCalled(stateRunner.run)); }); - it('should not run `afterActions`', function() { + it('should not run `afterActions`', () => { return run_(suite) - .fail(function() { + .catch(() => { assert.neverCalledWith(CaptureSession.prototype.runActions, suite.afterActions); }); }); - it('should not run post actions', function() { + it('should not run post actions', () => { return run_(suite) - .fail(function() { - assert.notCalled(CaptureSession.prototype.runPostActions); - }); + .catch(() => assert.notCalled(CaptureSession.prototype.runPostActions)); }); }); - it('should run next state only after previous has been finished', function() { - var suite = makeSuiteStub(), - state1 = util.makeStateStub(suite), - state2 = util.makeStateStub(suite), - mediator = sinon.spy(); + it('should run next state only after previous has been finished', () => { + const suite = makeSuiteStub(); + const state1 = util.makeStateStub(suite); + const state2 = util.makeStateStub(suite); + const mediator = sinon.spy(); - StateRunner.prototype.run.onFirstCall().returns(q.delay(1).then(mediator)); + stateRunner.run.onFirstCall().returns(Promise.delay(50).then(mediator)); return run_(suite) - .then(function() { + .then(() => { assert.callOrder( - StateRunner.prototype.__constructor.withArgs(state1).named('state1 runner'), + stateRunnerFactory.create.withArgs(state1).returns(stateRunner).named('stateRunner1'), mediator.named('middle function'), - StateRunner.prototype.__constructor.withArgs(state2).named('state2 runner') + stateRunnerFactory.create.withArgs(state2).returns(stateRunner).named('stateRunner2') ); }); }); - it('should not run states after cancel', function() { - var state = util.makeStateStub(), - suite = makeSuiteStub({ - states: [state] - }), - runner = mkRunner_(suite); - - runner.cancel(); - - return runner.run() - .then(function() { - assert.notCalled(StateRunner.prototype.run); - }); - }); - - it('should not run state after failed state', function() { - var state1 = util.makeStateStub(), - state2 = util.makeStateStub(), - suite = makeSuiteStub({ - states: [state1, state2] - }); + it('should not run state after failed state', () => { + const state1 = util.makeStateStub(); + const state2 = util.makeStateStub(); + const suite = makeSuiteStub({states: [state1, state2]}); - StateRunner.prototype.run.withArgs(state1).returns(q.reject()); + stateRunner.run.withArgs(state1).returns(rejectedPromise()); return run_(suite) - .fail(function() { - assert.neverCalledWith(StateRunner.prototype.run, state2); - }); + .catch(() => assert.neverCalledWith(stateRunner.run, state2)); }); - describe('afterActions', function() { - it('should perform afterActions', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()] - }); + describe('afterActions', () => { + it('should perform afterActions', () => { + const suite = makeSuiteStub({states: [util.makeStateStub()]}); return run_(suite) - .then(function() { + .then(() => { assert.calledWith(CaptureSession.prototype.runActions, suite.afterActions); }); }); - it('should perform afterActions even if state failed', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()] - }); + it('should perform afterActions even if state failed', () => { + const suite = makeSuiteStub({states: [util.makeStateStub()]}); - StateRunner.prototype.run.returns(q.reject()); + stateRunner.run.returns(rejectedPromise()); return run_(suite) - .fail(function() { - assert.calledWith(CaptureSession.prototype.runActions, suite.afterActions); - }); + .catch(() => assert.calledWith(CaptureSession.prototype.runActions, suite.afterActions)); }); - it('should pass an error to all states if `afterActions` failed', function() { - var suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}), - runner = mkRunner_(suiteTree.suite), - onErrorHandler = sinon.spy(); + it('should pass an error to all states if `afterActions` failed', () => { + const suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}); + const runner = mkRunner_(suiteTree.suite); + const onErrorHandler = sinon.spy(); CaptureSession.prototype.runActions.withArgs(suiteTree.suite.afterActions) - .returns(q.reject(new Error())); + .returns(rejectedPromise()); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledWith(onErrorHandler); assert.calledWithMatch(onErrorHandler, {state: {name: 'first-state'}}); assert.calledWithMatch(onErrorHandler, {state: {name: 'second-state'}}); @@ -405,76 +336,68 @@ describe('runner/suite-runner/regular-suite-runner', function() { }); }); - describe('postActions', function() { - it('should run post actions', function() { + describe('postActions', () => { + it('should run post actions', () => { return run_() - .then(function() { - assert.calledOnce(CaptureSession.prototype.runPostActions); - }); + .then(() => assert.calledOnce(CaptureSession.prototype.runPostActions)); }); - it('should pass an error to all states if post actions failed', function() { - var suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}), - runner = mkRunner_(suiteTree.suite), - onErrorHandler = sinon.spy(); + it('should pass an error to all states if post actions failed', () => { + const suiteTree = util.makeSuiteTree({suite: ['first-state', 'second-state']}); + const runner = mkRunner_(suiteTree.suite); + const onErrorHandler = sinon.spy(); - CaptureSession.prototype.runPostActions.returns(q.reject(new Error())); + CaptureSession.prototype.runPostActions.returns(rejectedPromise()); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledTwice(onErrorHandler); assert.calledWithMatch(onErrorHandler, {state: {name: 'first-state'}}); assert.calledWithMatch(onErrorHandler, {state: {name: 'second-state'}}); }); }); - it('should run post actions if state failed', function() { - StateRunner.prototype.run.returns(q.reject()); + it('should run post actions if state failed', () => { + stateRunner.run.returns(rejectedPromise()); return run_() - .fail(function() { - assert.calledOnce(CaptureSession.prototype.runPostActions); - }); + .catch(() => assert.calledOnce(CaptureSession.prototype.runPostActions)); }); - it('should run post actions if `afterActions` failed', function() { - var suite = makeSuiteStub({ - states: [util.makeStateStub()] - }); + it('should run post actions if `afterActions` failed', () => { + const suite = makeSuiteStub({states: [util.makeStateStub()]}); - CaptureSession.prototype.runActions.withArgs(suite.afterActions).returns(q.reject()); + CaptureSession.prototype.runActions.withArgs(suite.afterActions).returns(rejectedPromise()); return run_(suite) - .fail(function() { - assert.calledOnce(CaptureSession.prototype.runPostActions); - }); + .catch(() => assert.calledOnce(CaptureSession.prototype.runPostActions)); }); - it('should pass an afterActions error to all states if afterActions and postActions failed', function() { - var suite = util.makeSuiteStub({states: [util.makeStateStub()]}), - runner = mkRunner_(suite), - onErrorHandler = sinon.spy(); + it('should pass an afterActions error to all states if afterActions and postActions failed', () => { + const suite = util.makeSuiteStub({states: [util.makeStateStub()]}); + const runner = mkRunner_(suite); + const onErrorHandler = sinon.spy(); CaptureSession.prototype.runActions.withArgs(suite.afterActions) - .returns(q.reject(new Error('after-actions-error'))); - CaptureSession.prototype.runPostActions.returns(q.reject(new Error('post-actions-error'))); + .returns(rejectedPromise('after-actions-error')); + CaptureSession.prototype.runPostActions.returns(rejectedPromise('post-actions-error')); runner.on('err', onErrorHandler); return runner.run() - .then(function() { + .then(() => { assert.calledWithMatch(onErrorHandler, {message: 'after-actions-error'}); assert.neverCalledWithMatch(onErrorHandler, {message: 'post-actions-error'}); }); }); }); - describe('freeBrowser', function() { - it('should free browser after all', function() { + describe('freeBrowser', () => { + it('should free browser after all', () => { return run_() - .then(function() { + .then(() => { assert.callOrder( CaptureSession.prototype.runPostActions, BrowserAgent.prototype.freeBrowser @@ -482,27 +405,38 @@ describe('runner/suite-runner/regular-suite-runner', function() { }); }); - it('should free browser if run states failed', function() { - StateRunner.prototype.run.returns(q.reject()); + it('should free browser if run states failed', () => { + stateRunner.run.returns(rejectedPromise()); + + return run_() + .catch(() => assert.calledOnce(BrowserAgent.prototype.freeBrowser)); + }); + + it('should invalidate session after error in test', () => { + CaptureSession.prototype.runActions.returns(rejectedPromise()); + + return run_() + .catch(() => { + assert.calledWith(BrowserAgent.prototype.freeBrowser, sinon.match.any, {force: true}); + }); + }); + + it('should not invalidate session if reference image does not exist', () => { + CaptureSession.prototype.runActions.returns(rejectedPromise(new NoRefImageError())); return run_() - .fail(function() { - assert.calledOnce(BrowserAgent.prototype.freeBrowser); + .then(() => { + assert.calledWith(BrowserAgent.prototype.freeBrowser, sinon.match.any, {force: false}); }); }); }); - it('should add `browserId` and `sessionId` to error if something failed', function() { + it('should add `browserId` and `sessionId` to error if something failed', () => { browser.sessionId = 'test-session-id'; - CaptureSession.prototype.runActions.returns(q.reject(new Error('test_error'))); + CaptureSession.prototype.runActions.returns(rejectedPromise('test_error')); return run_() - .fail(function(e) { - assert.deepEqual(e, { - browserId: 'default-browser', - sessionId: 'test-session-id' - }); - }); + .catch((e) => assert.deepEqual(e, {browserId: 'default-browser', sessionId: 'test-session-id'})); }); }); }); diff --git a/test/unit/runner/suite-runner/skipped-suite-runner.js b/test/unit/runner/suite-runner/skipped-suite-runner.js index fa7eebd4b..2313949a2 100644 --- a/test/unit/runner/suite-runner/skipped-suite-runner.js +++ b/test/unit/runner/suite-runner/skipped-suite-runner.js @@ -1,73 +1,67 @@ 'use strict'; -var BrowserAgent = require('lib/runner/browser-runner/browser-agent'), - SkippedSuiteRunner = require('lib/runner/suite-runner/skipped-suite-runner'), - util = require('../../../util'); +const BrowserAgent = require('gemini-core').BrowserAgent; +const SkippedSuiteRunner = require('lib/runner/suite-runner/skipped-suite-runner'); +const util = require('../../../util'); -describe('runner/suite-runner/skipped-suite-runner', function() { - var sandbox = sinon.sandbox.create(), - runner; +describe('runner/suite-runner/skipped-suite-runner', () => { + const sandbox = sinon.sandbox.create(); - function mkRunner_(suite, browserId) { + let runner; + + const mkRunner_ = (suite, browserId) => { suite = suite || util.makeSuiteStub(); - var browserAgent = new BrowserAgent(); + const browserAgent = new BrowserAgent(); browserAgent.browserId = browserId || 'default-browser'; return new SkippedSuiteRunner(suite, browserAgent); - } + }; - beforeEach(function() { - sandbox.stub(BrowserAgent.prototype); + beforeEach(() => { + sandbox.stub(BrowserAgent.prototype, 'getBrowser'); + sandbox.stub(BrowserAgent.prototype, 'freeBrowser'); runner = mkRunner_(); }); - afterEach(function() { - sandbox.restore(); - }); + afterEach(() => sandbox.restore()); - it('should emit `beginSuite` event', function() { - var onBeginSuite = sinon.spy().named('onBeginSuite'); + it('should emit `beginSuite` event', () => { + const onBeginSuite = sinon.spy().named('onBeginSuite'); runner.on('beginSuite', onBeginSuite); return runner.run() - .then(function() { - assert.calledOnce(onBeginSuite); - }); + .then(() => assert.calledOnce(onBeginSuite)); }); - it('should emit `endSuite` event', function() { - var onEndSuite = sinon.spy().named('onEndSuite'); + it('should emit `endSuite` event', () => { + const onEndSuite = sinon.spy().named('onEndSuite'); runner.on('endSuite', onEndSuite); return runner.run() - .then(function() { - assert.calledOnce(onEndSuite); - }); + .then(() => assert.calledOnce(onEndSuite)); }); - it('should not get/free browser on run', function() { + it('should not get/free browser on run', () => { return runner.run() - .then(function() { + .then(() => { assert.notCalled(BrowserAgent.prototype.getBrowser); assert.notCalled(BrowserAgent.prototype.freeBrowser); }); }); - it('should emit `skipState` for suite state', function() { - var state = util.makeStateStub(), - suite = util.makeSuiteStub({ - states: [state] - }), - onSkipState = sinon.spy().named('onSkipState'), - runner = mkRunner_(suite, 'some-browser'); + it('should emit `skipState` for suite state', () => { + const state = util.makeStateStub(); + const suite = util.makeSuiteStub({states: [state]}); + const onSkipState = sinon.spy().named('onSkipState'); + const runner = mkRunner_(suite, 'some-browser'); runner.on('skipState', onSkipState); return runner.run() - .then(function() { + .then(() => { assert.calledWith(onSkipState, { suite: suite, state: state, @@ -76,18 +70,16 @@ describe('runner/suite-runner/skipped-suite-runner', function() { }); }); - it('should emit `skipState` for each suite state', function() { - var suite = util.makeSuiteStub({ - states: [util.makeStateStub(), util.makeStateStub()] - }), - onSkipState = sinon.spy().named('onSkipState'), - runner = mkRunner_(suite); + it('should emit `skipState` for each suite state', () => { + const suite = util.makeSuiteStub({ + states: [util.makeStateStub(), util.makeStateStub()] + }); + const onSkipState = sinon.spy().named('onSkipState'); + const runner = mkRunner_(suite); runner.on('skipState', onSkipState); return runner.run() - .then(function() { - assert.calledTwice(onSkipState); - }); + .then(() => assert.calledTwice(onSkipState)); }); }); diff --git a/test/unit/runner/suite-runner/stateless-suite-runner.js b/test/unit/runner/suite-runner/stateless-suite-runner.js index 3f007e5c0..47a156432 100644 --- a/test/unit/runner/suite-runner/stateless-suite-runner.js +++ b/test/unit/runner/suite-runner/stateless-suite-runner.js @@ -1,48 +1,43 @@ 'use strict'; -var BrowserAgent = require('lib/runner/browser-runner/browser-agent'), - StatelessSuiteRunner = require('lib/runner/suite-runner/stateless-suite-runner'), - util = require('../../../util'); - -describe('runner/suite-runner/stateless-suite-runner', function() { - var sandbox = sinon.sandbox.create(), - suite = util.makeSuiteStub(), - browserAgent = new BrowserAgent('default-browser'), - runner = new StatelessSuiteRunner(suite, browserAgent); - - beforeEach(function() { - sandbox.stub(BrowserAgent.prototype); +const BrowserAgent = require('gemini-core').BrowserAgent; +const StatelessSuiteRunner = require('lib/runner/suite-runner/stateless-suite-runner'); +const util = require('../../../util'); + +describe('runner/suite-runner/stateless-suite-runner', () => { + const sandbox = sinon.sandbox.create(); + const suite = util.makeSuiteStub(); + const browserAgent = BrowserAgent.create('default-browser'); + const runner = new StatelessSuiteRunner(suite, browserAgent); + + beforeEach(() => { + sandbox.stub(BrowserAgent.prototype, 'getBrowser'); + sandbox.stub(BrowserAgent.prototype, 'freeBrowser'); }); - afterEach(function() { - sandbox.restore(); - }); + afterEach(() => sandbox.restore()); - it('should emit `beginSuite` event', function() { - var onBeginSuite = sinon.spy().named('onBeginSuite'); + it('should emit `beginSuite` event', () => { + const onBeginSuite = sinon.spy().named('onBeginSuite'); runner.on('beginSuite', onBeginSuite); return runner.run() - .then(function() { - assert.calledOnce(onBeginSuite); - }); + .then(() => assert.calledOnce(onBeginSuite)); }); - it('should emit `endSuite` event', function() { - var onEndSuite = sinon.spy().named('onEndSuite'); + it('should emit `endSuite` event', () => { + const onEndSuite = sinon.spy().named('onEndSuite'); runner.on('endSuite', onEndSuite); return runner.run() - .then(function() { - assert.calledOnce(onEndSuite); - }); + .then(() => assert.calledOnce(onEndSuite)); }); - it('should not get/free browser on run', function() { + it('should not get/free browser on run', () => { return runner.run() - .then(function() { + .then(() => { assert.notCalled(BrowserAgent.prototype.getBrowser); assert.notCalled(BrowserAgent.prototype.freeBrowser); }); diff --git a/test/unit/runner/test-session-runner.js b/test/unit/runner/test-session-runner.js deleted file mode 100644 index c991fecc5..000000000 --- a/test/unit/runner/test-session-runner.js +++ /dev/null @@ -1,172 +0,0 @@ -'use strict'; -var q = require('q'), - TestSessionRunner = require('lib/runner/test-session-runner'), - BrowserRunner = require('lib/runner/browser-runner'), - pool = require('lib/browser-pool'), - BasicPool = require('lib/browser-pool/basic-pool'), - Config = require('lib/config'); - -describe('runner/TestSessionRunner', function() { - var sandbox = sinon.sandbox.create(), - config; - - beforeEach(function() { - sandbox.stub(pool, 'create'); - config = sinon.createStubInstance(Config); - }); - - afterEach(function() { - sandbox.restore(); - }); - - describe('create', function() { - beforeEach(function() { - sandbox.stub(BrowserRunner, 'create'); - BrowserRunner.create.returns(sinon.createStubInstance(BrowserRunner)); - }); - - it('should create runner for each browser in config if testBrowsers are not set', function() { - config.getBrowserIds - .returns(['browser1', 'browser2']); - - TestSessionRunner.create(config); - - assert.calledTwice(BrowserRunner.create); - assert.calledWith(BrowserRunner.create, 'browser1'); - assert.calledWith(BrowserRunner.create, 'browser2'); - }); - - it('should launch only browsers specified in testBrowsers', function() { - config.getBrowserIds - .returns(['browser1', 'browser2']); - - TestSessionRunner.create(config, ['browser1']); - - assert.calledOnce(BrowserRunner.create); - assert.calledWith(BrowserRunner.create, 'browser1'); - }); - }); - - describe('run', function() { - beforeEach(function() { - sandbox.stub(BrowserRunner.prototype); - BrowserRunner.prototype.run.returns(q.resolve()); - }); - - function run_(suites, stateProcessor) { - return TestSessionRunner.create(config).run(suites || [], stateProcessor); - } - - it('should emit `beginSession` event on start runner', function() { - config.getBrowserIds - .returns(['browser1']); - - var onBeginSession = sandbox.spy().named('onBeginSession'), - runner = TestSessionRunner.create(config); - - runner.on('beginSession', onBeginSession); - - runner.run() - .then(function() { - assert.called(onBeginSession); - }); - }); - - it('shoud run all created runners', function() { - config.getBrowserIds - .returns(['browser1', 'browser2']); - - run_(); - - assert.calledTwice(BrowserRunner.prototype.run); - assert.notEqual( - BrowserRunner.prototype.run.firstCall.thisValue, - BrowserRunner.prototype.run.secondCall.thisValue - ); - }); - - it('should run all suites in browser runner', function() { - config.getBrowserIds - .returns(['browser1']); - var suites = []; - - run_(suites); - - assert.calledWith(BrowserRunner.prototype.run, suites); - }); - - it('should pass through stateProcessor to browserRunner', function() { - var stateProcessor = 'stateProcessor'; - - config.getBrowserIds.returns(['browser']); - run_([], stateProcessor); - - assert.calledWith(BrowserRunner.prototype.run, sinon.match.any, stateProcessor); - }); - - it('should emit `endSession` event after test session finished', function() { - config.getBrowserIds - .returns(['browser1']); - - var onEndSession = sandbox.spy().named('onEndSession'), - runner = TestSessionRunner.create(config); - - runner.on('endSession', onEndSession); - - return runner.run() - .then(function() { - assert.called(onEndSession); - }); - }); - - it('should emit `beginSession` and `endSession` events in correct order', function() { - config.getBrowserIds - .returns(['browser1']); - - var onBeginSession = sandbox.spy().named('onBeginSession'), - onEndSession = sandbox.spy().named('onEndSession'), - runner = TestSessionRunner.create(config); - - runner.on('beginSession', onBeginSession); - runner.on('endSession', onEndSession); - - return runner.run() - .then(function() { - assert.callOrder(onBeginSession, onEndSession); - }); - }); - - describe('on error', function() { - beforeEach(function() { - config.getBrowserIds - .returns(['browser1', 'browser2']); - - BrowserRunner.prototype.run - .onFirstCall().returns(q.reject()); - - pool.create.returns(sinon.createStubInstance(BasicPool)); - }); - - it('should be rejected', function() { - return assert.isRejected(run_()); - }); - - it('should cancel all runners', function() { - return run_() - .fail(function() { - assert.calledTwice(BrowserRunner.prototype.cancel); - }); - }); - - it('should cancel browser pool', function() { - var browserPool = sinon.createStubInstance(BasicPool); - pool.create.returns(browserPool); - - return run_() - .fail(function() { - assert.calledOnce(browserPool.cancel); - }); - }); - }); - }); -}); diff --git a/test/unit/signal-handler.js b/test/unit/signal-handler.js index 3a5673a7f..6e5bc967c 100644 --- a/test/unit/signal-handler.js +++ b/test/unit/signal-handler.js @@ -1,26 +1,53 @@ 'use strict'; -var q = require('q'), - signalHandler = require('lib/signal-handler'); - -describe('signalHandler', function() { - var sandbox = sinon.sandbox.create(), - defer, onExit; - - beforeEach(function() { - defer = q.defer(); - onExit = sinon.spy(); - sandbox.stub(process, 'exit', defer.resolve.bind(defer)); - signalHandler.on('exit', onExit); +const _ = require('lodash'); +const Events = require('lib/constants/events'); +const signalHandler = require('lib/signal-handler'); +const logger = require('lib/utils').logger; + +describe('SignalHandler', () => { + const sandbox = sinon.sandbox.create(); + + beforeEach(() => { + sandbox.stub(logger, 'warn'); + + sandbox.stub(process, 'exit'); }); - afterEach(function() { - sandbox.restore(); + afterEach(() => sandbox.restore()); + + after(() => { + process.removeAllListeners('SIGHUP'); + process.removeAllListeners('SIGTERM'); }); - // Can't test SIGINT and SIGTERM because these signals will kill test process - it('should send `exit` on SIGHUP, SIGINT and SIGTERM', function() { - process.emit('SIGHUP'); - assert.calledOnce(onExit); + // SIGINT can not be tested as SIGTERM or SIGINT because mocha subscribes to SIGINT before running of tests + _.forEach({SIGHUP: 1, SIGTERM: 15}, (code, signal) => { + describe(`on ${signal}`, () => { + it('should emit "INTERRUPT" event', () => { + const onInterrupt = sinon.spy().named('onInterrupt'); + + signalHandler.on(Events.INTERRUPT, onInterrupt); + process.emit(`${signal}`); + + assert.calledOnce(onInterrupt); + }); + + it('should pass exit code', () => { + const onInterrupt = sinon.spy().named('onExit'); + + signalHandler.on(Events.INTERRUPT, onInterrupt); + process.emit(`${signal}`); + + assert.calledWith(onInterrupt, {exitCode: 128 + code}); + }); + + it(`should provide force exit on double ${signal}`, () => { + process.emit(`${signal}`); + process.emit(`${signal}`); + + assert.calledWith(process.exit, 128 + code); + }); + }); }); }); diff --git a/test/unit/state-processor/capture-processor/capture-processor.js b/test/unit/state-processor/capture-processor/capture-processor.js new file mode 100644 index 000000000..fba581ccc --- /dev/null +++ b/test/unit/state-processor/capture-processor/capture-processor.js @@ -0,0 +1,349 @@ +'use strict'; + +const _ = require('lodash'); +const fs = require('fs-extra'); +const Promise = require('bluebird'); +const {temp, Image} = require('gemini-core'); + +const utils = require('lib/state-processor/capture-processor/utils'); +const NoRefImageError = require('lib/errors/no-ref-image-error'); +const CaptureProcessor = require('lib/state-processor/capture-processor/capture-processor'); +const CaptureProcessorFactory = require('lib/state-processor/capture-processor'); + +describe('state-processor/capture-processor/capture-processor', () => { + const sandbox = sinon.sandbox.create(); + + const mkImage = (opts = {}) => { + opts = _.defaults(opts, {size: {width: 100500, height: 500100}}); + + return { + compare: Image.compare, + save: Image.prototype.save, + getSize: sandbox.stub().returns(opts.size) + }; + }; + + const mkExecMethod = (processor) => { + return (opts = {}, capture = {}) => { + opts = _.defaults(opts, {refImg: {path: '/default/path', size: null}}); + capture = _.defaults(capture, {image: mkImage()}); + + return processor.exec(capture, opts); + }; + }; + + let exec_; + + beforeEach(() => { + sandbox.stub(fs, 'readFileSync'); + sandbox.stub(temp, 'path'); + sandbox.stub(utils, 'copyImg').resolves(true); + sandbox.stub(utils, 'saveRef').resolves(true); + sandbox.stub(utils, 'existsRef').resolves(true); + sandbox.stub(Image, 'create').returns(Object.create(Image.prototype)); + sandbox.stub(Image, 'compare').resolves(true); + sandbox.stub(Image.prototype, 'save').resolves(); + sandbox.stub(Image.prototype, 'getSize'); + }); + + afterEach(() => sandbox.restore()); + + describe('images comparator', () => { + let someProcessor; + + beforeEach(() => { + someProcessor = CaptureProcessor.create() + .onEqual(sandbox.stub()) + .onDiff(sandbox.stub()) + .onReference(sandbox.stub()) + .onNoReference(sandbox.stub()); + + exec_ = mkExecMethod(someProcessor); + }); + + it('should save current image to a temporary directory', () => { + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + + return exec_() + .then(() => assert.calledOnceWith(Image.prototype.save, '/temp/path')); + }); + + it('should check that a reference image exists before saving a current image', () => { + const mediator = sinon.spy().named('mediator'); + + utils.existsRef.callsFake(() => Promise.delay(1).then(mediator).then(() => true)); + + return exec_() + .then(() => assert.callOrder(utils.existsRef, mediator, Image.prototype.save)); + }); + + it('should compare images with given set of parameters', () => { + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + + const opts = { + refImg: {path: '/ref/path', size: null}, + pixelRatio: 100500, + tolerance: 200500, + antialiasingTolerance: 300500, + compareOpts: {stopOnFirstFail: true} + }; + + return exec_(opts, {canHaveCaret: false}) + .then(() => { + assert.calledOnceWith(Image.compare, '/temp/path', '/ref/path', { + canHaveCaret: false, + pixelRatio: 100500, + tolerance: 200500, + antialiasingTolerance: 300500, + compareOpts: {stopOnFirstFail: true} + }); + }); + }); + + it('should compare images only after a current image is saved', () => { + const mediator = sinon.spy().named('mediator'); + + Image.prototype.save.callsFake(() => Promise.delay(1).then(mediator)); + + return exec_() + .then(() => assert.callOrder(Image.prototype.save, mediator, Image.compare)); + }); + }); + + describe('tester processor', () => { + let tester; + + beforeEach(() => { + tester = CaptureProcessorFactory.create('tester'); + exec_ = mkExecMethod(tester); + }); + + describe('reference image does not exist', () => { + beforeEach(() => { + utils.existsRef.withArgs('/non-existent/path').resolves(false); + }); + + it('should save current image to a temporary directory', () => { + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + + return exec_({refImg: {path: '/non-existent/path', size: null}}) + .catch(() => assert.calledOnceWith(Image.prototype.save, '/temp/path')); + }); + + it('should be rejected with "NoRefImageError"', () => { + return assert.isRejected(exec_({refImg: {path: '/non-existent/path', size: null}}), NoRefImageError); + }); + + it('should pass reference and current images to "NoRefImageError"', () => { + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + const currImage = mkImage({size: {width: 100, height: 200}}); + + return exec_({refImg: {path: '/non-existent/path', size: null}}, {image: currImage}) + .catch((err) => { + assert.deepEqual(err.refImg, {path: '/non-existent/path', size: null}); + assert.deepEqual(err.currImg, {path: '/temp/path', size: {width: 100, height: 200}}); + }); + }); + }); + + describe('should return image comparison result if images are', () => { + it('equal', () => { + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data'); + + const currImage = mkImage({size: {width: 100, height: 200}}); + Image.compare.resolves({equal: true, metaInfo: {refImg: {size: {width: 100, height: 200}}}}); + return exec_({refImg: {path: '/ref/path', size: null}}, {image: currImage}) + .then((result) => { + assert.deepEqual(result, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + currImg: {path: '/temp/path', size: {width: 100, height: 200}}, + equal: true + }); + }); + }); + + it('different', () => { + Image.compare.resolves({ + equal: false, + diffBounds: {left: 0, top: 0, right: 10, bottom: 10}, + diffClusters: [{left: 0, top: 0, right: 10, bottom: 10}], + metaInfo: {refImg: {size: {width: 100, height: 200}}} + }); + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data'); + + const currImage = mkImage({size: {width: 300, height: 400}}); + + return exec_({refImg: {path: '/ref/path', size: null}}, {image: currImage}) + .then((result) => { + assert.deepEqual(result, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + currImg: {path: '/temp/path', size: {width: 300, height: 400}}, + diffBounds: {left: 0, top: 0, right: 10, bottom: 10}, + diffClusters: [{left: 0, top: 0, right: 10, bottom: 10}], + equal: false + }); + }); + }); + }); + }); + + describe('new-updater processor', () => { + let newUpdater; + + beforeEach(() => { + newUpdater = CaptureProcessorFactory.create('new-updater'); + exec_ = mkExecMethod(newUpdater); + }); + + it('should not save a reference image if it is already exists', () => { + fs.readFileSync.withArgs('/existent/path').returns('existent-buffer-data'); + + const refImage = mkImage({size: {width: 100, height: 200}}); + Image.create.withArgs('existent-buffer-data').returns(refImage); + + return exec_({refImg: {path: '/existent/path'}}) + .then((res) => { + assert.notCalled(utils.saveRef); + assert.deepEqual(res, { + refImg: {path: '/existent/path'}, + updated: false + }); + }); + }); + + it('should save a reference image if it does not exist', () => { + utils.existsRef.resolves(false); + + const currImage = mkImage({size: {width: 100, height: 200}}); + const capture = {image: currImage}; + + return exec_({refImg: {path: '/ref/path', size: null}}, capture) + .then((res) => { + assert.calledOnceWith(utils.saveRef, '/ref/path', capture); + assert.deepEqual(res, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + updated: true + }); + }); + }); + }); + + describe('diff-updater processor', () => { + let diffUpdater; + + beforeEach(() => { + diffUpdater = CaptureProcessorFactory.create('diff-updater'); + exec_ = mkExecMethod(diffUpdater); + }); + + it('should not update a reference image if it does not exist', () => { + utils.existsRef.resolves(false); + + return exec_({refImg: {path: '/non-existent/path', size: null}}) + .then((res) => { + assert.notCalled(utils.copyImg); + assert.deepEqual(res, { + refImg: {path: '/non-existent/path', size: null}, + updated: false + }); + }); + }); + }); + + describe('meta-updater processor', () => { + let metaUpdater; + + beforeEach(() => { + metaUpdater = CaptureProcessorFactory.create('meta-updater'); + exec_ = mkExecMethod(metaUpdater); + }); + + it('should save a reference image if it does not exist', () => { + utils.existsRef.resolves(false); + + const currImage = mkImage({size: {width: 100, height: 200}}); + const capture = {image: currImage}; + + return exec_({refImg: {path: '/ref/path', size: null}}, capture) + .then((res) => { + assert.calledOnceWith(utils.saveRef, '/ref/path', capture); + assert.deepEqual(res, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + updated: true + }); + }); + }); + }); + + ['diff-updater', 'meta-updater'].forEach((updaterType) => { + describe(`${updaterType} processor`, () => { + let updater; + + beforeEach(() => { + updater = CaptureProcessorFactory.create(updaterType); + exec_ = mkExecMethod(updater); + }); + + it('should not update a reference image if images are the same', () => { + fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data'); + + Image.compare.resolves({equal: true, metaInfo: {refImg: {size: {width: 100, height: 200}}}}); + return exec_({refImg: {path: '/ref/path', size: null}}) + .then((res) => { + assert.notCalled(utils.copyImg); + assert.deepEqual(res, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + updated: false + }); + }); + }); + + describe('if images are different', () => { + beforeEach(() => { + Image.compare.resolves({equal: false}); + temp.path.withArgs({suffix: '.png'}).returns('/temp/path'); + }); + + it('should update a reference image', () => { + return exec_({refImg: {path: '/ref/path', size: null}}) + .then(() => assert.calledOnceWith(utils.copyImg, '/temp/path', '/ref/path')); + }); + + it('should update a reference image size', () => { + fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data'); + const refImage = mkImage({size: {width: 100, height: 200}}); + Image.create.withArgs('ref-buffer-data').returns(refImage); + + const currImage = mkImage({size: {width: 300, height: 400}}); + + return exec_({refImg: {path: '/ref/path', size: null}}, {image: currImage}) + .then((res) => { + assert.deepEqual(res, { + refImg: {path: '/ref/path', size: {width: 300, height: 400}}, + updated: true + }); + }); + }); + + it('should not update reference image size if copying image fails', () => { + utils.copyImg.resolves(false); + + fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data'); + + Image.compare.resolves({metaInfo: {refImg: {size: {width: 100, height: 200}}}}); + const currImage = mkImage({size: {width: 300, height: 400}}); + + return exec_({refImg: {path: '/ref/path'}}, {image: currImage}) + .then((res) => { + assert.deepEqual(res, { + refImg: {path: '/ref/path', size: {width: 100, height: 200}}, + updated: false + }); + }); + }); + }); + }); + }); +}); diff --git a/test/unit/state-processor/capture-processor/screen-updater/diff-screen-updater.test.js b/test/unit/state-processor/capture-processor/screen-updater/diff-screen-updater.test.js deleted file mode 100644 index ec61d9457..000000000 --- a/test/unit/state-processor/capture-processor/screen-updater/diff-screen-updater.test.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -const DiffScreenUpdater = require('lib/state-processor/capture-processor/screen-updater/diff-screen-updater'); -const temp = require('lib/temp'); -const q = require('q'); -const fs = require('q-io/fs'); -const Image = require('lib/image'); - -describe('diff-screen-updater', () => { - const sandbox = sinon.sandbox.create(); - let imageStub; - let imageCompareStub; - - function exec_(opts) { - opts = opts || {}; - const updater = new DiffScreenUpdater(), - capture = { - image: imageStub - }, - env = { - refPath: opts.refPath - }; - - capture.image.save.returns(q()); - - return updater.exec(capture, env); - } - - beforeEach(() => { - sandbox.stub(fs); - sandbox.stub(temp); - - imageStub = sinon.createStubInstance(Image); - imageCompareStub = sandbox.stub(Image, 'compare'); - imageStub.save.returns(q()); - - fs.exists.returns(q(true)); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('should save image to the temp directory before comparing', () => { - imageCompareStub.returns(q()); - temp.path.returns('/temp/path'); - - return exec_() - .then(() => { - assert.calledOnce(imageStub.save); - assert.calledWith(imageStub.save, '/temp/path'); - }); - }); - - it('should not compare images if reference image does not exist', () => { - fs.exists.returns(q(false)); - imageCompareStub.returns(q()); - - return exec_() - .then(() => { - assert.notCalled(Image.compare); - }); - }); - - it('should not save image if images are the same', () => { - imageCompareStub.returns(q(true)); - - return exec_() - .then(() => { - assert.notCalled(fs.copy); - }); - }); - - it('should save image if images are different', () => { - imageCompareStub.returns(q(false)); - temp.path.returns('/temp/path'); - - return exec_({refPath: '/ref/path'}) - .then(() => { - assert.calledWith(fs.copy, '/temp/path', '/ref/path'); - }); - }); - - it('should save image with correct suffix', () => { - imageCompareStub.returns(q(false)); - - return exec_() - .then(() => { - assert.calledWith(temp.path, {suffix: '.png'}); - }); - }); -}); diff --git a/test/unit/state-processor/capture-processor/screen-updater/index.test.js b/test/unit/state-processor/capture-processor/screen-updater/index.test.js deleted file mode 100644 index b2be9ca5d..000000000 --- a/test/unit/state-processor/capture-processor/screen-updater/index.test.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -var screenUpdater = require('lib/state-processor/capture-processor/screen-updater'), - DiffUpdater = require('lib/state-processor/capture-processor/screen-updater/diff-screen-updater'), - NewUpdater = require('lib/state-processor/capture-processor/screen-updater/new-screen-updater'), - MetaUpdater = require('lib/state-processor/capture-processor/screen-updater/meta-screen-updater'); - -describe('state-processor/screen-updater/create', function() { - it('should create MetaUpdater by default', function() { - var updater = screenUpdater.create({}); - - assert.instanceOf(updater, MetaUpdater); - }); - - it('should create DiffUpdater if "diff" option is exists', function() { - var updater = screenUpdater.create({diff: true}); - - assert.instanceOf(updater, DiffUpdater); - }); - - it('should create NewUpdater if "new" option is exists', function() { - var updater = screenUpdater.create({new: true}); - - assert.instanceOf(updater, NewUpdater); - }); - - it('should create MetaUpdater if "new" and "diff" options were applied', function() { - var updater = screenUpdater.create({diff: true, new: true}); - - assert.instanceOf(updater, MetaUpdater); - }); - - it('should create MetaUpdater if unknown option was applied', function() { - var updater = screenUpdater.create({unknownOption: true}); - - assert.instanceOf(updater, MetaUpdater); - }); -}); diff --git a/test/unit/state-processor/capture-processor/screen-updater/meta-screen-updater.test.js b/test/unit/state-processor/capture-processor/screen-updater/meta-screen-updater.test.js deleted file mode 100644 index 2b38e0aa2..000000000 --- a/test/unit/state-processor/capture-processor/screen-updater/meta-screen-updater.test.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -const q = require('q'); -const MetaScreenUpdater = require('lib/state-processor/capture-processor/screen-updater/meta-screen-updater'); -const temp = require('lib/temp'); -const fs = require('q-io/fs'); -const Image = require('lib/image'); - -describe('meta-screen-updater', () => { - const sandbox = sinon.sandbox.create(); - let imageStub; - - function exec_(opts) { - opts = opts || {}; - const updater = new MetaScreenUpdater(), - capture = { - image: imageStub - }, - env = { - refPath: opts.refPath - }; - - capture.image.save.returns(q()); - - return updater.exec(capture, env); - } - - beforeEach(() => { - sandbox.stub(fs); - sandbox.stub(temp); - sandbox.stub(Image, 'compare').returns(q()); - - imageStub = sinon.createStubInstance(Image); - imageStub.save.returns(q()); - - fs.exists.returns(q(true)); - fs.makeTree.returns(q()); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('should check file to exist once', () => { - return exec_() - .then(() => { - assert.calledOnce(fs.exists); - }); - }); - - it('should save temp image if reference image exists', () => { - fs.exists.returns(q(true)); - temp.path.returns('/temp/path'); - - return exec_() - .then(() => { - assert.calledOnce(imageStub.save); - assert.calledWith(imageStub.save, '/temp/path'); - }); - }); - - it('should save new reference if it does not exist', () => { - fs.exists.returns(q(false)); - - return exec_({refPath: '/ref/path'}) - .then(() => { - assert.calledOnce(imageStub.save); - assert.calledWith(imageStub.save, '/ref/path'); - }); - }); -}); diff --git a/test/unit/state-processor/capture-processor/screen-updater/new-screen-updater.test.js b/test/unit/state-processor/capture-processor/screen-updater/new-screen-updater.test.js deleted file mode 100644 index 4bac8ae1f..000000000 --- a/test/unit/state-processor/capture-processor/screen-updater/new-screen-updater.test.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -const NewScreenUpdater = require('lib/state-processor/capture-processor/screen-updater/new-screen-updater'); -const q = require('q'); -const fs = require('q-io/fs'); -const Image = require('lib/image'); - -describe('new-screen-updater', () => { - const sandbox = sinon.sandbox.create(); - let imageStub; - - beforeEach(() => { - sandbox.stub(fs); - fs.makeTree.returns(q()); - - imageStub = sinon.createStubInstance(Image); - imageStub.save.returns(q()); - }); - - afterEach(() => { - sandbox.restore(); - }); - - function exec_(opts) { - opts = opts || {}; - const updater = new NewScreenUpdater(), - capture = { - image: imageStub - }, - env = { - refPath: opts.refPath - }; - - capture.image.save.returns(q()); - - return updater.exec(capture, env); - } - - it('should make directory before saving the image', () => { - const mediator = sinon.spy().named('mediator'); - fs.exists.returns(q(false)); - fs.makeTree.returns(q.delay(1).then(mediator)); - - return exec_() - .then(() => { - assert.callOrder( - fs.makeTree, - mediator, - imageStub.save - ); - }); - }); - - it('should save new image if it does not exists', () => { - fs.exists.returns(q(false)); - - return exec_({refPath: '/some/path'}) - .then(() => { - assert.calledWith(imageStub.save, '/some/path'); - }); - }); - - it('should not save image if it already exists', () => { - fs.exists.returns(q(true)); - - return exec_() - .then(() => { - assert.notCalled(imageStub.save); - }); - }); - - it('should save image with correct path', () => { - fs.exists.returns(q(false)); - - return exec_({refPath: '/ref/path'}) - .then(() => { - assert.calledWith(imageStub.save, '/ref/path'); - }); - }); -}); diff --git a/test/unit/state-processor/capture-processor/tester.js b/test/unit/state-processor/capture-processor/tester.js deleted file mode 100644 index 6baca2456..000000000 --- a/test/unit/state-processor/capture-processor/tester.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -const fs = require('q-io/fs'); -const q = require('q'); -const temp = require('lib/temp'); -const Image = require('lib/image'); -const NoRefImageError = require('lib/errors/no-ref-image-error'); -const Tester = require('lib/state-processor/capture-processor/tester'); - -describe('state-processor/capture-processor/tester', () => { - const sandbox = sinon.sandbox.create(); - - afterEach(() => sandbox.restore()); - - it('should have static factory creation method', () => { - assert.instanceOf(Tester.create(), Tester); - }); - - describe('exec', () => { - let capture; - let tester; - - beforeEach(() => { - sandbox.stub(temp, 'path').returns('tmp/path'); - sandbox.stub(Image, 'compare').returns(true); - sandbox.stub(fs, 'exists').returns(q(true)); - - capture = { - canHaveCaret: true, - image: { - save: sandbox.stub().returns(q()) - } - }; - - tester = Tester.create('#diff'); - }); - - it('should save image into temporary folder', () => { - return tester.exec(capture, {}) - .then(() => { - assert.calledWith(capture.image.save, 'tmp/path'); - }); - }); - - it('should reject with error if reference image does not exist', () => { - fs.exists.returns(q(false)); - return assert.isRejected(tester.exec(capture, {}), NoRefImageError); - }); - - it('should compare images with given set of parameters', () => { - const options = { - refPath: 'some/ref/path', - pixelRatio: 99, - tolerance: 23 - }; - - return tester.exec(capture, options) - .then(() => { - assert.calledWith(Image.compare, 'tmp/path', 'some/ref/path', { - canHaveCaret: true, - pixelRatio: 99, - tolerance: 23 - }); - }); - }); - - it('should return image comparison result', () => { - return tester.exec(capture, {refPath: 'some/ref/path'}) - .then((result) => { - assert.deepEqual(result, { - currentPath: 'tmp/path', - referencePath: 'some/ref/path', - equal: true - }); - }); - }); - }); -}); diff --git a/test/unit/state-processor/capture-processor/utils.js b/test/unit/state-processor/capture-processor/utils.js new file mode 100644 index 000000000..0826fae64 --- /dev/null +++ b/test/unit/state-processor/capture-processor/utils.js @@ -0,0 +1,110 @@ +'use strict'; + +const _ = require('lodash'); +const fs = require('fs-extra'); +const Promise = require('bluebird'); +const {Image} = require('gemini-core'); + +const utils = require('lib/state-processor/capture-processor/utils'); + +describe('state-processor/capture-processor/utils', () => { + const sandbox = sinon.sandbox.create(); + + afterEach(() => sandbox.restore()); + + describe('copyImg', () => { + beforeEach(() => sandbox.stub(fs, 'copyAsync').returns(Promise.resolve())); + + it('should copy a current image to reference path', () => { + return utils.copyImg('/temp/path', '/ref/path') + .then(() => assert.calledOnceWith(fs.copyAsync, '/temp/path', '/ref/path')); + }); + + describe('should return', () => { + it('"true" if a current image is copied successfully', () => { + return utils.copyImg('/temp/path', '/ref/path') + .then((res) => assert.isTrue(res)); + }); + + it('"false" if a current image was not copied', () => { + fs.copyAsync.rejects(); + + return utils.copyImg('/temp/path', '/ref/path') + .then((res) => assert.isFalse(res)); + }); + }); + }); + + describe('saveRef', () => { + const save_ = (opts) => { + opts = _.defaults(opts || {}, { + refPath: '/default/path' + }); + + return utils.saveRef(opts.refPath, _.set({}, 'image.save', Image.prototype.save)); + }; + + beforeEach(() => { + sandbox.stub(fs, 'mkdirsAsync').returns(Promise.resolve()); + sandbox.stub(Image.prototype, 'save').returns(Promise.resolve()); + }); + + it('should make a directory before saving the image', () => { + const mediator = sinon.spy().named('mediator'); + + fs.mkdirsAsync.callsFake(() => Promise.delay(1).then(mediator)); + + return save_() + .then(() => assert.callOrder(fs.mkdirsAsync, mediator, Image.prototype.save)); + }); + + it('should save an image with the given path', () => { + return save_({refPath: '/ref/path'}) + .then(() => assert.calledOnceWith(Image.prototype.save, '/ref/path')); + }); + + describe('should return', () => { + it('"true" if the directory is created and the image saved successfully', () => { + return save_({refPath: '/ref/path'}) + .then((res) => assert.isTrue(res)); + }); + + it('"false" if the directory was not created', () => { + fs.mkdirsAsync.rejects(); + + return save_({refPath: '/ref/path'}) + .then((res) => assert.isFalse(res)); + }); + + it('"false" if the image was not saved', () => { + Image.prototype.save.rejects(); + + return save_({refPath: '/ref/path'}) + .then((res) => assert.isFalse(res)); + }); + }); + }); + + describe('existsRef', () => { + beforeEach(() => sandbox.stub(fs, 'accessAsync').returns(Promise.resolve())); + + it('should check the reference image existence', () => { + return utils.existsRef('/ref/path') + .then(() => assert.calledOnceWith(fs.accessAsync, '/ref/path')); + }); + + describe('should return', () => { + it('"true" if the reference image exists', () => { + return utils.existsRef('/ref/path') + .then((res) => assert.isTrue(res)); + }); + + it('"false" if the reference image does not exists', () => { + fs.accessAsync.rejects(); + + return utils.existsRef('/ref/path') + .then((res) => assert.isFalse(res)); + }); + }); + }); +}); diff --git a/test/unit/state-processor/job.js b/test/unit/state-processor/job.js index 19630302f..67cfc3cca 100644 --- a/test/unit/state-processor/job.js +++ b/test/unit/state-processor/job.js @@ -1,83 +1,59 @@ 'use strict'; -var CaptureSession = require('lib/capture-session'), - CaptureProcessor = require('lib/state-processor/capture-processor/capture-processor'), - temp = require('lib/temp'), - proxyquire = require('proxyquire').noCallThru(), - q = require('q'), - _ = require('lodash'); +const CaptureSession = require('lib/capture-session'); +const CaptureProcessor = require('lib/state-processor/capture-processor/capture-processor'); +const {temp} = require('gemini-core'); +const proxyquire = require('proxyquire').noCallThru(); +const Promise = require('bluebird'); +const _ = require('lodash'); describe('state-processor/job', () => { - var sandbox = sinon.sandbox.create(), - CaptureProcessorStub, - captureProcessor, - browserSession; + const sandbox = sinon.sandbox.create(); + + let captureProcessor; + let browserSession; + + const execJob_ = (opts) => { + const job = proxyquire('lib/state-processor/job', { + './capture-processor': CaptureProcessor + }); + + return job(opts || {}, _.noop); + }; beforeEach(() => { captureProcessor = sinon.createStubInstance(CaptureProcessor); - captureProcessor.exec.returns(q({})); - - CaptureProcessorStub = { - create: sinon.stub().returns(captureProcessor) - }; + sandbox.stub(CaptureProcessor, 'create').returns(captureProcessor); + captureProcessor.exec.returns(Promise.resolve({})); browserSession = sinon.createStubInstance(CaptureSession); browserSession.capture.returns({}); - sandbox.stub(CaptureSession, 'fromObject').returns(q(browserSession)); - - sandbox.stub(temp); - }); + sandbox.stub(CaptureSession, 'fromObject').returns(Promise.resolve(browserSession)); - afterEach(() => { - sandbox.restore(); + sandbox.stub(temp, 'attach'); }); - function execJob_(opts) { - opts = _.defaults(opts || {}, { - captureProcessorInfo: { - module: '/path/to/some/module' - } - }); - - var stubs = _.set({}, opts.captureProcessorInfo.module, CaptureProcessorStub), - job = proxyquire('lib/state-processor/job', stubs); - - return job(opts, _.noop); - } + afterEach(() => sandbox.restore()); it('should create capture processor', () => { - execJob_({ - captureProcessorInfo: { - module: '/some/module', - constructorArg: 'some-arg' - } - }); + execJob_({captureProcessorType: 'some-type'}); - assert.calledOnce(CaptureProcessorStub.create); - assert.calledWith(CaptureProcessorStub.create, 'some-arg'); + assert.calledOnceWith(CaptureProcessor.create, 'some-type'); }); it('should capture screenshot', () => { - var page = { - captureArea: {} - }; + const page = {captureArea: {}}; return execJob_({page}) - .then(() => { - assert.calledOnce(browserSession.capture); - assert.calledWith(browserSession.capture, page); - }); + .then(() => assert.calledOnceWith(browserSession.capture, page)); }); it('should process captured screenshot', () => { - var capture = {some: 'capture'}; - browserSession.capture.returns(q(capture)); - - return execJob_() - .then(() => { - assert.calledOnce(captureProcessor.exec); - assert.calledWith(captureProcessor.exec, capture); - }); + const capture = {some: 'capture'}; + browserSession.capture.returns(Promise.resolve(capture)); + + return execJob_({}) + .then(() => assert.calledOnceWith(captureProcessor.exec, capture)); }); }); diff --git a/test/unit/state-processor/state-processor.js b/test/unit/state-processor/state-processor.js index d97c933e6..d4f2224e9 100644 --- a/test/unit/state-processor/state-processor.js +++ b/test/unit/state-processor/state-processor.js @@ -1,19 +1,17 @@ 'use strict'; -var CaptureSession = require('lib/capture-session'), - CaptureProcessor = require('lib/state-processor/capture-processor/capture-processor'), - temp = require('lib/temp'), - util = require('../../util'), - errorUtils = require('lib/errors/utils'), - proxyquire = require('proxyquire').noCallThru(), - _ = require('lodash'), - QEmitter = require('qemitter'), - q = require('q'); +const CaptureSession = require('lib/capture-session'); +const {temp} = require('gemini-core'); +const util = require('../../util'); +const errorUtils = require('lib/errors/utils'); +const proxyquire = require('proxyquire').noCallThru(); +const _ = require('lodash'); +const AsyncEmitter = require('gemini-core').events.AsyncEmitter; +const Promise = require('bluebird'); describe('state-processor/state-processor', () => { - var sandbox = sinon.sandbox.create(), - job = sinon.stub(), - captureProcessor; + const sandbox = sinon.sandbox.create(); + const job = sinon.stub(); beforeEach(() => { sandbox.stub(temp); @@ -26,39 +24,32 @@ describe('state-processor/state-processor', () => { }); describe('exec', () => { - var browserSession; + let browserSession; - beforeEach(() => { - browserSession = sinon.createStubInstance(CaptureSession); - _.set(browserSession, 'browser.config', { - getScreenshotPath: sinon.stub() - }); - - captureProcessor = sinon.createStubInstance(CaptureProcessor); - }); - - function exec_(opts) { + const exec_ = (opts) => { opts = _.defaultsDeep(opts || {}, { - captureProcessorInfo: { - module: '/some/default/module' - }, + captureProcessorType: 'default-type', state: util.makeStateStub(), page: {} }); - var stubs = { + const StateProcessor = proxyquire('lib/state-processor/state-processor', { 'worker-farm': () => { return (args, cb) => cb(null, job(args)); } - }; - stubs[opts.captureProcessorInfo.module] = {create: () => captureProcessor}; - - var StateProcessor = proxyquire('lib/state-processor/state-processor', stubs), - stateProcessor = new StateProcessor(opts.captureProcessorInfo); + }); + const stateProcessor = new StateProcessor(opts.captureProcessorType, 4); - stateProcessor.prepare(new QEmitter()); + stateProcessor.prepare(new AsyncEmitter()); return stateProcessor.exec(opts.state, browserSession, opts.page); - } + }; + + beforeEach(() => { + browserSession = sinon.createStubInstance(CaptureSession); + _.set(browserSession, 'browser.config', { + getScreenshotPath: sinon.stub() + }); + }); it('should perform job', () => { return exec_() @@ -74,31 +65,23 @@ describe('state-processor/state-processor', () => { })); }); - it('should pass capture processor info to job', () => { - var captureProcessorInfo = { - module: '/some/module', - constructorArg: {some: 'arg'} - }; + it('should pass capture processor type to job', () => { + const captureProcessorType = 'some-type'; - return exec_({captureProcessorInfo}) - .then(() => assert.calledWithMatch(job, {captureProcessorInfo})); + return exec_({captureProcessorType}) + .then(() => assert.calledWithMatch(job, {captureProcessorType})); }); it('should pass page disposition to job', () => { - return exec_({ - page: {some: 'data'} - }) + return exec_(_.set({}, 'page.some', 'data')) .then(() => assert.calledWithMatch(job, { page: {some: 'data'} })); }); it('should not pass coverage data to job', () => { - return exec_({ - page: { - coverage: 'some-big-object' - } - }).then(() => assert.neverCalledWithMatch(job, { + return exec_(_.set({}, 'page.coverage', 'some-big-object')) + .then(() => assert.neverCalledWithMatch(job, { page: { coverage: 'some-big-object' } @@ -115,27 +98,29 @@ describe('state-processor/state-processor', () => { }); it('should use browser config options in processing', () => { - var state = util.makeStateStub(); + const state = util.makeStateStub(); browserSession.browser.config.getScreenshotPath.returns('/some/path'); browserSession.browser.config.tolerance = 100500; + browserSession.browser.config.antialiasingTolerance = 200500; - return exec_({state: state}) + return exec_({state}) .then(() => assert.calledWithMatch(job, { execOpts: { - refPath: '/some/path', - tolerance: 100500 + refImg: {path: '/some/path', size: null}, + tolerance: 100500, + antialiasingTolerance: 200500 } })); }); it('should use state tolerance if it set', () => { - var state = util.makeStateStub(); + const state = util.makeStateStub(); state.tolerance = 1; browserSession.browser.config.tolerance = 100500; - return exec_({state: state}) + return exec_({state}) .then(() => assert.calledWithMatch(job, { execOpts: { tolerance: 1 @@ -144,12 +129,12 @@ describe('state-processor/state-processor', () => { }); it('should use state tolerance even if it set to 0', () => { - var state = util.makeStateStub(); + const state = util.makeStateStub(); state.tolerance = 0; browserSession.browser.config.tolerance = 100500; - return exec_({state: state}) + return exec_({state}) .then(() => assert.calledWithMatch(job, { execOpts: { tolerance: 0 @@ -158,11 +143,7 @@ describe('state-processor/state-processor', () => { }); it('should use page pixel ratio', () => { - const opts = { - page: { - pixelRatio: 11 - } - }; + const opts = _.set({}, 'page.pixelRatio', 11); return exec_(opts) .then(() => assert.calledWithMatch(job, { @@ -173,13 +154,13 @@ describe('state-processor/state-processor', () => { }); it('should restore error object inheritance', () => { - sandbox.stub(q, 'nfcall').returns(q.reject({name: 'NoRefImageError'})); + sandbox.stub(Promise, 'fromCallback').rejects({name: 'NoRefImageError'}); sandbox.stub(errorUtils, 'fromPlainObject') .withArgs({name: 'NoRefImageError'}) .returns({restored: 'object'}); return exec_() - .fail((err) => { + .catch((err) => { assert.calledOnce(errorUtils.fromPlainObject); assert.deepEqual(err, {restored: 'object'}); }); diff --git a/test/unit/state-processor/test-state-processor.js b/test/unit/state-processor/test-state-processor.js new file mode 100644 index 000000000..a2707101d --- /dev/null +++ b/test/unit/state-processor/test-state-processor.js @@ -0,0 +1,136 @@ +'use strict'; + +const _ = require('lodash'); +const Promise = require('bluebird'); + +const CaptureSession = require('lib/capture-session'); +const StateProcessor = require('lib/state-processor/state-processor'); +const TestStateProcessor = require('lib/state-processor/test-state-processor'); +const {Image} = require('gemini-core'); +const util = require('../../util'); + +describe('state-processor/test-state-processor', () => { + const sandbox = sinon.sandbox.create(); + + const mkTestStateProc_ = () => { + const config = _.set({}, 'system.diffColor', '#ff00ff'); + return new TestStateProcessor(config); + }; + + const exec_ = (opts) => { + opts = _.defaultsDeep(opts || {}, { + state: util.makeStateStub(), + browserSession: sinon.createStubInstance(CaptureSession), + page: {}, + emit: sinon.spy() + }); + + return mkTestStateProc_().exec(opts.state, opts.browserSession, opts.page, opts.emit); + }; + + beforeEach(() => { + sandbox.stub(StateProcessor.prototype, 'exec'); + sandbox.stub(Image, 'buildDiff'); + }); + + afterEach(() => sandbox.restore()); + + describe('exec', () => { + it('should call base class exec method with correct args', () => { + const state = util.makeStateStub(); + const page = {}; + const browserSession = sinon.createStubInstance(CaptureSession); + + StateProcessor.prototype.exec.returns(Promise.resolve({})); + + return exec_({state, browserSession, page}) + .then(() => { + assert.calledWithExactly(StateProcessor.prototype.exec, state, browserSession, page); + }); + }); + + it('should return result from calling base class exec method', () => { + const result = {equal: true}; + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_() + .then(() => { + assert.eventually.deepEqual(StateProcessor.prototype.exec.getCall(0).returnValue, result); + }); + }); + + it('should emit "TEST_RESULT" event with "saveDiffTo" func when images aren\'t equal', () => { + const result = {equal: false}; + const emit = sandbox.stub(); + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_({emit}) + .then(() => { + assert.calledWithExactly(emit, 'testResult', _.extend(result, {saveDiffTo: () => {}})); + }); + }); + + it('should emit "TEST_RESULT" event without "saveDiffTo" func when images are equal', () => { + const result = {equal: true}; + const emit = sandbox.stub(); + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_({emit}) + .then(() => { + assert.calledWithExactly(emit, 'testResult', result); + }); + }); + + describe('should build diff image with', () => { + const mkBrowserSession_ = (opts = {}) => _.set({}, 'browser.config', opts); + const mkResult_ = (opts = {}) => { + return _.defaults(opts, { + equal: false, + refImg: {path: '/default-ref/path'}, + currImg: {path: '/default-curr/path'} + }); + }; + + it('options from "buildDiffOpts"', () => { + const result = mkResult_(); + const buildDiffOpts = {foo: 'bar', baz: 'qux'}; + const browserSession = mkBrowserSession_({buildDiffOpts}); + const emit = sandbox.stub(); + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_({emit, browserSession}) + .then(() => { + result.saveDiffTo(); + + assert.calledOnceWith( + Image.buildDiff, + sinon.match({foo: 'bar', baz: 'qux'}) + ); + }); + }); + + it('with overriden option from "buildDiffOpts"', () => { + const result = mkResult_({tolerance: 100500}); + const buildDiffOpts = {tolerance: 500100}; + const browserSession = mkBrowserSession_({buildDiffOpts}); + const emit = sandbox.stub(); + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_({emit, browserSession}) + .then(() => { + result.saveDiffTo(); + + assert.calledOnceWith( + Image.buildDiff, + sinon.match({tolerance: 500100}) + ); + }); + }); + }); + }); +}); diff --git a/test/unit/state-processor/update-state-processor.js b/test/unit/state-processor/update-state-processor.js new file mode 100644 index 000000000..e0a2697ce --- /dev/null +++ b/test/unit/state-processor/update-state-processor.js @@ -0,0 +1,54 @@ +'use strict'; + +const _ = require('lodash'); +const Promise = require('bluebird'); + +const CaptureSession = require('lib/capture-session'); +const StateProcessor = require('lib/state-processor/state-processor'); +const UpdateStateProcessor = require('lib/state-processor/update-state-processor'); +const util = require('../../util'); + +describe('state-processor/update-state-processor', () => { + const sandbox = sinon.sandbox.create(); + const config = {system: {workers: 4}}; + + const exec_ = (opts) => { + opts = _.defaultsDeep(opts || {}, { + state: util.makeStateStub(), + browserSession: sinon.createStubInstance(CaptureSession), + page: {}, + emit: sinon.spy() + }); + + return new UpdateStateProcessor(config, {}).exec(opts.state, opts.browserSession, opts.page, opts.emit); + }; + + beforeEach(() => sandbox.stub(StateProcessor.prototype, 'exec')); + + afterEach(() => sandbox.restore()); + + describe('exec', () => { + it('should call base class "exec" method with correct args', () => { + const state = util.makeStateStub(); + const page = {}; + const browserSession = sinon.createStubInstance(CaptureSession); + + StateProcessor.prototype.exec.returns(Promise.resolve({})); + + return exec_({state, browserSession, page}) + .then(() => { + assert.calledWithExactly(StateProcessor.prototype.exec, state, browserSession, page); + }); + }); + + it('should emit "UPDATE_RESULT" event', () => { + const result = {updated: true}; + const emit = sandbox.stub(); + + StateProcessor.prototype.exec.returns(Promise.resolve(result)); + + return exec_({emit}) + .then(() => assert.calledWithExactly(emit, 'updateResult', result)); + }); + }); +}); diff --git a/test/unit/state.js b/test/unit/state.js index a9a0ff563..af0bb088d 100644 --- a/test/unit/state.js +++ b/test/unit/state.js @@ -2,18 +2,16 @@ const State = require('lib/state'); const util = require('../util'); -const suiteUtil = require('lib/suite-util'); describe('state methods', () => { describe('shouldSkip', () => { it('should check if state will be skipped', () => { const suite = util.makeSuiteStub(); + suite.shouldSkip = sinon.stub(); + suite.shouldSkip.withArgs('browserId').returns(true); const state = new State(suite); - sinon.stub(suiteUtil, 'shouldSkip').returns(true); - state.shouldSkip('browserId'); - - assert.calledWithMatch(suiteUtil.shouldSkip, suite, 'browserId'); + assert.isTrue(state.shouldSkip('browserId')); }); }); @@ -54,4 +52,32 @@ describe('state methods', () => { assert.equal(state[method], suite[method]); }); }); + + describe('clone method', () => { + it('should return cloned state', () => { + const state = new State({}); + const clonedState = state.clone(); + + assert.notEqual(state, clonedState); + }); + + it('should clone actions from the origin state', () => { + const state = new State({}); + state.actions.push('actions'); + + const clonedState = state.clone(); + state.actions.push('anotherAction'); + + assert.deepEqual(clonedState.actions, ['actions']); + }); + + it('should clone tolerance from the origin state', () => { + const state = new State({}); + state.tolerance = 100; + + const clonedState = state.clone(); + + assert.equal(clonedState.tolerance, 100); + }); + }); }); diff --git a/test/unit/stats.js b/test/unit/stats.js new file mode 100644 index 000000000..d2fcfa0fe --- /dev/null +++ b/test/unit/stats.js @@ -0,0 +1,125 @@ +'use strict'; + +const {EventEmitter} = require('events'); +const RunnerEvents = require('../../lib/constants/events'); +const Stats = require('../../lib/stats'); +const {makeStateResult} = require('../util'); + +describe('Stats', () => { + let stats; + let runner; + + beforeEach(() => { + runner = new EventEmitter(); + stats = new Stats(); + stats.attachRunner(runner); + }); + + it('should count skipped tests', () => { + runner.emit(RunnerEvents.SKIP_STATE, makeStateResult()); + + assert.equal(stats.getResult().skipped, 1); + }); + + it('should count updated tests', () => { + runner.emit(RunnerEvents.UPDATE_RESULT, makeStateResult({updated: true})); + + assert.equal(stats.getResult().updated, 1); + }); + + it('should count passed tests on "UPDATE_RESULT" event', () => { + runner.emit(RunnerEvents.UPDATE_RESULT, makeStateResult({updated: false})); + + assert.equal(stats.getResult().passed, 1); + }); + + it('should count failed tests on "ERROR" event', () => { + runner.emit(RunnerEvents.ERROR, makeStateResult()); + + assert.equal(stats.getResult().failed, 1); + }); + + it('should count failed tests on "TEST_RESULT" event', () => { + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: false})); + + assert.equal(stats.getResult().failed, 1); + }); + + it('should count passed tests on "TEST_RESULT" event', () => { + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: true})); + + assert.equal(stats.getResult().passed, 1); + }); + + it('should count retried tests on "RETRY" event', () => { + runner.emit(RunnerEvents.RETRY, makeStateResult({name: 'some-test'})); + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: true, name: 'some-test'})); + + assert.equal(stats.getResult().total, 1); + assert.equal(stats.getResult().retries, 1); + assert.equal(stats.getResult().passed, 1); + }); + + it('should count total test count', () => { + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: false, name: 'first'})); + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: true, name: 'second'})); + + assert.equal(stats.getResult().total, 2); + }); + + it('should return correct full statistic', () => { + runner.emit(RunnerEvents.UPDATE_RESULT, makeStateResult({updated: true, name: 'updated'})); + runner.emit(RunnerEvents.RETRY, makeStateResult({name: 'passed'})); + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: true, name: 'passed'})); + runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: false, name: 'failed'})); + runner.emit(RunnerEvents.ERROR, makeStateResult({name: 'errored'})); + runner.emit(RunnerEvents.SKIP_STATE, makeStateResult({name: 'skipped'})); + + assert.deepEqual(stats.getResult(), { + total: 5, + updated: 1, + passed: 1, + failed: 2, + skipped: 1, + retries: 1 + }); + }); + + it('should handle cases when several events were emitted for the same test', () => { + runner.emit(RunnerEvents.SKIP_STATE, makeStateResult({name: 'some-state'})); + runner.emit(RunnerEvents.ERROR, makeStateResult({name: 'some-state'})); + + assert.equal(stats.getResult().skipped, 0); + assert.equal(stats.getResult().failed, 1); + }); + + it('should not count test result twice for same state and browser', () => { + const test = makeStateResult({ + browserId: 'test_browser', + state: 'test_state' + }); + + runner.emit(RunnerEvents.ERROR, test); + runner.emit(RunnerEvents.ERROR, test); + + assert.equal(stats.getResult().total, 1); + assert.equal(stats.getResult().failed, 1); + }); + + it('should correctly handle tests with the similar titles', () => { + const test1 = makeStateResult({ + suite: {fullName: 'some case'}, + browserId: 'bro' + }); + const test2 = makeStateResult({ + suite: {fullName: 'some cas'}, + browserId: 'ebro' + }); + + runner.emit(RunnerEvents.ERROR, test1); + runner.emit(RunnerEvents.ERROR, test2); + + assert.equal(stats.getResult().total, 2); + assert.equal(stats.getResult().failed, 2); + }); +}); diff --git a/test/unit/stats.test.js b/test/unit/stats.test.js deleted file mode 100644 index 7a75aed6e..000000000 --- a/test/unit/stats.test.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; -var EventEmitter = require('events').EventEmitter, - inherit = require('inherit'), - - Stats = require('lib/stats'), - RunnerEvents = require('lib/constants/runner-events'); - -describe('stats', function() { - var stats; - - beforeEach(function() { - stats = new Stats(); - }); - - it('should return \'undefined\' before adding keys', function() { - assert.isUndefined(stats.get('counter')); - }); - - it('should allow to add new key', function() { - stats.add('counter'); - assert.equal(stats.get('counter'), 1); - }); - - it('should increment existing keys', function() { - stats.add('counter'); - stats.add('counter'); - assert.equal(stats.get('counter'), 2); - }); - - it('should return all full stat', function() { - stats.add('counter'); - stats.add('counter'); - stats.add('counter'); - stats.add('counter2'); - stats.add('counter3'); - stats.add('counter3'); - assert.deepEqual(stats.get(), { - counter: 3, - counter2: 1, - counter3: 2 - }); - }); -}); - -describe('stats listener', function() { - var stats, - Runner = inherit(EventEmitter, {}), - runner; - - beforeEach(function() { - runner = new Runner(); - stats = new Stats(runner); - }); - - it('should return undefined before triggering any events', function() { - assert.isUndefined(stats.get('total')); - }); - - it('should count on beginState event', function() { - runner.emit(RunnerEvents.BEGIN_STATE); - assert.equal(stats.get('total'), 1); - }); - - it('should count on skipState event', function() { - runner.emit(RunnerEvents.SKIP_STATE); - assert.equal(stats.get('total'), 1); - assert.equal(stats.get('skipped'), 1); - }); - - it('should count on warning event', function() { - runner.emit(RunnerEvents.WARNING); - assert.equal(stats.get('warned'), 1); - }); - - it('should count on error event', function() { - runner.emit(RunnerEvents.ERROR); - assert.equal(stats.get('errored'), 1); - }); - - it('should count on capture event', function() { - runner.emit(RunnerEvents.CAPTURE); - assert.equal(stats.get('gathered'), 1); - }); - - it('should count test passed', function() { - runner.emit(RunnerEvents.END_TEST, {equal: true}); - assert.equal(stats.get('passed'), 1); - }); - - it('should count test failed', function() { - runner.emit(RunnerEvents.END_TEST, {equal: false}); - assert.equal(stats.get('failed'), 1); - }); -}); diff --git a/test/unit/suite-collection.js b/test/unit/suite-collection.js index 521fa2a8f..28ad062c8 100644 --- a/test/unit/suite-collection.js +++ b/test/unit/suite-collection.js @@ -1,65 +1,121 @@ 'use strict'; -var SuiteCollection = require('lib/suite-collection'), - mkTree = require('../util').makeSuiteTree; +const proxyquire = require('proxyquire'); +const mkTree = require('../util').makeSuiteTree; +const mkSuite = require('../util').makeSuiteStub; + +describe('suite-collection', () => { + const sandbox = sinon.sandbox.create(); + + let SuiteBuilder; + let SuiteCollection; + + beforeEach(() => { + SuiteBuilder = sandbox.stub(); + SuiteCollection = proxyquire('lib/suite-collection', { + './tests-api/suite-builder': SuiteBuilder + }); + }); + + afterEach(() => sandbox.restore()); + + describe('topLevelSuites', () => { + it('should return empty list on empty collection', () => { + const collection = new SuiteCollection(); -describe('suite-collection', function() { - describe('topLevelSuites', function() { - it('should return empty list on empty collection', function() { - var collection = new SuiteCollection(); assert.deepEqual([], collection.topLevelSuites()); }); - it('should return all suites from collection', function() { - var tree = mkTree({ - suite1: [], - suite2: [] - }), - collection = new SuiteCollection(); + it('should return all suites from collection', () => { + const tree = mkTree({ + suite1: [], + suite2: [] + }); + const collection = new SuiteCollection(); collection .add(tree.suite1) .add(tree.suite2); - assert.deepEqual( - [tree.suite1, tree.suite2], - collection.topLevelSuites() - ); + assert.deepEqual([tree.suite1, tree.suite2], collection.topLevelSuites()); }); - it('should return only top level suites', function() { - var tree = mkTree({ - parent: { - child: [] - } - }), - collection = new SuiteCollection(); + it('should return only top level suites', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); + const collection = new SuiteCollection(); collection.add(tree.parent); - assert.deepEqual( - [tree.parent], - collection.topLevelSuites() - ); + assert.deepEqual([tree.parent], collection.topLevelSuites()); + }); + }); + + describe('clone method', () => { + it('should leave top level parent for each tl suite', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); + + const collection = new SuiteCollection([tree.child]); + const clonedCollection = collection.clone(); + const clonedChild = clonedCollection.topLevelSuites()[0]; + + assert.equal(clonedChild.parent, tree.child.parent); + }); + + it('should not add new children to top level parent', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); + + const collection = new SuiteCollection([tree.child]); + const clonedCollection = collection.clone(); + + assert.lengthOf(clonedCollection.topLevelSuites()[0].parent.children, 1); + }); + + it('should return new suite collection', () => { + const collection = new SuiteCollection(); + const clonedCollection = collection.clone(); + + assert.notEqual(clonedCollection, collection); + }); + + it('should clone all suites from the collection', () => { + const tree = mkTree({suite: []}); + const collection = new SuiteCollection([tree.suite]); + sandbox.stub(tree.suite, 'clone'); + collection.clone(); + + assert.calledOnce(collection.topLevelSuites()[0].clone); }); }); - describe('allSuites', function() { - it('should return empty list on empty collection', function() { - var collection = new SuiteCollection(); + describe('allSuites', () => { + it('should return empty list on empty collection', () => { + const collection = new SuiteCollection(); + assert.deepEqual([], collection.allSuites()); }); - it('should return all suites including children', function() { - var tree = mkTree({ - parent: { - child: { - grandchild1: [], - grandchild2: [] - } + it('should return all suites including children', () => { + const tree = mkTree({ + parent: { + child: { + grandchild1: [], + grandchild2: [] } - }), - collection = new SuiteCollection(); + } + }); + const collection = new SuiteCollection(); collection.add(tree.parent); @@ -75,13 +131,13 @@ describe('suite-collection', function() { }); }); - describe('enable/disable', function() { - it('all tests should be enabled by default', function() { - var tree = mkTree({ - parent: { - child: ['state1', 'state2'] - } - }, {browsers: ['b1', 'b2']}); + describe('enable/disable', () => { + it('all tests should be enabled by default', () => { + const tree = mkTree({ + parent: { + child: ['state1', 'state2'] + } + }, {browsers: ['b1', 'b2']}); assert.deepEqual(tree.parent.browsers, ['b1', 'b2']); assert.deepEqual(tree.child.browsers, ['b1', 'b2']); @@ -89,40 +145,38 @@ describe('suite-collection', function() { assert.deepEqual(tree.state2.browsers, ['b1', 'b2']); }); - describe('disableAll', function() { - it('should disable all suites', function() { - var tree = mkTree({ - parent: { - child: [] - } - }); + describe('disableAll', () => { + it('should disable all suites', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); - new SuiteCollection([tree.parent]) - .disableAll(); + new SuiteCollection([tree.parent]).disableAll(); assert.deepEqual(tree.parent.browsers, []); assert.deepEqual(tree.child.browsers, []); }); - it('should not disable parent suite if it not in collection', function() { - var tree = mkTree({ - parent: { - child: [] - } - }, {browsers: ['b1', 'b2']}); + it('should not disable parent suite if it not in collection', () => { + const tree = mkTree({ + parent: { + child: [] + } + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.child]) - .disableAll(); + new SuiteCollection([tree.child]).disableAll(); assert.deepEqual(tree.parent.browsers, ['b1', 'b2']); }); - it('should disable all suites after enable', function() { - var tree = mkTree({ - parent: { - child: [] - } - }); + it('should disable all suites after enable', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); new SuiteCollection([tree.parent]) .enableAll() @@ -133,58 +187,55 @@ describe('suite-collection', function() { }); }); - describe('disable', function() { - it('should disable only passed suite and its subtree', function() { - var tree = mkTree({ - parent: { - child: { - grandchild: [] - } + describe('disable', () => { + it('should disable only passed suite and its subtree', () => { + const tree = mkTree({ + parent: { + child: { + grandchild: [] } - }, {browsers: ['b1', 'b2']}); + } + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.parent]) - .disable(tree.child); + new SuiteCollection([tree.parent]).disable(tree.child); assert.deepEqual(tree.parent.browsers, ['b1', 'b2']); assert.deepEqual(tree.child.browsers, []); assert.deepEqual(tree.grandchild.browsers, []); }); - it('should disable suite by full name', function() { - var tree = mkTree({ - parent: { - child: [] - } - }); + it('should disable suite by full name', () => { + const tree = mkTree({ + parent: { + child: [] + } + }); - new SuiteCollection([tree.parent]) - .disable(tree.child.fullName); + new SuiteCollection([tree.parent]).disable(tree.child.fullName); assert.deepEqual(tree.child.browsers, []); }); - it('should fail on attempt to disable unknown suite', function() { - var tree = mkTree({ - suite: [] - }), - collection = new SuiteCollection([tree.suite]); + it('should fail on attempt to disable unknown suite', () => { + const tree = mkTree({ + suite: [] + }); + const collection = new SuiteCollection([tree.suite]); - assert.throws(function() { + assert.throws(() => { collection.disable('some bad suite'); }, /Unknown/); }); - it('should disable whole subtree including states', function() { - var tree = mkTree({ - parent: { - child1: ['state1'], - child2: ['state2', 'state3'] - } - }); + it('should disable whole subtree including states', () => { + const tree = mkTree({ + parent: { + child1: ['state1'], + child2: ['state2', 'state3'] + } + }); - new SuiteCollection([tree.parent]) - .disable(tree.parent); + new SuiteCollection([tree.parent]).disable(tree.parent); assert.deepEqual(tree.parent.browsers, []); assert.deepEqual(tree.child1.browsers, []); @@ -194,14 +245,14 @@ describe('suite-collection', function() { assert.deepEqual(tree.state3.browsers, []); }); - it('should disable subtree even if it was enabled', function() { - var tree = mkTree({ - parent: { - child: { - grandchild: [] - } + it('should disable subtree even if it was enabled', () => { + const tree = mkTree({ + parent: { + child: { + grandchild: [] } - }, {browsers: ['b1', 'b2']}); + } + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.parent]) .enableAll() @@ -212,47 +263,45 @@ describe('suite-collection', function() { assert.deepEqual(tree.grandchild.browsers, []); }); - it('should disable only specified state', function() { - var tree = mkTree({ - suite: ['someState', 'otherState'] - }, {browsers: ['b1', 'b2']}); + it('should disable only specified state', () => { + const tree = mkTree({ + suite: ['someState', 'otherState'] + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.suite]) - .disable(tree.suite, {state: 'someState'}); + new SuiteCollection([tree.suite]).disable(tree.suite, {state: 'someState'}); assert.deepEqual(tree.someState.browsers, []); assert.deepEqual(tree.otherState.browsers, ['b1', 'b2']); }); - it('should fail to disable unknown state', function() { - var tree = mkTree({ - suite: ['someState'] - }), - collection = new SuiteCollection([tree.suite]); + it('should fail to disable unknown state', () => { + const tree = mkTree({ + suite: ['someState'] + }); + const collection = new SuiteCollection([tree.suite]); - assert.throws(function() { + assert.throws(() => { collection.disable(tree.suite, {state: 'otherState'}); }, /No such state/); }); - it('should not disable whole tree down to disabled state', function() { - var tree = mkTree({ - parent: { - child: ['someState'] - } - }, {browsers: ['b1', 'b2']}); + it('should not disable whole tree down to disabled state', () => { + const tree = mkTree({ + parent: { + child: ['someState'] + } + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.parent]) - .disable(tree.child, {state: 'someState'}); + new SuiteCollection([tree.parent]).disable(tree.child, {state: 'someState'}); assert.deepEqual(tree.parent.browsers, ['b1', 'b2']); assert.deepEqual(tree.child.browsers, ['b1', 'b2']); }); - it('should apply all disable rules', function() { - var tree = mkTree({ - suite: ['someState', 'otherState'] - }); + it('should apply all disable rules', () => { + const tree = mkTree({ + suite: ['someState', 'otherState'] + }); new SuiteCollection([tree.suite]) .disable(tree.suite, {state: 'someState'}) @@ -262,10 +311,10 @@ describe('suite-collection', function() { assert.deepEqual(tree.otherState.browsers, []); }); - it('should disable only specified state in specified browser', function() { - var tree = mkTree({ - suite: ['someState'] - }, {browsers: ['b1', 'b2']}); + it('should disable only specified state in specified browser', () => { + const tree = mkTree({ + suite: ['someState'] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disable(tree.suite, {state: 'someState', browser: 'b1'}); @@ -273,16 +322,15 @@ describe('suite-collection', function() { assert.deepEqual(tree.someState.browsers, ['b2']); }); - it('should apply browser rule to whole tree', function() { - var tree = mkTree({ - parent: { - child1: ['state1'], - child2: ['state2', 'state3'] - } - }, {browsers: ['b1', 'b2']}); + it('should apply browser rule to whole tree', () => { + const tree = mkTree({ + parent: { + child1: ['state1'], + child2: ['state2', 'state3'] + } + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.parent]) - .disable(tree.parent, {browser: 'b1'}); + new SuiteCollection([tree.parent]).disable(tree.parent, {browser: 'b1'}); assert.deepEqual(tree.parent.browsers, ['b2']); assert.deepEqual(tree.child1.browsers, ['b2']); @@ -293,27 +341,26 @@ describe('suite-collection', function() { }); }); - describe('enableAll', function() { - it('should enable all suites', function() { - var tree = mkTree({ - parent: { - child: [] - } - }, {browsers: ['b1', 'b2']}); + describe('enableAll', () => { + it('should enable all suites', () => { + const tree = mkTree({ + parent: { + child: [] + } + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.parent]) - .enableAll(); + new SuiteCollection([tree.parent]).enableAll(); assert.deepEqual(tree.parent.browsers, ['b1', 'b2']); assert.deepEqual(tree.child.browsers, ['b1', 'b2']); }); - it('should enable all suites after disable', function() { - var tree = mkTree({ - parent: { - child: [] - } - }, {browsers: ['b1', 'b2']}); + it('should enable all suites after disable', () => { + const tree = mkTree({ + parent: { + child: [] + } + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.parent]) .disableAll() @@ -324,13 +371,13 @@ describe('suite-collection', function() { }); }); - describe('enable', function() { - it('should enable suite by full name', function() { - var tree = mkTree({ - parent: { - child: [] - } - }, {browsers: ['b1', 'b2']}); + describe('enable', () => { + it('should enable suite by full name', () => { + const tree = mkTree({ + parent: { + child: [] + } + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.parent]) .disableAll() @@ -339,21 +386,41 @@ describe('suite-collection', function() { assert.deepEqual(tree.child.browsers, ['b1', 'b2']); }); - it('should fail on attempt to enable unknown suite', function() { - var tree = mkTree({ - suite: [] - }), - collection = new SuiteCollection([tree.suite]); + it('should enable only current suite if there are the same suites exists in the tree', () => { + const suite1 = mkSuite({ + name: 'suite', + browsers: ['b1', 'b2'], + file: 'some/path.js' + }); + const suite2 = mkSuite({ + name: 'suite', + browsers: ['b3', 'b4'], + file: 'another/path.js' + }); + + new SuiteCollection([suite1, suite2]) + .disableAll() + .enable(suite1); + + assert.deepEqual(suite1.browsers, ['b1', 'b2']); + assert.deepEqual(suite2.browsers, []); + }); + + it('should fail on attempt to enable unknown suite', () => { + const tree = mkTree({ + suite: [] + }); + const collection = new SuiteCollection([tree.suite]); - assert.throws(function() { + assert.throws(() => { collection.enable('some bad suite'); }, /Unknown/); }); - it('should enable only specified state', function() { - var tree = mkTree({ - suite: ['someState', 'otherState'] - }, {browsers: ['b1', 'b2']}); + it('should enable only specified state', () => { + const tree = mkTree({ + suite: ['someState', 'otherState'] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disableAll() @@ -363,10 +430,10 @@ describe('suite-collection', function() { assert.deepEqual(tree.otherState.browsers, []); }); - it('should apply all enable rules', function() { - var tree = mkTree({ - suite: ['someState', 'otherState'] - }, {browsers: ['b1', 'b2']}); + it('should apply all enable rules', () => { + const tree = mkTree({ + suite: ['someState', 'otherState'] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disableAll() @@ -377,10 +444,10 @@ describe('suite-collection', function() { assert.deepEqual(tree.otherState.browsers, ['b1', 'b2']); }); - it('should enable only specified state in specified browser', function() { - var tree = mkTree({ - suite: ['someState'] - }, {browsers: ['b1', 'b2']}); + it('should enable only specified state in specified browser', () => { + const tree = mkTree({ + suite: ['someState'] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disableAll() @@ -389,10 +456,10 @@ describe('suite-collection', function() { assert.deepEqual(tree.someState.browsers, ['b1']); }); - it('should apply all browser enable rules', function() { - var tree = mkTree({ - suite: ['someState'] - }, {browsers: ['b1', 'b2']}); + it('should apply all browser enable rules', () => { + const tree = mkTree({ + suite: ['someState'] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disableAll() @@ -402,14 +469,14 @@ describe('suite-collection', function() { assert.deepEqual(tree.someState.browsers, ['b2', 'b1']); }); - it('should enable whole tree down to enabled state', function() { - var tree = mkTree({ - parent: { - child: { - grandchild: ['someState'] - } + it('should enable whole tree down to enabled state', () => { + const tree = mkTree({ + parent: { + child: { + grandchild: ['someState'] } - }, {browsers: ['b1', 'b2']}); + } + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.parent]) .disableAll() @@ -421,21 +488,20 @@ describe('suite-collection', function() { assert.deepEqual(tree.someState.browsers, ['b1']); }); - it('should be able to enable in some unknown browser', function() { - var tree = mkTree({ - suite: [] - }, {browsers: ['b1', 'b2']}); + it('should be able to enable in some unknown browser', () => { + const tree = mkTree({ + suite: [] + }, {browsers: ['b1', 'b2']}); - new SuiteCollection([tree.suite]) - .enable(tree.suite, {browser: 'b3'}); + new SuiteCollection([tree.suite]).enable(tree.suite, {browser: 'b3'}); assert.deepEqual(tree.suite.browsers, ['b1', 'b2', 'b3']); }); - it('should not remove new browser on second enable', function() { - var tree = mkTree({ - suite: [] - }, {browsers: ['b1', 'b2']}); + it('should not remove new browser on second enable', () => { + const tree = mkTree({ + suite: [] + }, {browsers: ['b1', 'b2']}); new SuiteCollection([tree.suite]) .disableAll() @@ -446,4 +512,25 @@ describe('suite-collection', function() { }); }); }); + + describe('skip browsers by SuiteBuilder', () => { + let skip; + + beforeEach(() => { + skip = sandbox.stub(); + + SuiteBuilder.returns({skip}); + }); + + it('should skip passed browsers', () => { + const tree = mkTree({ + suite: [] + }, {browsers: ['b1', 'b2']}); + + new SuiteCollection([tree.suite]).skipBrowsers(tree.suite.browsers); + + assert.calledWith(skip, ['b1', 'b2'], + 'The test was skipped by environment variable GEMINI_SKIP_BROWSERS'); + }); + }); }); diff --git a/test/unit/suite-monitor.test.js b/test/unit/suite-monitor.test.js index a4087f2f4..b00a0c160 100644 --- a/test/unit/suite-monitor.test.js +++ b/test/unit/suite-monitor.test.js @@ -1,47 +1,57 @@ 'use strict'; -var createSuite = require('lib/suite').create, - SuiteMonitor = require('lib/suite-monitor'); -describe('suite-monitor', function() { - beforeEach(function() { - this.sinon = sinon.sandbox.create(); +const createSuite = require('lib/suite').create; +const SuiteMonitor = require('lib/suite-monitor'); - this.root = createSuite('root'); - this.suite = createSuite('suite', this.root); +describe('suite-monitor', () => { + const sandbox = sinon.sandbox.create(); + let monitor; + let root; + let suite; - this.monitor = new SuiteMonitor(); - }); + beforeEach(() => { + root = createSuite('root'); + suite = createSuite('suite', root); + root.addChild(suite); - afterEach(function() { - this.sinon.restore(); + monitor = new SuiteMonitor(); }); - describe('suiteFinished', function() { - it('should emit `endSuite` event when passed suite does not have nested suits', function() { - var spy = this.sinon.spy().named('onEndSuite'); - this.monitor.on('endSuite', spy); - this.monitor.suiteFinished(this.suite, 'browser'); + afterEach(() => sandbox.restore()); + + describe('suiteFinished', () => { + it('should emit `endSuite` event when passed suite does not have nested suits', () => { + const spy = sandbox.spy().named('onEndSuite'); + monitor.on('endSuite', spy); + + monitor.suiteFinished(suite, 'browser'); + assert.calledOnce(spy); }); - it('should not emit `endSuite` event when passed suite has incomplete nested suits', function() { - var spy = this.sinon.spy().named('onEndSuite'); - this.monitor.on('endSuite', spy); - this.monitor.suiteFinished(this.root, 'browser'); + it('should not emit `endSuite` event when passed suite has incomplete nested suits', () => { + const spy = sandbox.spy().named('onEndSuite'); + monitor.on('endSuite', spy); + + monitor.suiteFinished(root, 'browser'); + assert.neverCalledWith(spy); }); - it('should emit `endSuite` event when passed suite has complete nested suits', function() { - var spy = this.sinon.spy().named('onEndSuite'); - this.child = createSuite('child', this.suite); - this.monitor.on('endSuite', spy); - this.monitor.suiteFinished(this.root, 'browser'); - this.monitor.suiteFinished(this.suite, 'browser'); - this.monitor.suiteFinished(this.child, 'browser'); + it('should emit `endSuite` event when passed suite has complete nested suits', () => { + const spy = sandbox.spy().named('onEndSuite'); + const child = createSuite('child', suite); + suite.addChild(child); + monitor.on('endSuite', spy); + + monitor.suiteFinished(root, 'browser'); + monitor.suiteFinished(suite, 'browser'); + monitor.suiteFinished(child, 'browser'); + assert.callOrder( - spy.withArgs(sinon.match({suite: this.child, browserId: 'browser'})), - spy.withArgs(sinon.match({suite: this.suite, browserId: 'browser'})), - spy.withArgs(sinon.match({suite: this.root, browserId: 'browser'})) + spy.withArgs(sinon.match({suite: child, browserId: 'browser'})), + spy.withArgs(sinon.match({suite: suite, browserId: 'browser'})), + spy.withArgs(sinon.match({suite: root, browserId: 'browser'})) ); }); }); diff --git a/test/unit/suite-util.test.js b/test/unit/suite-util.test.js deleted file mode 100644 index e624597c1..000000000 --- a/test/unit/suite-util.test.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -var _ = require('lodash'), - suiteUtil = require('lib/suite-util'), - shouldSkip = suiteUtil.shouldSkip; - -describe('suite-util', function() { - describe('shouldSkip()', function() { - it('should not skip any browser if skipped=false', function() { - assert.isFalse(shouldSkip({skipped: false}, 'browser')); - }); - - it('should skip any browser if skipped=true', function() { - assert.isTrue(shouldSkip({skipped: true}, 'browser')); - }); - - it('should skip browser if its id matches skip list', function() { - var matcher = { - matches: _.isEqual.bind(null, 'some-browser') - }; - - assert.isTrue(shouldSkip( - {skipped: [matcher]}, - 'some-browser' - )); - }); - - it('should not skip the browser if its id does not match skip list', function() { - var matcher = { - matches: _.isEqual.bind(null, 'some-browser') - }; - assert.isFalse(shouldSkip( - {skipped: [matcher]}, - 'another-browser' - )); - }); - }); -}); diff --git a/test/unit/suite.js b/test/unit/suite.js new file mode 100644 index 000000000..18659bb4c --- /dev/null +++ b/test/unit/suite.js @@ -0,0 +1,400 @@ +'use strict'; + +const createSuite = require('lib/suite').create; +const State = require('lib/state'); +const mkTree = require('../util').makeSuiteTree; + +describe('suite', () => { + describe('create', () => { + it('should create named suite', () => { + const suite = createSuite('some name'); + assert.equal(suite.name, 'some name'); + }); + + it('should inherit properties from parent, if any', () => { + const parent = createSuite('parent'); + const child = createSuite('child', parent); + + parent.url = 'http://example.com'; + + assert.equal(child.url, parent.url); + }); + + it('should allow to overwrite parent properties', () => { + const parent = createSuite('parent'); + const child = createSuite('child', parent); + + parent.url = 'http://example.com'; + child.url = 'http://example2.com'; + + assert.notEqual(child.url, parent.url); + }); + + it('should set `parent` property of a parent suite', () => { + const parent = createSuite('parent'); + const child = createSuite('child', parent); + + assert.equal(child.parent, parent); + }); + + it('child suite should have same data in context as parent', () => { + const parent = createSuite('parent'); + parent.context.some = 'data'; + + const child = createSuite('child', parent); + + assert.deepEqual(child.context, {some: 'data'}); + }); + + it('modifications of child context should not affect parent context', () => { + const parent = createSuite('parent'); + parent.context.some = 'data'; + + const child = createSuite('child', parent); + child.context.some = 'other-data'; + child.context.other = 'data'; + + assert.deepEqual(parent.context, {some: 'data'}); + }); + + it('should not allow to create suite with empty name', () => { + const parent = createSuite('parent'); + + assert.throws(() => createSuite('', parent), /Empty suite name/); + }); + }); + + describe('states', () => { + let suite; + + beforeEach(() => { + suite = createSuite('suite'); + }); + + it('should be empty by default', () => { + assert.lengthOf(suite.states, 0); + }); + + it('should not be writable', () => { + assert.throws(() => suite.states = []); + }); + + it('should not be inherited', () => { + const child = createSuite('child', suite); + suite.addState({}); + assert.lengthOf(child.states, 0); + }); + }); + + describe('addChild', () => { + it('should add child for parent suite', () => { + const suite = createSuite('suite'); + const child = createSuite('child', suite); + suite.addChild(child); + assert.equal(suite.children[0], child); + }); + + it('should set himself as a parent for child suite', () => { + const suite = createSuite('suite'); + const anotherSuite = createSuite('another-suite'); + suite.addChild(anotherSuite); + assert.equal(anotherSuite.parent, suite); + }); + + it('child suite should inherit properties from the parent', () => { + const suite = createSuite('suite'); + const anotherSuite = createSuite('another-suite'); + suite.addChild(anotherSuite); + assert.equal(Object.getPrototypeOf(anotherSuite), suite); + }); + }); + + describe('addState', () => { + let suite; + + beforeEach(() => { + suite = createSuite('suite'); + }); + + it('should modify states property', () => { + const state = {name: 'some state'}; + suite.addState(state); + assert.equal(suite.states[0], state); + }); + + it('should redefine parent suite for state', () => { + const state = {name: 'some state'}; + suite.addState(state); + assert.equal(state.suite, suite); + }); + }); + + describe('hasStates', () => { + let suite; + + beforeEach(() => { + suite = createSuite('suite'); + }); + + it('should be false if there is no states', () => { + assert.isFalse(suite.hasStates); + }); + + it('should be true if there are states', () => { + suite.addState({name: 'state'}); + + assert.isTrue(suite.hasStates); + }); + }); + + describe('isRoot', () => { + it('should be true for root suites', () => { + const suite = createSuite('suite'); + assert.isTrue(suite.isRoot); + }); + + it('should be false for child suites', () => { + const parent = createSuite('parent'); + const child = createSuite('child', parent); + + assert.isFalse(child.isRoot); + }); + }); + + describe('skipped', () => { + let suite; + let matcher; + let matcher2; + + beforeEach(() => { + suite = createSuite('suite'); + matcher = {a: 1}; + matcher2 = {b: 2}; + }); + + it('should be empty by default', () => { + assert.deepEqual(suite.skipped, []); + }); + + it('should be changed by skip(object) method', () => { + suite.skip(matcher); + + assert.deepEqual(suite.skipped, [matcher]); + }); + + it('should be inherited by children', () => { + suite.skip(matcher); + + const child = createSuite('child', suite); + + assert.equal(suite.skipped, child.skipped); + }); + + it('should merge multiple matchers together', () => { + suite.skip(matcher); + suite.skip(matcher2); + + assert.deepEqual(suite.skipped, [matcher, matcher2]); + }); + + it('should merge children list with parent', () => { + suite.skip(matcher); + const child = createSuite('child', suite); + child.skip(matcher2); + + assert.deepEqual(child.skipped, [matcher, matcher2]); + }); + + it('should not affect parent when calling .skip() on child', () => { + suite.skip(matcher); + const child = createSuite('child', suite); + child.skip(matcher2); + + assert.deepEqual(suite.skipped, [matcher]); + }); + }); + + describe('shouldSkip', () => { + let suite; + + const createBrowserSkipMatcher = (browserId) => { + const matcher = {matches: sinon.stub()}; + matcher.matches.withArgs(browserId).returns(true); + + return matcher; + }; + + beforeEach(() => suite = createSuite('suite')); + + it('should be "false" for any browser if a suite is not skipped', function() { + assert.isFalse(suite.shouldSkip('browser')); + }); + + it('should be "true" for a browser if a suite is skipped in it', () => { + suite.skip(createBrowserSkipMatcher('1st-skipped-bro')); + suite.skip(createBrowserSkipMatcher('2nd-skipped-bro')); + + assert.isTrue(suite.shouldSkip('1st-skipped-bro')); + assert.isTrue(suite.shouldSkip('2nd-skipped-bro')); + }); + + it('should set a skip comment if a suite is skipped in a browser', () => { + suite.skip({matches: sinon.stub().withArgs('skipped-bro').returns(true), comment: 'skip-comment'}); + + suite.shouldSkip('skipped-bro'); + assert.equal(suite.skipComment, 'skip-comment'); + }); + + it('should be "false" for a browser if a suite is not skipped in it', () => { + suite.skip(createBrowserSkipMatcher('1st-skipped-bro')); + suite.skip(createBrowserSkipMatcher('2st-skipped-bro')); + + assert.isFalse(suite.shouldSkip('some-bro')); + }); + }); + + describe('hasChild', () => { + let suite; + + beforeEach(() => { + suite = createSuite('parent'); + const child = createSuite('has', suite); + child.browsers = ['bro1', 'bro2']; + suite.addChild(child); + }); + + it('should return true when suite has child with given name and intersected browser set', () => { + assert.isTrue(suite.hasChild('has', ['bro1'])); + }); + + describe('should return false when', () => { + it('suite has no child with given name', () => { + assert.isFalse(suite.hasChild('has no', [])); + }); + + it('has child with given name and not intersected browser set', () => { + assert.isFalse(suite.hasChild('has no', ['bad-bro'])); + }); + }); + }); + + describe('hasStateNamed', () => { + let suite; + + beforeEach(() => { + suite = createSuite('suite'); + suite.addState({name: 'has'}); + }); + + it('should return true when suite has state of a given name', () => { + assert.isTrue(suite.hasStateNamed('has')); + }); + + it('should return true when suite has state of a given name', () => { + assert.isFalse(suite.hasStateNamed('has no')); + }); + }); + + describe('fullName', () => { + let parent; + let child; + + beforeEach(() => { + parent = createSuite('parent'); + child = createSuite('child', parent); + }); + + it('should return name for top level suite', () => { + assert.equal(parent.fullName, 'parent'); + }); + + it('should concat own name with parents', () => { + assert.equal(child.fullName, 'parent child'); + }); + }); + + describe('suite clone', () => { + let sandbox; + + beforeEach(() => { + sandbox = sinon.sandbox.create(); + }); + + afterEach(() => sandbox.restore()); + + it('should return cloned suite', () => { + const suite = createSuite('origin'); + const clonedSuite = suite.clone(); + + assert.notEqual(clonedSuite, suite); + }); + + it('should clone nested suites', () => { + const tree = mkTree({ + suite: { + child: [] + } + }); + const childSuite = tree.child; + sandbox.stub(childSuite, 'clone').returns({}); + + tree.suite.clone(); + + assert.calledOnce(childSuite.clone); + }); + + it('should not change child suite count while cloning', () => { + const tree = mkTree({ + suite: { + child: [] + } + }); + const clonedSuite = tree.suite.clone(); + + assert.lengthOf(clonedSuite.children, 1); + }); + + it('should redefine parent for nested suites', () => { + const suite = createSuite('origin'); + const childSuite = createSuite('child suite'); + suite.addChild(childSuite); + + const clonedSuite = suite.clone(); + + assert.deepEqual(clonedSuite.children[0].parent, clonedSuite); + }); + + it('should clone nested states', () => { + const suite = createSuite('origin'); + const state = new State(suite); + sandbox.stub(state, 'clone').returns({}); + suite.addState(state); + + suite.clone(); + + assert.calledOnce(state.clone); + }); + + it('should redefine parent suite for state', () => { + const suite = createSuite('origin'); + const state = new State(suite); + suite.addState(state); + + const clonedSuite = suite.clone(); + + assert.equal(clonedSuite.states[0].suite, clonedSuite); + }); + + it('should not change state count while cloning', () => { + const suite = createSuite('origin'); + const state1 = new State(suite); + const state2 = new State(suite); + suite.addState(state1); + suite.addState(state2); + + const clonedSuite = suite.clone(); + + assert.lengthOf(clonedSuite.states, 2); + }); + }); +}); diff --git a/test/unit/suite.test.js b/test/unit/suite.test.js deleted file mode 100644 index 56a97cda8..000000000 --- a/test/unit/suite.test.js +++ /dev/null @@ -1,237 +0,0 @@ -'use strict'; - -var createSuite = require('lib/suite').create; - -describe('suite', function() { - describe('create', function() { - it('should create named suite', function() { - var suite = createSuite('some name'); - assert.equal(suite.name, 'some name'); - }); - - it('should inherit properties from parent, if any', function() { - var parent = createSuite('parent'), - child = createSuite('child', parent); - - parent.url = 'http://example.com'; - - assert.equal(child.url, parent.url); - }); - - it('should allow to overwrite parent properties', function() { - var parent = createSuite('parent'), - child = createSuite('child', parent); - - parent.url = 'http://example.com'; - child.url = 'http://example2.com'; - - assert.notEqual(child.url, parent.url); - }); - - it('should set `parent` property of a parent suite', function() { - var parent = createSuite('parent'), - child = createSuite('child', parent); - - assert.equal(child.parent, parent); - }); - - it('should add new suite to the parent\'s children', function() { - var parent = createSuite('parent'), - child = createSuite('child', parent); - - assert.include(parent.children, child); - }); - - it('child suite should have same data in context as parent', function() { - var parent = createSuite('parent'); - parent.context.some = 'data'; - - var child = createSuite('child', parent); - - assert.deepEqual(child.context, {some: 'data'}); - }); - - it('modifications of child context should not affect parent context', function() { - var parent = createSuite('parent'); - parent.context.some = 'data'; - - var child = createSuite('child', parent); - child.context.some = 'other-data'; - child.context.other = 'data'; - - assert.deepEqual(parent.context, {some: 'data'}); - }); - }); - - describe('states', function() { - beforeEach(function() { - this.suite = createSuite('suite'); - }); - - it('should be empty by default', function() { - assert.lengthOf(this.suite.states, 0); - }); - - it('should not be writable', function() { - var suite = this.suite; - - assert.throws(function() { - suite.states = []; - }); - }); - - it('should not be inherited', function() { - var child = createSuite('child', this.suite); - this.suite.addState({}); - assert.lengthOf(child.states, 0); - }); - }); - - describe('addState', function() { - beforeEach(function() { - this.suite = createSuite('suite'); - }); - - it('should modify states property', function() { - var state = {name: 'some state'}; - this.suite.addState(state); - assert.equal(this.suite.states[0], state); - }); - }); - - describe('hasStates', function() { - beforeEach(function() { - this.suite = createSuite('suite'); - }); - - it('should be false if there is no states', function() { - assert.isFalse(this.suite.hasStates); - }); - - it('should be true if there are states', function() { - this.suite.addState({name: 'state'}); - - assert.isTrue(this.suite.hasStates); - }); - }); - - describe('isRoot', function() { - it('should be true for root suites', function() { - var suite = createSuite('suite'); - assert.isTrue(suite.isRoot); - }); - - it('should be false for child suites', function() { - var parent = createSuite('parent'), - child = createSuite('child', parent); - - assert.isFalse(child.isRoot); - }); - }); - - describe('skipped', function() { - beforeEach(function() { - this.suite = createSuite('suite'); - this.matcher = {a: 1}; - this.matcher2 = {b: 2}; - }); - - it('should be false by default', function() { - assert.isFalse(this.suite.skipped); - }); - - it('should be changed by skip(object) method', function() { - this.suite.skip(this.matcher); - assert.deepEqual(this.suite.skipped, [this.matcher]); - }); - - it('should be inherited by children', function() { - this.suite.skip(); - - var child = createSuite('child', this.suite); - assert.isTrue(child.skipped); - }); - - it('should merge multiple matchers together', function() { - this.suite.skip(this.matcher); - this.suite.skip(this.matcher2); - - assert.deepEqual(this.suite.skipped, [this.matcher, this.matcher2]); - }); - - it('should not override `true` by browser list', function() { - this.suite.skip(); - this.suite.skip(this.matcher); - - assert.isTrue(this.suite.skipped); - }); - - it('should override browser list by `true`', function() { - this.suite.skip(this.matcher); - this.suite.skip(); - - assert.isTrue(this.suite.skipped); - }); - - it('should merge children list with parent', function() { - this.suite.skip(this.matcher); - var child = createSuite('child', this.suite); - child.skip(this.matcher2); - - assert.deepEqual(child.skipped, [this.matcher, this.matcher2]); - }); - - it('should not affect parent when calling .skip() on child', function() { - this.suite.skip(this.matcher); - var child = createSuite('child', this.suite); - child.skip(this.matcher2); - - assert.deepEqual(this.suite.skipped, [this.matcher]); - }); - }); - - describe('hasChildNamed', function() { - beforeEach(function() { - this.suite = createSuite('parent'); - createSuite('has', this.suite); - }); - - it('should return true when suite has child of a given name', function() { - assert.isTrue(this.suite.hasChildNamed('has')); - }); - - it('should return fals when suite has no child of a given name', function() { - assert.isFalse(this.suite.hasChildNamed('has no')); - }); - }); - - describe('hasStateNamed', function() { - beforeEach(function() { - this.suite = createSuite('suite'); - this.suite.addState({name: 'has'}); - }); - - it('should return true when suite has state of a given name', function() { - assert.isTrue(this.suite.hasStateNamed('has')); - }); - - it('should return true when suite has state of a given name', function() { - assert.isFalse(this.suite.hasStateNamed('has no')); - }); - }); - - describe('fullName', function() { - beforeEach(function() { - this.parent = createSuite('parent'); - this.child = createSuite('child', this.parent); - }); - - it('should return name for top level suite', function() { - assert.equal(this.parent.fullName, 'parent'); - }); - - it('should concat own name with parents', function() { - assert.equal(this.child.fullName, 'parent child'); - }); - }); -}); diff --git a/test/unit/temp.js b/test/unit/temp.js deleted file mode 100644 index d907ba629..000000000 --- a/test/unit/temp.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -var requireWithNoCache = require('lib/utils').requireWithNoCache, - nodeTemp = require('temp'); - -describe('temp', function() { - var sandbox = sinon.sandbox.create(), - temp; - - beforeEach(function() { - sandbox.stub(nodeTemp); - temp = requireWithNoCache(require.resolve('lib/temp')); - }); - - afterEach(function() { - sandbox.restore(); - }); - - it('should enable auto clean', function() { - assert.calledOnce(nodeTemp.track); - }); - - describe('init', function() { - it('should create gemini temp dir in system temp dir by default', function() { - temp.init(); - - assert.calledWithMatch(nodeTemp.mkdirSync, { - dir: sinon.match.falsy, - prefix: '.gemini.tmp.' - }); - }); - - it('should create gemini temp dir in passed dir', function() { - temp.init('./'); - - assert.calledWith(nodeTemp.mkdirSync, { - dir: process.cwd(), - prefix: '.gemini.tmp.' - }); - }); - - it('should create gemini temp dir in passed absolute path', function() { - temp.init('/some/dir'); - - assert.calledWithMatch(nodeTemp.mkdirSync, { - dir: '/some/dir' - }); - }); - }); - - describe('path', function() { - it('should passthrough options extending them with temp dir', function() { - nodeTemp.mkdirSync.returns('/some/temp/dir'); - temp.init(); - - temp.path({prefix: 'prefix.', suffix: '.suffix'}); - - assert.calledWith(nodeTemp.path, { - dir: '/some/temp/dir', - prefix: 'prefix.', - suffix: '.suffix' - }); - }); - }); -}); diff --git a/test/unit/test-reader.js b/test/unit/test-reader.js new file mode 100644 index 000000000..f777aabbf --- /dev/null +++ b/test/unit/test-reader.js @@ -0,0 +1,228 @@ +'use strict'; + +const Promise = require('bluebird'); +const _ = require('lodash'); +const proxyquire = require('proxyquire'); +const EventEmitter = require('events').EventEmitter; +const globExtra = require('glob-extra'); +const SetsBuilder = require('gemini-core').SetsBuilder; + +const utils = require('lib/utils'); + +describe('test-reader', () => { + const sandbox = sinon.sandbox.create(); + + let testsApi; + let readTests; + + const mkConfigStub = (opts) => { + opts = opts || {}; + + return _.defaultsDeep(opts, { + getBrowserIds: sandbox.stub().returns(opts.browsers || []), + system: { + projectRoot: '/root' + } + }); + }; + + const readTests_ = (params) => { + params = _.defaultsDeep(params || {}, { + config: mkConfigStub(), + emitter: new EventEmitter(), + options: { + sets: {}, + paths: [], + browsers: [] + } + }); + + return readTests(params.emitter, params.config, params.options); + }; + + beforeEach(() => { + sandbox.stub(utils, 'requireWithNoCache'); + sandbox.stub(globExtra, 'expandPaths').returns(Promise.resolve([])); + sandbox.stub(SetsBuilder.prototype, 'useFiles').returnsThis(); + sandbox.stub(SetsBuilder.prototype, 'useSets').returnsThis(); + sandbox.stub(SetsBuilder.prototype, 'useBrowsers').returnsThis(); + + const groupByFile = () => { + return { + '/some/path/file1.js': [], + '/other/path/file2.js': [] + }; + }; + sandbox.stub(SetsBuilder.prototype, 'build').returns(Promise.resolve({groupByFile})); + testsApi = sandbox.stub(); + readTests = proxyquire('lib/test-reader', { + './tests-api': testsApi + }); + }); + + afterEach(() => sandbox.restore()); + + describe('SetsBuilder calling', () => { + let createSetsBuilder; + + beforeEach(() => createSetsBuilder = sandbox.spy(SetsBuilder, 'create')); + + it('should create set-builder with sets from config and default directory', () => { + const defaultDir = require('../../package').name; + const opts = { + config: mkConfigStub({ + sets: { + all: {} + } + }) + }; + + return readTests_(opts) + .then(() => { + assert.calledOnce(createSetsBuilder); + assert.calledWithMatch(createSetsBuilder, {all: {}}, {defaultDir}); + }); + }); + + it('should use sets passed from cli', () => { + return readTests_({options: {sets: {all: {}}}}) + .then(() => { + assert.calledOnce(SetsBuilder.prototype.useSets); + assert.calledWith(SetsBuilder.prototype.useSets, {all: {}}); + }); + }); + + it('should use paths passed from cli', () => { + return readTests_({options: {paths: ['some/path']}}) + .then(() => { + assert.calledOnce(SetsBuilder.prototype.useFiles); + assert.calledWith(SetsBuilder.prototype.useFiles, ['some/path']); + }); + }); + + it('should use browsers passed from cli', () => { + return readTests_({options: {browsers: ['bro1']}}) + .then(() => { + assert.calledOnce(SetsBuilder.prototype.useBrowsers); + assert.calledWith(SetsBuilder.prototype.useBrowsers, ['bro1']); + }); + }); + + it('should build set-collection using project root and exlude options from config', () => { + const config = mkConfigStub({ + system: { + projectRoot: '/project/root', + exclude: ['some/path'] + } + }); + + return readTests_({config}) + .then(() => { + assert.calledOnce(SetsBuilder.prototype.build); + assert.calledWith(SetsBuilder.prototype.build, '/project/root', {ignore: ['some/path']}); + }); + }); + + it('should call set-builder methods in right order', () => { + return readTests_() + .then(() => { + assert.callOrder( + createSetsBuilder, + SetsBuilder.prototype.useSets, + SetsBuilder.prototype.useFiles, + SetsBuilder.prototype.useBrowsers, + SetsBuilder.prototype.build + ); + }); + }); + + it('should call "testsApi" with absolute file path', () => { + const groupByFile = () => ({'/project/root/path/file1.js': []}); + + SetsBuilder.prototype.build.returns(Promise.resolve({groupByFile})); + + return readTests_() + .then(() => { + assert.calledWith(testsApi, sinon.match.any, sinon.match.any, '/project/root/path/file1.js'); + }); + }); + + it('should call "testsApi" with a config', () => { + const config = mkConfigStub(); + + return readTests_({config}) + .then(() => assert.calledWith(testsApi, sinon.match.any, sinon.match.any, sinon.match.any, config)); + }); + }); + + describe('global "gemini" variable', () => { + let gemini; + + beforeEach(() => { + utils.requireWithNoCache.restore(); + }); + + it('should use global "gemini" variable', () => { + sandbox.stub(utils, 'requireWithNoCache').callsFake(() => gemini = global.gemini); + const api = {suite: 'api'}; + + testsApi.returns(api); + + return readTests_() + .then(() => assert.deepEqual(gemini, api)); + }); + + it('should rewrite global "gemini" variable for each file', () => { + let globalGemini = []; + + globExtra.expandPaths.returns(Promise.resolve(['/some/path/file1.js', '/some/path/file2.js'])); + + testsApi + .onFirstCall().returns({suite: 'apiInstance'}) + .onSecondCall().returns({suite: 'anotherApiInstance'}); + + sandbox.stub(utils, 'requireWithNoCache').callsFake(() => { + globalGemini.push(global.gemini.suite); + }); + + return readTests_() + .then(() => assert.deepEqual(globalGemini, ['apiInstance', 'anotherApiInstance'])); + }); + + it('should delete global "gemini" variable after test reading', () => { + testsApi.returns({suite: 'api'}); + globExtra.expandPaths.returns(Promise.resolve(['some-test.js'])); + sandbox.stub(utils, 'requireWithNoCache'); + + return readTests_().then(() => assert.notProperty(global, 'gemini')); + }); + }); + + describe('events', () => { + it('should emit "beforeFileRead" before reading each file', () => { + const beforeReadSpy = sandbox.spy().named('OnBeforeFileRead'); + + const emitter = new EventEmitter(); + emitter.on('beforeFileRead', beforeReadSpy); + + return readTests_({emitter}) + .then(() => { + assert.calledWithExactly(beforeReadSpy, '/some/path/file1.js'); + assert.callOrder(beforeReadSpy, utils.requireWithNoCache); + }); + }); + + it('should emit "afterFileRead" after reading each file', () => { + const afterReadSpy = sandbox.spy().named('OnAfterFileRead'); + + const emitter = new EventEmitter(); + emitter.on('afterFileRead', afterReadSpy); + + return readTests_({emitter}) + .then(() => { + assert.calledWithExactly(afterReadSpy, '/some/path/file1.js'); + assert.callOrder(utils.requireWithNoCache, afterReadSpy); + }); + }); + }); +}); diff --git a/test/unit/test-reader.test.js b/test/unit/test-reader.test.js deleted file mode 100644 index 029281107..000000000 --- a/test/unit/test-reader.test.js +++ /dev/null @@ -1,257 +0,0 @@ -'use strict'; - -var utils = require('lib/utils'), - pathUtils = require('lib/path-utils'), - proxyquire = require('proxyquire'), - _ = require('lodash'), - q = require('q'); - -describe('test-reader', function() { - var sandbox = sinon.sandbox.create(), - testsApi = sandbox.stub(), - readTests; - - before(function() { - readTests = proxyquire('lib/test-reader', { - './tests-api': testsApi - }); - }); - - beforeEach(function() { - sandbox.stub(utils); - sandbox.stub(pathUtils); - }); - - afterEach(function() { - sandbox.restore(); - testsApi.reset(); - }); - - function readTests_(opts) { - var REQUIRED_OPTS = { - system: { - projectRoot: '/root' - } - }; - - opts = _.defaults(opts || {}, { - paths: [], - config: {} - }); - - opts.config = _.merge(opts.config, REQUIRED_OPTS); - - return readTests(opts.paths, opts.config); - } - - describe('global "gemini" variable', function() { - var config; - - beforeEach(function() { - config = { - getBrowserIds: function() { - return []; - } - }; - utils.requireWithNoCache.restore(); - }); - - it('should use global "gemini" variable', function() { - var gemini, - api = {suite: 'api'}; - - testsApi.returns(api); - pathUtils.expandPaths.returns(q(['some-test.js'])); - sandbox.stub(utils, 'requireWithNoCache', function() { - gemini = global.gemini; - }); - - return readTests_({config: config}) - .then(function() { - assert.deepEqual(gemini, api); - }); - }); - - it('should rewrite global "gemini" variable for each file', function() { - var gemini = []; - - pathUtils.expandPaths.returns(q(['/some/path/file1.js', '/some/path/file2.js'])); - testsApi - .onFirstCall().returns({suite: 'apiInstance'}) - .onSecondCall().returns({suite: 'anotherApiInstance'}); - sandbox.stub(utils, 'requireWithNoCache', function() { - gemini.push(global.gemini.suite); - }); - - return readTests_({config: config}) - .then(function() { - assert.deepEqual(gemini, ['apiInstance', 'anotherApiInstance']); - }); - }); - - it('should delete global "gemini" variable after test reading', function() { - testsApi.returns({suite: 'api'}); - pathUtils.expandPaths.returns(q(['some-test.js'])); - sandbox.stub(utils, 'requireWithNoCache'); - - return readTests_({config: config}) - .then(function() { - assert.notProperty(global, 'gemini'); - }); - }); - }); - - it('should not load any suites if no paths or sets specified', function() { - pathUtils.expandPaths - .returns(q([])); - - return readTests_() - .then(function() { - assert.notCalled(utils.requireWithNoCache); - }); - }); - - it('should expand passed paths', function() { - pathUtils.expandPaths - .returns(q([])); - - return readTests_({paths: ['some/path/*']}) - .then(function() { - assert.calledWithExactly(pathUtils.expandPaths, ['some/path/*']); - }); - }); - - it('should expand paths from config.sets', function() { - pathUtils.expandPaths - .returns(q([])); - - var config = { - system: { - projectRoot: '/root' - }, - sets: { - set1: { - files: ['some/files'] - }, - set2: { - files: ['other/files'] - } - } - }; - - return readTests_({config: config}) - .then(function() { - assert.calledWithExactly(pathUtils.expandPaths, ['some/files'], '/root'); - assert.calledWithExactly(pathUtils.expandPaths, ['other/files'], '/root'); - }); - }); - - it('should load suites related to passed paths', function() { - var config = { - getBrowserIds: function() { - return []; - } - }; - - pathUtils.expandPaths - .withArgs(['some/path']).returns(q(['/some/path/file1.js', '/some/path/file2.js'])); - - return readTests_({paths: ['some/path'], config: config}) - .then(function() { - assert.calledWith(utils.requireWithNoCache, '/some/path/file1.js'); - assert.calledWith(utils.requireWithNoCache, '/some/path/file2.js'); - }); - }); - - it('should load suites related to sets if no passed paths', function() { - var config = { - sets: { - set1: { - files: ['some/path'] - }, - set2: { - files: ['other/path'] - } - } - }; - - pathUtils.expandPaths - .withArgs(['some/path']).returns(q(['/some/path/file1.js', '/some/path/file2.js'])) - .withArgs(['other/path']).returns(q(['/other/path/file3.js'])) - .withArgs([]).returns(q([])); - - return readTests_({config: config}) - .then(function() { - assert.calledThrice(utils.requireWithNoCache); - assert.calledWith(utils.requireWithNoCache, '/some/path/file1.js'); - assert.calledWith(utils.requireWithNoCache, '/some/path/file2.js'); - assert.calledWith(utils.requireWithNoCache, '/other/path/file3.js'); - }); - }); - - it('should load only passed paths', function() { - var config = { - sets: { - all: { - files: ['some/path', 'some/other/path'] - } - } - }; - - pathUtils.expandPaths - .withArgs(['some/path']).returns(q(['/some/path/file1.js', '/some/path/file2.js'])) - .withArgs(['some/path', 'some/other/path']) - .returns(q(['/some/path/file1.js', '/some/path/file2.js', '/some/other/path/file3.js'])); - - return readTests_({paths: ['some/path'], config: config}) - .then(function() { - assert.calledWith(utils.requireWithNoCache, '/some/path/file1.js'); - assert.calledWith(utils.requireWithNoCache, '/some/path/file2.js'); - assert.neverCalledWith(utils.requireWithNoCache, '/some/other/path/file3.js'); - }); - }); - - it('should configure suite for certain browsers', function() { - var config = { - sets: { - all: { - files: ['some/path'], - browsers: ['b1'] - } - } - }; - - pathUtils.expandPaths - .withArgs(['some/path']).returns(q(['/some/path/file.js'])); - - return readTests_({config: config}) - .then(function() { - assert.calledWith(testsApi, sinon.match.any, ['b1']); - assert.callOrder(testsApi, utils.requireWithNoCache); - }); - }); - - it('should configure suite for all browsers if file not configured in sets', function() { - var config = { - sets: { - all: { - files: ['some/path'], - browsers: ['b1'] - } - }, - getBrowserIds: function() { - return ['b1', 'b2']; - } - }; - - pathUtils.expandPaths - .withArgs(['some/path']).returns(q(['/some/path/file.js'])) - .withArgs(['other/path']).returns(q(['/other/path/file2.js'])); - - return readTests_({paths: ['other/path'], config: config}) - .then(function() { - assert.calledOnce(testsApi); - assert.calledWith(testsApi, sinon.match.any, ['b1', 'b2']); - }); - }); -}); diff --git a/test/unit/tests-api/actions-builder.js b/test/unit/tests-api/actions-builder.js index 5028aa051..88e6c0e31 100644 --- a/test/unit/tests-api/actions-builder.js +++ b/test/unit/tests-api/actions-builder.js @@ -1,72 +1,211 @@ 'use strict'; -const q = require('q'); +const Promise = require('bluebird'); const ActionsBuilder = require('lib/tests-api/actions-builder'); +const StateError = require('lib/errors/state-error'); const util = require('../../util'); describe('tests-api/actions-builder', () => { const sandbox = sinon.sandbox.create(); const browser = util.makeBrowser(); - const createActionsBuilder = (actions) => new ActionsBuilder(actions || []); + const mkActionsBuilder = (actions) => ActionsBuilder.create(actions || []); - const runAction = (method, browser, postActions) => { - const actions = []; + const mkAction = (actionName, browser, postActions) => { + return function() { + const actions = []; + const actionsBuilder = mkActionsBuilder(actions); - createActionsBuilder(actions)[method](); - return actions[0](browser, postActions); + actionsBuilder[actionName].apply(actionsBuilder, arguments); + return actions[0](browser, postActions); + }; }; afterEach(() => sandbox.restore()); describe('changeOrientation', () => { beforeEach(() => { - sandbox.stub(browser, 'getOrientation').returns(q()); - sandbox.stub(browser, 'setOrientation').returns(q()); - }); - - it('should throw in case of passed arguments', () => { - const fn = () => createActionsBuilder().changeOrientation('awesome argument'); - - assert.throws(fn, TypeError, /\.changeOrientation\(\) does not accept any arguments/); + sandbox.stub(browser, 'getOrientation').resolves(); + sandbox.stub(browser, 'setOrientation').resolves(); + sandbox.stub(browser, 'evalScript').resolves(); + sandbox.stub(browser, 'waitFor').resolves(); }); it('should return ActionsBuilder instance', () => { - assert.instanceOf(createActionsBuilder().changeOrientation(), ActionsBuilder); + assert.instanceOf(mkActionsBuilder().changeOrientation(), ActionsBuilder); }); it('should change orientation from PORTRAIT to LANDSCAPE', () => { - browser.getOrientation.returns(q('PORTRAIT')); + browser.getOrientation.returns(Promise.resolve('PORTRAIT')); + const changeOrientation = mkAction('changeOrientation', browser); - return runAction('changeOrientation', browser) + return changeOrientation() .then(() => assert.calledWith(browser.setOrientation, 'LANDSCAPE')); }); it('should change orientation from LANDSCAPE to PORTRAIT', () => { - browser.getOrientation.returns(q('LANDSCAPE')); + browser.getOrientation.returns(Promise.resolve('LANDSCAPE')); + const changeOrientation = mkAction('changeOrientation', browser); - return runAction('changeOrientation', browser) + return changeOrientation() .then(() => assert.calledWith(browser.setOrientation, 'PORTRAIT')); }); it('should restore orientation in post actions', () => { const postActions = sinon.createStubInstance(ActionsBuilder); + const changeOrientation = mkAction('changeOrientation', browser, postActions); - return runAction('changeOrientation', browser, postActions) + return changeOrientation() .then(() => assert.called(postActions.changeOrientation)); }); it('should be rejected if getting of orientation fails', () => { - browser.getOrientation.returns(q.reject('awesome error')); + browser.getOrientation.rejects('awesome error'); + const changeOrientation = mkAction('changeOrientation', browser); - return assert.isRejected(runAction('changeOrientation', browser), /awesome error/); + return assert.isRejected(changeOrientation(), /awesome error/); }); it('should be rejected if setting of orientation fails', () => { - browser.setOrientation.returns(q.reject('awesome error')); + browser.setOrientation.rejects('awesome error'); + const changeOrientation = mkAction('changeOrientation', browser); + + return assert.isRejected(changeOrientation(), /awesome error/); + }); + + it('should wait for orientation change', () => { + const changeOrientation = mkAction('changeOrientation', browser); + + return changeOrientation() + .then(() => assert.callOrder(browser.setOrientation, browser.waitFor)); + }); + + it('should wait for orientation change using the default timeout', () => { + const changeOrientation = mkAction('changeOrientation', browser); + + return changeOrientation() + .then(() => assert.calledWith(browser.waitFor, sinon.match.any, 2500)); + }); + + it('should wait for orientation change using the passed timeout', () => { + const changeOrientation = mkAction('changeOrientation', browser); + + return changeOrientation({timeout: 100500}) + .then(() => assert.calledWith(browser.waitFor, sinon.match.any, 100500)); + }); + + it('should be rejected if orientation did not changed in passed timeout', () => { + browser.waitFor.rejects(); + + const changeOrientation = mkAction('changeOrientation', browser); + + return assert.isRejected(changeOrientation(), StateError); + }); + }); + + describe('mouse actions', () => { + beforeEach(() => { + sandbox.stub(browser, 'moveTo').returns(Promise.resolve()); + sandbox.stub(browser, 'findElement').returns(Promise.resolve({})); + }); + + describe('click', () => { + beforeEach(() => { + sandbox.stub(browser, 'click').returns(Promise.resolve()); + }); + + it('should use left button if not specified', () => { + const click = mkAction('click', browser); + + return click('.some-selector') + .then(() => assert.calledWith(browser.click, 0)); + }); + + it('should use passed button', () => { + const click = mkAction('click', browser); + + return click('.some-selector', 1) + .then(() => assert.calledWith(browser.click, 1)); + }); + + it('should throw on bad button (not 0, 1 or 2)', () => { + const click = mkAction('click', browser); + + assert.throws(() => click('.some-selector', 3), /Mouse button should be/); + }); + }); + + describe('mouseDown', () => { + beforeEach(() => { + sandbox.stub(browser, 'buttonDown').returns(Promise.resolve()); + }); + + it('should use left button if not specified', () => { + const mouseDown = mkAction('mouseDown', browser); + + return mouseDown('.some-selector') + .then(() => assert.calledWith(browser.buttonDown, 0)); + }); + + it('should use passed button', () => { + const mouseDown = mkAction('mouseDown', browser); + + return mouseDown('.some-selector', 1) + .then(() => assert.calledWith(browser.buttonDown, 1)); + }); + + it('should throw on bad button (not 0, 1 or 2)', () => { + const mouseDown = mkAction('mouseDown', browser); + + assert.throws(() => mouseDown('.some-selector', 3), /Mouse button should be/); + }); + }); + + describe('mouseUp', () => { + beforeEach(() => { + sandbox.stub(browser, 'buttonUp').returns(Promise.resolve()); + }); + + it('should use left button if not specified', () => { + const mouseUp = mkAction('mouseUp', browser); + + return mouseUp('.some-selector') + .then(() => assert.calledWith(browser.buttonUp, 0)); + }); + + it('should use passed button', () => { + const mouseUp = mkAction('mouseUp', browser); + + return mouseUp('.some-selector', 1) + .then(() => assert.calledWith(browser.buttonUp, 1)); + }); + + it('should throw on bad button (not 0, 1 or 2)', () => { + const mouseUp = mkAction('mouseUp', browser); + + assert.throws(() => mouseUp('.some-selector', 3), /Mouse button should be/); + }); + }); + }); + + describe('waitForElementToShow', () => { + beforeEach(() => sandbox.stub(browser, 'waitForElementByCssSelector').resolves()); + + const waitForElementToShowAction = (selector, timeout) => mkAction('waitForElementToShow', browser)(selector, timeout); + + it('should throw if passed timeout is not a number', () => { + assert.throws(() => waitForElementToShowAction('.some-selector', 'string'), + /waitForElementToShow accepts only numeric timeout/); + }); + + it('should not throw if timeout is not passed', () => { + assert.doesNotThrow(() => waitForElementToShowAction('.some-selector')); + }); - return assert.isRejected(runAction('changeOrientation', browser), /awesome error/); + it('should use passed numeric timeout', () => { + return waitForElementToShowAction('.some-selector', 100500) + .then(() => assert.calledOnceWith(browser.waitForElementByCssSelector, sinon.match.any, sinon.match.any, 100500)); }); }); }); diff --git a/test/unit/tests-api/index.js b/test/unit/tests-api/index.js index 2dd8be752..1a380d5a9 100644 --- a/test/unit/tests-api/index.js +++ b/test/unit/tests-api/index.js @@ -1,90 +1,107 @@ 'use strict'; -var testsAPI = require('lib/tests-api'), - Suite = require('lib/suite'); +const testsAPI = require('lib/tests-api'); +const Suite = require('lib/suite'); -describe('tests-api', function() { - beforeEach(function() { - this.suite = Suite.create(''); - }); +describe('tests-api', () => { + let rootSuite; + let gemini; + + const stubConfig = () => ({system: {}}); - describe('.suite method', function() { - var gemini; + beforeEach(() => { + rootSuite = Suite.create(''); + }); - beforeEach(function() { - gemini = testsAPI(this.suite); + describe('.suite method', () => { + beforeEach(() => { + gemini = testsAPI(rootSuite, null, null, stubConfig()); }); - it('should throw an error if first argument is not a string', function() { - assert.throws(function() { - gemini.suite(123, function() {}); - }, TypeError); + it('should throw an error if first argument is not a string', () => { + assert.throws(() => gemini.suite(123, () => {}), TypeError); }); - it('should throw an error if second argument is not a function', function() { - assert.throws(function() { - gemini.suite('name'); - }, TypeError); + it('should throw an error if second argument is not a function', () => { + assert.throws(() => gemini.suite('name'), TypeError); }); - it('should create new suite with corresponding name', function() { - gemini.suite('name', function() {}); + it('should create new suite with corresponding name', () => { + gemini.suite('name', () => {}); - assert.equal(this.suite.children[0].name, 'name'); + assert.equal(rootSuite.children[0].name, 'name'); }); - it('should call callback', function() { - var spy = sinon.spy(); + it('should call callback', () => { + const spy = sinon.spy(); gemini.suite('name', spy); assert.called(spy); }); - it('should created nested suites when called nestedly', function() { - gemini.suite('name', function() { - gemini.suite('child', function() {}); - }); + it('should created nested suites when called nestedly', () => { + gemini.suite('name', () => gemini.suite('child', () => {})); - assert.equal(this.suite.children[0].children[0].name, 'child'); + assert.equal(rootSuite.children[0].children[0].name, 'child'); }); - it('should not allow create two child suites of the same name', function() { - assert.throws(function() { - gemini.suite('name', function() { - gemini.suite('child', function() {}); - gemini.suite('child', function() {}); + describe('child suites of the same name', () => { + const initTestAPI = (browser) => testsAPI(rootSuite, [browser], null, stubConfig()); + + beforeEach(() => { + gemini = initTestAPI('browser1'); + }); + + it('should not allow to create with intersect browsers', () => { + assert.throws(() => { + gemini.suite('name', () => { + gemini.suite('child', () => {}); + gemini.suite('child', () => {}); + }); + }); + }); + + it('should allow to create with not intersecting browser sets', () => { + gemini.suite('name', () => gemini.suite('child', () => {})); + + gemini = initTestAPI('browser2'); + + assert.doesNotThrow(() => { + gemini.suite('name', () => { + gemini.suite('child', () => {}); + }); }); }); }); - it('should create non-nested suite at the root level', function() { - gemini.suite('first', function() {}); - gemini.suite('second', function() {}); + it('should create non-nested suite at the root level', () => { + gemini.suite('first', () => {}); + gemini.suite('second', () => {}); - assert.equal(this.suite.children[1].name, 'second'); + assert.equal(rootSuite.children[1].name, 'second'); }); - it('should throw when suite has states but does not has URL', function() { - assert.throws(function() { - gemini.suite('first', function(suite) { + it('should throw when suite has states but does not has URL', () => { + assert.throws(() => { + gemini.suite('first', (suite) => { suite.setCaptureElements('.element') .capture('plain'); }); }); }); - it('should throw when suite has no states nor URL', function() { - assert.doesNotThrow(function() { - gemini.suite('first', function(suite) { + it('should throw when suite has no states nor URL', () => { + assert.doesNotThrow(() => { + gemini.suite('first', (suite) => { suite.setCaptureElements('.element'); }); }); }); - it('should not throw when suite has states and url is inherited from parent', function() { - assert.doesNotThrow(function() { - gemini.suite('first', function(suite) { + it('should not throw when suite has states and url is inherited from parent', () => { + assert.doesNotThrow(() => { + gemini.suite('first', (suite) => { suite.setUrl('/url'); - gemini.suite('child', function(suite) { + gemini.suite('child', (suite) => { suite.setCaptureElements('.element') .capture('plain'); }); @@ -92,28 +109,28 @@ describe('tests-api', function() { }); }); - it('should throw if suite has states but does not has captureSelectors', function() { - assert.throws(function() { - gemini.suite('first', function(suite) { + it('should throw if suite has states but does not has captureSelectors', () => { + assert.throws(() => { + gemini.suite('first', (suite) => { suite.setUrl('/url') .capture('plain'); }); }); }); - it('should not throw if suite has no states nor captureSelectors', function() { - assert.doesNotThrow(function() { - gemini.suite('first', function(suite) { + it('should not throw if suite has no states nor captureSelectors', () => { + assert.doesNotThrow(() => { + gemini.suite('first', (suite) => { suite.setUrl('/url'); }); }); }); - it('should not throw when suite has states and captureSelectors are inherited from parent', function() { - assert.doesNotThrow(function() { - gemini.suite('first', function(suite) { + it('should not throw when suite has states and captureSelectors are inherited from parent', () => { + assert.doesNotThrow(() => { + gemini.suite('first', (suite) => { suite.setCaptureElements('.element'); - gemini.suite('child', function(suite) { + gemini.suite('child', (suite) => { suite.setUrl('/url') .capture('plain'); }); @@ -121,58 +138,100 @@ describe('tests-api', function() { }); }); - it('should assign suite ids', function() { - gemini.suite('suite', function() {}); - assert.equal(this.suite.children[0].id, 1); + it('should assign suite ids', () => { + gemini.suite('suite', () => {}); + assert.equal(rootSuite.children[0].id, 1); }); - it('should assign incrementing suite ids for following suites', function() { - gemini.suite('suite', function() {}); - gemini.suite('suite2', function() {}); - assert.equal(this.suite.children[1].id, 2); + it('should assign incrementing suite ids for following suites', () => { + gemini.suite('suite', () => {}); + gemini.suite('suite2', () => {}); + assert.equal(rootSuite.children[1].id, 2); }); - it('should assign incrementing suite ids for child suites', function() { - gemini.suite('suite', function() { - gemini.suite('suite2', function() {}); + it('should assign incrementing suite ids for child suites', () => { + gemini.suite('suite', () => { + gemini.suite('suite2', () => {}); }); - assert.equal(this.suite.children[0].children[0].id, 2); + assert.equal(rootSuite.children[0].children[0].id, 2); }); - it('should assign child suite ids before siblings', function() { - gemini.suite('suite', function() { - gemini.suite('suite2', function() {}); + it('should assign child suite ids before siblings', () => { + gemini.suite('suite', () => { + gemini.suite('suite2', () => {}); }); - gemini.suite('suite3', function() {}); + gemini.suite('suite3', () => {}); - assert.equal(this.suite.children[0].children[0].id, 2); - assert.equal(this.suite.children[1].id, 3); + assert.equal(rootSuite.children[0].children[0].id, 2); + assert.equal(rootSuite.children[1].id, 3); }); - }); - describe('browsers', function() { - var browsers = ['some-browser', 'other-browser'], - gemini; + describe('browsers', () => { + const browsers = ['some-browser', 'other-browser']; - beforeEach(function() { - gemini = testsAPI(this.suite, browsers); - }); + beforeEach(() => { + gemini = testsAPI(rootSuite, browsers, null, stubConfig()); + }); + + it('should be set for top level suite', () => { + gemini.suite('suite', () => {}); + + assert.equal(rootSuite.children[0].browsers, browsers); + assert.isTrue(rootSuite.children[0].hasOwnProperty('browsers')); + }); - it('should be set for top level suite', function() { - gemini.suite('suite', function() {}); + it('should not be set for not top level suite', () => { + gemini.suite('suite', () => { + gemini.suite('child', () => {}); + }); - assert.equal(this.suite.children[0].browsers, browsers); - assert.isTrue(this.suite.children[0].hasOwnProperty('browsers')); + assert.equal(rootSuite.children[0].children[0].browsers, browsers); + assert.isFalse(rootSuite.children[0].children[0].hasOwnProperty('browsers')); + }); }); - it('should not be set for not top level suite', function() { - gemini.suite('suite', function() { - gemini.suite('child', function() {}); + describe('file path', () => { + const file = '/root/path/file.js'; + const relativeFile = 'path/file.js'; + + beforeEach(() => { + gemini = testsAPI(rootSuite, [], file, {system: {projectRoot: '/root'}}); + }); + + it('should be set relative for suite', () => { + gemini.suite('suite', () => {}); + + assert.equal(rootSuite.children[0].file, relativeFile); + assert.isTrue(rootSuite.children[0].hasOwnProperty('file')); }); - assert.equal(this.suite.children[0].children[0].browsers, browsers); - assert.isFalse(this.suite.children[0].children[0].hasOwnProperty('browsers')); + it('should not be set for not top level suite', () => { + gemini.suite('suite', () => { + gemini.suite('child', () => {}); + }); + + assert.equal(rootSuite.children[0].children[0].file, relativeFile); + assert.isFalse(rootSuite.children[0].children[0].hasOwnProperty('file')); + }); + }); + }); + + describe('.ctx method', () => { + it('should contain `ctx` from a config', () => { + gemini = testsAPI(rootSuite, null, null, {system: {ctx: {some: 'ctx'}}}); + + assert.deepEqual(gemini.ctx, {some: 'ctx'}); + }); + + it('should not mutate a config', () => { + const config = {system: {ctx: {}}}; + + gemini = testsAPI(rootSuite, null, null, config); + + Object.defineProperty(gemini.ctx, 'other', {}); + + assert.notProperty(config.system.ctx, 'other'); }); }); }); diff --git a/test/unit/tests-api/skip/only-builder.js b/test/unit/tests-api/skip/only-builder.js new file mode 100644 index 000000000..818ebcd03 --- /dev/null +++ b/test/unit/tests-api/skip/only-builder.js @@ -0,0 +1,258 @@ +'use strict'; + +const Suite = require('lib/suite'); +const OnlyBuilder = require('lib/tests-api/skip/only-builder'); + +describe('tests-api/skip/only-builder', () => { + const sandbox = sinon.sandbox.create(); + let rootSuite; + let suite; + let onlyBuilder; + + beforeEach(() => { + rootSuite = Suite.create(''); + suite = Suite.create('some-suite', rootSuite); + onlyBuilder = new OnlyBuilder(suite); + }); + + afterEach(() => { + sandbox.restore(); + }); + + const errorMessage = 'Browsers must be an array with strings and RegExp objects'; + + const testShouldThrow = (method) => { + describe('thould throw', () => { + it('without an argument', () => { + assert.throws(() => { + onlyBuilder[method](); + }, TypeError, errorMessage); + }); + + it('if argument is not a string or RegExp', () => { + assert.throws(() => { + onlyBuilder[method](0); + }, TypeError, errorMessage); + }); + + it('if argument is an array of non-strings or non-RegExps', () => { + assert.throws(() => { + onlyBuilder[method]([false]); + }, TypeError, errorMessage); + }); + + it('if argument is an object', () => { + assert.throws(() => { + onlyBuilder[method]({browserName: 'chrome'}); + }, TypeError, errorMessage); + }); + }); + }; + + describe('in', () => { + testShouldThrow('in'); + + describe('should filter suite browsers by', () => { + it('a string', () => { + rootSuite.browsers = ['ie9', 'chrome']; + + onlyBuilder.in('chrome'); + + assert.deepEqual(suite.browsers, ['chrome']); + }); + + it('a RegExp', () => { + rootSuite.browsers = ['ie8', 'ie9', 'chrome']; + + onlyBuilder.in(/ie.+/); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9']); + }); + + it('an empty array', () => { + rootSuite.browsers = ['ie8', 'ie9', 'chrome']; + + onlyBuilder.in([]); + + assert.deepEqual(suite.browsers, []); + }); + + it('an array of strings and RegExps', () => { + rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; + + onlyBuilder.in([/ie.+/, 'chrome']); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); + }); + + it('strings and RegExps', () => { + rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; + + onlyBuilder.in(/ie.+/, 'chrome'); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); + }); + }); + + it('should not set a browser for a suite if it is not specified in a root one', () => { + rootSuite.browsers = ['opera']; + + onlyBuilder.in('chrome'); + + assert.deepEqual(suite.browsers, []); + }); + + it('should be chainable', () => { + assert.equal(onlyBuilder.in('bro'), onlyBuilder); + }); + + it('should filter browsers in all children suites', () => { + const firstChild = Suite.create('firstChild', suite); + const secondChild = Suite.create('secondChild', suite); + + rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; + + new OnlyBuilder(suite).in([/ie.+/, 'chrome']); + new OnlyBuilder(firstChild).in(/ie.+/); + new OnlyBuilder(secondChild).in('chrome'); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); + assert.deepEqual(firstChild.browsers, ['ie8', 'ie9']); + assert.deepEqual(secondChild.browsers, ['chrome']); + }); + + it('should pass filtered browsers from a parent suite to a child one', () => { + const childSuite = Suite.create('child', suite); + rootSuite.browsers = ['ie', 'opera', 'chrome']; + + new OnlyBuilder(suite).in('ie', 'chrome'); + + assert.deepEqual(childSuite.browsers, ['ie', 'chrome']); + }); + }); + + describe('notIn', () => { + testShouldThrow('notIn'); + + describe('should filter suite browsers by', () => { + it('a string', () => { + rootSuite.browsers = ['ie8', 'ie9', 'chrome']; + + onlyBuilder.notIn('chrome'); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9']); + }); + + it('a RegExp', () => { + rootSuite.browsers = ['ie8', 'ie9', 'chrome']; + + onlyBuilder.notIn(/ie.+/); + + assert.deepEqual(suite.browsers, ['chrome']); + }); + + it('an empty array', () => { + rootSuite.browsers = ['ie9', 'chrome']; + + onlyBuilder.notIn([]); + + assert.deepEqual(suite.browsers, ['ie9', 'chrome']); + }); + + it('an array of strings and RegExps', () => { + rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; + + onlyBuilder.notIn([/ie.+/, 'chrome']); + + assert.deepEqual(suite.browsers, ['opera']); + }); + }); + + it('should be chainable', () => { + assert.equal(onlyBuilder.notIn('bro'), onlyBuilder); + }); + + it('should filter browsers in all children suites', () => { + const firstChild = Suite.create('firstChild', suite); + const secondChild = Suite.create('secondChild', suite); + + rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; + + new OnlyBuilder(suite).notIn(['opera']); + new OnlyBuilder(firstChild).notIn(/ie.+/); + new OnlyBuilder(secondChild).notIn('chrome'); + + assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); + assert.deepEqual(firstChild.browsers, ['chrome']); + assert.deepEqual(secondChild.browsers, ['ie8', 'ie9']); + }); + + it('should pass filtered browsers from a parent suite to a child one', () => { + const childSuite = Suite.create('child', suite); + rootSuite.browsers = ['opera', 'chrome']; + + new OnlyBuilder(suite).notIn('chrome'); + + assert.deepEqual(childSuite.browsers, ['opera']); + }); + }); + + describe('buildAPI', () => { + let api; + + beforeEach(() => { + api = onlyBuilder.buildAPI(suite); + }); + + describe('only.in', () => { + it(`should call OnlyBuilder's .in method`, () => { + sandbox.spy(onlyBuilder, 'in'); + + api.only.in('browser1', 'browser2'); + + assert.calledWith(onlyBuilder.in, 'browser1', 'browser2'); + }); + + it('should return suite instance', () => { + const returnValue = api.only.in('browser1', 'browser2'); + + assert.equal(returnValue, suite); + }); + }); + + describe('only.notIn', () => { + it(`should call OnlyBuilder's .notIn method`, () => { + sandbox.spy(onlyBuilder, 'notIn'); + + api.only.notIn(['browser1', 'browser2']); + + assert.calledWith(onlyBuilder.notIn, ['browser1', 'browser2']); + }); + + it('should return suite instance', () => { + const returnValue = api.only.notIn('browser1', 'browser2'); + + assert.equal(returnValue, suite); + }); + }); + + describe('browsers', () => { + beforeEach(() => { + sandbox.spy(onlyBuilder, 'in'); + sandbox.spy(onlyBuilder, 'notIn'); + }); + + it(`should call OnlyBuilder's .in method`, () => { + api.browsers('browser1', 'browser2'); + + assert.calledWith(onlyBuilder.in, 'browser1', 'browser2'); + }); + + it('should return suite instance', () => { + const returnValue = api.browsers('browser1', 'browser2'); + + assert.equal(returnValue, suite); + }); + }); + }); +}); diff --git a/test/unit/tests-api/skip/skip-builder.js b/test/unit/tests-api/skip/skip-builder.js new file mode 100644 index 000000000..27ac96b6c --- /dev/null +++ b/test/unit/tests-api/skip/skip-builder.js @@ -0,0 +1,239 @@ +'use strict'; + +const Suite = require('lib/suite'); +const SkipBuilder = require('lib/tests-api/skip/skip-builder'); + +describe('tests-api/skip/skip-builder', () => { + const sandbox = sinon.sandbox.create(); + let suite; + let skipBuilder; + + beforeEach(() => { + suite = Suite.create(''); + skipBuilder = new SkipBuilder(suite); + }); + + afterEach(() => { + sandbox.restore(); + }); + + const errorMessage = 'Browsers must be an array with strings and RegExp objects'; + + const testShouldThrow = (method) => { + describe('should throw', () => { + it('without an argument', () => { + assert.throws(() => { + skipBuilder[method](); + }, TypeError, errorMessage); + }); + + it('if argument is not a string or RegExp', () => { + assert.throws(() => { + skipBuilder[method](0); + }, TypeError, errorMessage); + }); + + it('if argument is array with non-string or non-RegExp', () => { + assert.throws(() => { + skipBuilder[method]([false]); + }, TypeError, errorMessage); + }); + + it('if argument is an object', () => { + assert.throws(() => { + skipBuilder[method]({browserName: 'name', version: '123', id: 'browser'}); + }, TypeError, errorMessage); + }); + }); + }; + + describe('in', () => { + testShouldThrow('in'); + + describe('should accept', () => { + it('browser string id', () => { + skipBuilder.in('opera'); + + assert.isTrue(suite.shouldSkip('opera')); + assert.isFalse(suite.shouldSkip('firefox')); + }); + + it('browser RegExp', () => { + skipBuilder.in(/ie1.*/); + + assert.isTrue(suite.shouldSkip('ie11')); + assert.isFalse(suite.shouldSkip('ie8')); + }); + + it(`array of string ids and RegExp's`, () => { + skipBuilder.in([ + 'ie11', + /firefox/ + ]); + + assert.isTrue(suite.shouldSkip('ie11')); + assert.isTrue(suite.shouldSkip('firefox33')); + assert.isFalse(suite.shouldSkip('chrome')); + }); + + it('empty array', () => { + skipBuilder.in([]); + + assert.isFalse(suite.shouldSkip('any_browser')); + }); + + it('comments', () => { + skipBuilder.in('chrome', 'comment'); + + assert.isTrue(suite.shouldSkip('chrome')); + assert.equal(suite.skipComment, 'comment'); + }); + }); + + it('should chain skip methods', () => { + skipBuilder + .in('ie11') + .in(/firefox/); + + assert.isTrue(suite.shouldSkip('ie11')); + assert.isTrue(suite.shouldSkip('firefox33')); + assert.isFalse(suite.shouldSkip('chrome')); + }); + }); + + describe('notIn', () => { + testShouldThrow('notIn'); + + describe('should accept', () => { + it('browser string id', () => { + skipBuilder.notIn('opera'); + + assert.equal(suite.skipped.length, 1); + assert.isFalse(suite.shouldSkip('opera')); + assert.isTrue(suite.shouldSkip('firefox')); + }); + + it('browser RegExp', () => { + skipBuilder.notIn(/ie1.*/); + + assert.isFalse(suite.shouldSkip('ie11')); + assert.isTrue(suite.shouldSkip('ie8')); + }); + + it(`array of string ids and RegExp's`, () => { + skipBuilder.notIn([ + 'ie11', + /firefox/ + ]); + + assert.isTrue(suite.shouldSkip('chrome')); + assert.isFalse(suite.shouldSkip('ie11')); + assert.isFalse(suite.shouldSkip('firefox33')); + }); + + it('empty array', () => { + skipBuilder.notIn([]); + + assert.isTrue(suite.shouldSkip('any_browser')); + }); + + it('comments', () => { + skipBuilder.notIn('chrome', 'comment'); + + assert.isTrue(suite.shouldSkip('firefox')); + assert.equal(suite.skipComment, 'comment'); + }); + }); + + it('should chain skip.notIn methods', () => { + skipBuilder + .notIn('ie11', 'not in ie11') + .notIn(/firefox/, 'not in firefox'); + + assert.isTrue(suite.shouldSkip('firefox33')); + assert.equal(suite.skipComment, 'not in ie11'); + assert.isTrue(suite.shouldSkip('ie11')); + assert.equal(suite.skipComment, 'not in firefox'); + }); + }); + + describe('buildAPI', () => { + let api; + + beforeEach(() => { + api = skipBuilder.buildAPI(suite); + }); + + describe('skip.in', () => { + it(`should call SkipBuilder's .in method`, () => { + sandbox.spy(skipBuilder, 'in'); + + api.skip.in(['browsers'], 'comment'); + + assert.calledWith(skipBuilder.in, ['browsers'], 'comment'); + }); + + it('should return suite instance', () => { + const returnValue = api.skip.in(['browsers'], 'comment'); + + assert.equal(returnValue, suite); + }); + }); + + describe('skip.notIn', () => { + it(`should call SkipBuilder's .notIn method`, () => { + sandbox.spy(skipBuilder, 'notIn'); + + api.skip.notIn(['browsers'], 'comment'); + + assert.calledWith(skipBuilder.notIn, ['browsers'], 'comment'); + }); + + it('should return suite instance', () => { + const returnValue = api.skip.notIn(['browsers'], 'comment'); + + assert.equal(returnValue, suite); + }); + }); + + describe('skip', () => { + beforeEach(() => { + sandbox.spy(skipBuilder, 'in'); + }); + + it(`should call SkipBuilder's .in method`, () => { + api.skip(['browsers'], 'comment'); + + assert.calledWith(skipBuilder.in, ['browsers'], 'comment'); + }); + + it('should return suite instance', () => { + const returnValue = api.skip(['browsers'], 'comment'); + + assert.equal(returnValue, suite); + }); + + it('should skip all browsers if no argument', () => { + api.skip(); + + assert.calledWith(skipBuilder.in, /.*/); + }); + + describe('falsey values', () => { + const skipAllTest = (arg, argDescription = arg) => { + return it(`should skip all browsers if argument is ${argDescription}`, () => { + api.skip(arg); + + assert.calledWith(skipBuilder.in, /.*/); + }); + }; + + skipAllTest(undefined); + skipAllTest(false); + skipAllTest(0); + skipAllTest(null); + skipAllTest('', 'empty string'); + }); + }); + }); +}); diff --git a/test/unit/tests-api/suite-builder.js b/test/unit/tests-api/suite-builder.js index b1c37cf03..0fa70f836 100644 --- a/test/unit/tests-api/suite-builder.js +++ b/test/unit/tests-api/suite-builder.js @@ -1,37 +1,39 @@ 'use strict'; -var SuiteBuilder = require('lib/tests-api/suite-builder'), - Suite = require('lib/suite'), - ActionsBuilder = require('lib/tests-api/actions-builder'), - find = require('lib/tests-api/find-func').find; - -describe('tests-api/suite-builder', function() { - var sandbox = sinon.sandbox.create(), - suite, - suiteBuilder; - - beforeEach(function() { +const SuiteBuilder = require('lib/tests-api/suite-builder'); +const Suite = require('lib/suite'); +const ActionsBuilder = require('lib/tests-api/actions-builder'); +const {find} = require('lib/tests-api/find-func'); +const SkipBuilder = require('lib/tests-api/skip/skip-builder'); +const OnlyBuilder = require('lib/tests-api/skip/only-builder'); + +describe('tests-api/suite-builder', () => { + const sandbox = sinon.sandbox.create(); + let suite; + let suiteBuilder; + + beforeEach(() => { suite = Suite.create(''); suiteBuilder = new SuiteBuilder(suite); }); - afterEach(function() { + afterEach(() => { sandbox.restore(); }); - describe('setUrl', function() { - it('should throw if argument is not a string', function() { - assert.throws(function() { + describe('setUrl', () => { + it('should throw if argument is not a string', () => { + assert.throws(() => { suiteBuilder.setUrl({not: 'a string'}); }, TypeError); }); - it('should set url property', function() { + it('should set url property', () => { suiteBuilder.setUrl('http://example.com'); assert.equal(suite.url, 'http://example.com'); }); - it('should be chainable', function() { + it('should be chainable', () => { assert.equal( suiteBuilder.setUrl(''), suiteBuilder @@ -39,19 +41,19 @@ describe('tests-api/suite-builder', function() { }); }); - describe('setTolerance', function() { - it('should throw if argument is not a string', function() { - assert.throws(function() { + describe('setTolerance', () => { + it('should throw if argument is not a string', () => { + assert.throws(() => { suiteBuilder.setTolerance('so much'); }, TypeError); }); - it('should set tolerance passed as number', function() { + it('should set tolerance passed as number', () => { suiteBuilder.setTolerance(25); assert.equal(suite.tolerance, 25); }); - it('should be chainable', function() { + it('should be chainable', () => { assert.equal( suiteBuilder.setTolerance(0), suiteBuilder @@ -59,49 +61,94 @@ describe('tests-api/suite-builder', function() { }); }); - testSelectorListProperty('setCaptureElements', 'captureSelectors'); - testSelectorListProperty('ignoreElements', 'ignoreSelectors'); + describe('setCaptureElements', () => { + it('should throw if selector is not a string', () => { + assert.throws(() => { + suiteBuilder.setCaptureElements({everything: true}); + }, TypeError); + }); - function testSelectorListProperty(method, property) { - describe(method, function() { - it ('should throw if selector is not a string', function() { - assert.throws(function() { - suiteBuilder[method]({everything: true}); - }, TypeError); - }); + it('should throw if selector in array is not a string', () => { + assert.throws(() => { + suiteBuilder.setCaptureElements([{everything: true}, '.selector']); + }, TypeError); + }); - it ('should throw if selector in array is not a string', function() { - assert.throws(function() { - suiteBuilder[method]([{everything: true}, '.selector']); - }, TypeError); - }); + it('should set captureSelectors property', () => { + suiteBuilder.setCaptureElements('.selector'); - it('should set ' + property + ' property', function() { - suiteBuilder[method]('.selector'); + assert.deepEqual(suite.captureSelectors, ['.selector']); + }); - assert.deepEqual(suite[property], ['.selector']); - }); + it('should accept multiple arguments', () => { + suiteBuilder.setCaptureElements('.selector1', '.selector2'); + assert.deepEqual(suite.captureSelectors, ['.selector1', '.selector2']); + }); - it('should accept multiple arguments', function() { - suiteBuilder[method]('.selector1', '.selector2'); - assert.deepEqual(suite[property], ['.selector1', '.selector2']); - }); + it('should accept array', () => { + suiteBuilder.setCaptureElements(['.selector1', '.selector2']); - it('should accept array', function() { - suiteBuilder[method](['.selector1', '.selector2']); + assert.deepEqual(suite.captureSelectors, ['.selector1', '.selector2']); + }); + }); - assert.deepEqual(suite[property], ['.selector1', '.selector2']); - }); + describe('ignoreElements', () => { + it('should throw if selector is a null', () => { + assert.throws(() => { + suiteBuilder.ignoreElements(null); + }, TypeError); }); - } - describe('before', function() { - beforeEach(function() { - sandbox.stub(ActionsBuilder.prototype, '__constructor'); + it('should throw if selector is object without property "every"', () => { + assert.throws(() => { + suiteBuilder.ignoreElements({}); + }, TypeError); }); - it('should call before hook with actions builder and find', function() { - var hook = sinon.stub(); + it('should throw if selector is an object with property "every" that not a string', () => { + assert.throws(() => { + suiteBuilder.ignoreElements({every: null}); + }, TypeError); + }); + + it('should throw if one of selectors in array has wrong type', () => { + assert.throws(() => { + suiteBuilder.ignoreElements([{every: true}, '.selector']); + }, TypeError); + }); + + it('should set ignoreSelectors property as string', () => { + suiteBuilder.ignoreElements('.selector'); + + assert.deepEqual(suite.ignoreSelectors, ['.selector']); + }); + + it('should set ignoreSelectors property as object with property "every"', () => { + suiteBuilder.ignoreElements({every: '.selector'}); + + assert.deepEqual(suite.ignoreSelectors, [{every: '.selector'}]); + }); + + it('should accept multiple arguments', () => { + suiteBuilder.ignoreElements('.selector1', {every: '.selector2'}); + + assert.deepEqual(suite.ignoreSelectors, ['.selector1', {every: '.selector2'}]); + }); + + it('should accept array', () => { + suiteBuilder.ignoreElements(['.selector1', {every: '.selector2'}]); + + assert.deepEqual(suite.ignoreSelectors, ['.selector1', {every: '.selector2'}]); + }); + }); + + describe('before', () => { + beforeEach(() => { + sandbox.stub(ActionsBuilder, 'create').returns(new ActionsBuilder()); + }); + + it('should call before hook with actions builder and find', () => { + const hook = sinon.stub(); suiteBuilder.before(hook); @@ -109,18 +156,18 @@ describe('tests-api/suite-builder', function() { assert.calledWith(hook, sinon.match.instanceOf(ActionsBuilder), find); }); - it('should call before hook and set beforeActions property', function() { - ActionsBuilder.prototype.__constructor.returnsArg(0); + it('should call before hook and set beforeActions property', () => { + ActionsBuilder.create.returnsArg(0); - suiteBuilder.before(function(actions) { + suiteBuilder.before((actions) => { actions.push(1, 2, 3); }); assert.deepEqual([1, 2, 3], suite.beforeActions); }); - it('should call before hook with suite context', function() { - var hook = sinon.stub(); + it('should call before hook with suite context', () => { + const hook = sinon.stub(); suiteBuilder.before(hook); @@ -130,26 +177,26 @@ describe('tests-api/suite-builder', function() { ); }); - it('should prepend suite beforeActions with parent beforeActions', function() { - var parent = Suite.create('parent'), - suite = Suite.create('suite', parent); + it('should prepend suite beforeActions with parent beforeActions', () => { + const parent = Suite.create('parent'); + const suite = Suite.create('suite', parent); parent.beforeActions = [1, 2, 3]; - ActionsBuilder.prototype.__constructor.returnsArg(0); - new SuiteBuilder(suite).before(function(actions) { + ActionsBuilder.create.returnsArg(0); + new SuiteBuilder(suite).before((actions) => { actions.push(4, 5); }); assert.deepEqual([1, 2, 3, 4, 5], suite.beforeActions); }); - it('should not affect parent beforeActions property', function() { - var parent = Suite.create('parent'), - suite = Suite.create('suite', parent); + it('should not affect parent beforeActions property', () => { + const parent = Suite.create('parent'); + const suite = Suite.create('suite', parent); parent.beforeActions = [1, 2, 3]; - ActionsBuilder.prototype.__constructor.returnsArg(0); - new SuiteBuilder(suite).before(function(actions) { + ActionsBuilder.create.returnsArg(0); + new SuiteBuilder(suite).before((actions) => { actions.push(4, 5); }); @@ -157,13 +204,13 @@ describe('tests-api/suite-builder', function() { }); }); - describe('after', function() { - beforeEach(function() { - sandbox.stub(ActionsBuilder.prototype, '__constructor'); + describe('after', () => { + beforeEach(() => { + sandbox.stub(ActionsBuilder, 'create').returns(new ActionsBuilder()); }); - it('should call after hook with actions builder and find', function() { - var hook = sinon.stub(); + it('should call after hook with actions builder and find', () => { + const hook = sinon.stub(); suiteBuilder.after(hook); @@ -171,18 +218,18 @@ describe('tests-api/suite-builder', function() { assert.calledWith(hook, sinon.match.instanceOf(ActionsBuilder), find); }); - it('should call after hook and set afterActions property', function() { - ActionsBuilder.prototype.__constructor.returnsArg(0); + it('should call after hook and set afterActions property', () => { + ActionsBuilder.create.returnsArg(0); - suiteBuilder.after(function(actions) { + suiteBuilder.after((actions) => { actions.push(1, 2, 3); }); assert.deepEqual([1, 2, 3], suite.afterActions); }); - it('should call after hook with suite context', function() { - var hook = sinon.stub(); + it('should call after hook with suite context', () => { + const hook = sinon.stub(); suiteBuilder.after(hook); @@ -192,26 +239,26 @@ describe('tests-api/suite-builder', function() { ); }); - it('should append parent afterActions to suite afterActions', function() { - var parent = Suite.create('parent'), - suite = Suite.create('suite', parent); + it('should append parent afterActions to suite afterActions', () => { + const parent = Suite.create('parent'); + const suite = Suite.create('suite', parent); parent.afterActions = [4, 5]; - ActionsBuilder.prototype.__constructor.returnsArg(0); - new SuiteBuilder(suite).after(function(actions) { + ActionsBuilder.create.returnsArg(0); + new SuiteBuilder(suite).after((actions) => { actions.push(1, 2, 3); }); assert.deepEqual([1, 2, 3, 4, 5], suite.afterActions); }); - it('should not affect parent afterActions property', function() { - var parent = Suite.create('parent'), - suite = Suite.create('suite', parent); + it('should not affect parent afterActions property', () => { + const parent = Suite.create('parent'); + const suite = Suite.create('suite', parent); parent.afterActions = [4, 5]; - ActionsBuilder.prototype.__constructor.returnsArg(0); - new SuiteBuilder(suite).after(function(actions) { + ActionsBuilder.create.returnsArg(0); + new SuiteBuilder(suite).after((actions) => { actions.push(1, 2, 3); }); @@ -219,44 +266,44 @@ describe('tests-api/suite-builder', function() { }); }); - describe('capture', function() { - beforeEach(function() { + describe('capture', () => { + beforeEach(() => { suiteBuilder .setUrl('/path') .setCaptureElements('.element'); }); - it('should throw if first argument is not passed', function() { - assert.throws(function() { + it('should throw if first argument is not passed', () => { + assert.throws(() => { suiteBuilder.capture({not: 'a string'}); }, TypeError); }); - it('should throw if second argument is not a function', function() { - assert.throws(function() { + it('should throw if second argument is not a function', () => { + assert.throws(() => { suiteBuilder.capture('state', 'make me a sandwich'); }, TypeError); }); - it('should not throw if second argument is absent', function() { - assert.doesNotThrow(function() { + it('should not throw if second argument is absent', () => { + assert.doesNotThrow(() => { suiteBuilder.capture('state'); }); }); - it('should create named state', function() { + it('should create named state', () => { suiteBuilder.capture('state'); assert.equal(suite.states[0].name, 'state'); }); - it('should throw if state with such name already exists', function() { - assert.throws(function() { + it('should throw if state with such name already exists', () => { + assert.throws(() => { suiteBuilder.capture('state'); suiteBuilder.capture('state'); }); }); - it('should allow to have multiple states of different names', function() { + it('should allow to have multiple states of different names', () => { suiteBuilder .capture('state 1') .capture('state 2'); @@ -265,13 +312,13 @@ describe('tests-api/suite-builder', function() { assert.equal(suite.states[1].name, 'state 2'); }); - it('should make new state reference the suite', function() { + it('should make new state reference the suite', () => { suiteBuilder.capture('state'); assert.equal(suite.states[0].suite, suite); }); - it('should call passed callback with actions builder and find', function() { - var cb = sinon.stub(); + it('should call passed callback with actions builder and find', () => { + const cb = sinon.stub(); suiteBuilder.capture('state', cb); @@ -279,8 +326,8 @@ describe('tests-api/suite-builder', function() { assert.calledWith(cb, sinon.match.instanceOf(ActionsBuilder), find); }); - it('should call passed callback with suite context', function() { - var cb = sinon.stub(); + it('should call passed callback with suite context', () => { + const cb = sinon.stub(); suiteBuilder.capture('state', cb); @@ -290,184 +337,99 @@ describe('tests-api/suite-builder', function() { ); }); - it('should set `actions` property', function() { - sandbox.stub(ActionsBuilder.prototype, '__constructor').returnsArg(0); + it('should set `actions` property', () => { + sandbox.stub(ActionsBuilder, 'create').returnsArg(0); - suiteBuilder.capture('state', function(actions) { + suiteBuilder.capture('state', (actions) => { actions.push(1, 2, 3); }); assert.deepEqual([1, 2, 3], suite.states[0].actions); }); - it('should allow to set tolerance', function() { - suiteBuilder.capture('state', {tolerance: 25}, function() {}); + it('should allow to set tolerance', () => { + suiteBuilder.capture('state', {tolerance: 25}, () => { + }); assert.equal(suite.states[0].tolerance, 25); }); - it('should throw if tolerance is not a number', function() { - assert.throws(function() { - suiteBuilder.capture('state', {tolerance: 'so much'}, function() {}); + it('should throw if tolerance is not a number', () => { + assert.throws(() => { + suiteBuilder.capture('state', {tolerance: 'so much'}, () => { + }); }, TypeError); }); - it('should be chainable', function() { + it('should be chainable', () => { assert.equal(suiteBuilder.capture('state'), suiteBuilder); }); }); - describe('skip', function() { - it('should throw if argument is not a string nor RegExp', function() { - assert.throws(function() { - suiteBuilder.skip(123); - }, TypeError); - }); - - it('should throw if argument is array with non-string or non-RegExp', function() { - assert.throws(function() { - suiteBuilder.skip([123]); - }, TypeError); - }); - - it('should throw if argument is an object', function() { - assert.throws(function() { - suiteBuilder.skip({browserName: 'name', version: '123', id: 'browser'}); - }, Error); - }); + describe('SkipBuilder API', () => { + let suite; + let skipBuilder; + let suiteBuilder; - it('should mark suite as skipped', function() { - suiteBuilder.skip(); - assert.isTrue(suite.skipped); - }); + beforeEach(() => { + suite = Suite.create(''); - it('should accept skipped browser string id', function() { - suiteBuilder.skip('opera'); - - assert.equal(suite.skipped.length, 1); - assert.isTrue(suite.skipped[0].matches('opera')); - assert.isFalse(suite.skipped[0].matches('firefox')); - }); - - it('should accept skipped browser RegExp', function() { - suiteBuilder.skip(/ie1.*/); - - assert.isTrue(suite.skipped[0].matches('ie11')); - assert.isFalse(suite.skipped[0].matches('ie8')); - }); + skipBuilder = new SkipBuilder(suite); + sandbox.stub(SkipBuilder, 'create').returns(skipBuilder); + sandbox.spy(skipBuilder, 'buildAPI'); - it('should accept array of string ids and RegExp\'s', function() { - suiteBuilder.skip([ - 'ie11', - /firefox/ - ]); - - assert.isTrue(suite.skipped[0].matches('ie11')); - assert.isTrue(suite.skipped[1].matches('firefox33')); - }); - }); - - describe('browsers', function() { - var rootSuite; - - beforeEach(function() { - rootSuite = Suite.create(''); - suite = Suite.create('', rootSuite); suiteBuilder = new SuiteBuilder(suite); }); - it('should throw without an argument', function() { - assert.throws(function() { - suiteBuilder.browsers(); - }, /string or RegExp/); + it(`should call SkipBuilder's .buildAPI method`, () => { + assert.calledOnce(skipBuilder.buildAPI); }); - it('should throw if an argument is not a string or RegExp', function() { - assert.throws(function() { - suiteBuilder.browsers(123); - }, /string or RegExp/); - }); + it(`should extend SkipBuilder API's methods`, () => { + const api = skipBuilder.buildAPI.returnValues[0]; - it('should throw if an argument is an array of non-strings or non-RegExps', function() { - assert.throws(function() { - suiteBuilder.browsers([123]); - }, /string or RegExp/); + assert.equal(suiteBuilder.skip, api.skip); + assert.equal(suiteBuilder.skip.in, api.skip.in); + assert.equal(suiteBuilder.skip.notIn, api.skip.notIn); }); - it('should filter suite browsers by a string', function() { - rootSuite.browsers = ['ie8', 'ie9', 'chrome']; - - suiteBuilder.browsers('chrome'); - - assert.deepEqual(suite.browsers, ['chrome']); + it('should be chainable', () => { + assert.equal(suiteBuilder.skip('bro'), suiteBuilder); + assert.equal(suiteBuilder.skip.in('bro'), suiteBuilder); + assert.equal(suiteBuilder.skip.notIn('bro'), suiteBuilder); }); + }); - it('should filter suite browsers by a RegExp', function() { - rootSuite.browsers = ['ie8', 'ie9', 'chrome']; - - suiteBuilder.browsers(/ie.+/); - - assert.deepEqual(suite.browsers, ['ie8', 'ie9']); - }); - - it('should filter suite browsers by an array of strings', function() { - rootSuite.browsers = ['ie8', 'ie9', 'chrome']; - - suiteBuilder.browsers(['chrome']); - - assert.deepEqual(suite.browsers, ['chrome']); - }); - - it('should filter suite browsers by an array of RegExps', function() { - rootSuite.browsers = ['ie8', 'ie9', 'chrome']; - - suiteBuilder.browsers([/ie.+/]); - - assert.deepEqual(suite.browsers, ['ie8', 'ie9']); - }); - - it('should filter suite browsers by an array of strings and RegExps', function() { - rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; - - suiteBuilder.browsers([/ie.+/, 'chrome']); + describe('OnlyBuilder API', () => { + let suite; + let onlyBuilder; + let suiteBuilder; - assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); - }); + beforeEach(() => { + suite = Suite.create(''); - it('should not set a browser for a suite if it is not specified in a root one', function() { - rootSuite.browsers = ['opera']; + onlyBuilder = new OnlyBuilder(suite); + sandbox.stub(OnlyBuilder, 'create').returns(onlyBuilder); + sandbox.spy(onlyBuilder, 'buildAPI'); - suiteBuilder.browsers('chrome'); - - assert.deepEqual(suite.browsers, []); + suiteBuilder = new SuiteBuilder(suite); }); - it('should be chainable', function() { - assert.equal(suiteBuilder.browsers([]), suiteBuilder); + it(`should call OnlyBuilder's .buildAPI method`, () => { + assert.calledOnce(onlyBuilder.buildAPI); }); - it('should filter browsers in all children suites', function() { - var firstChild = Suite.create('firstChild', suite), - secondChild = Suite.create('secondChild', suite); + it(`should extend OnlyBuilder API's methods`, () => { + const api = onlyBuilder.buildAPI.returnValues[0]; - rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; - - suiteBuilder.browsers([/ie.+/, 'chrome']); - new SuiteBuilder(firstChild).browsers(/ie.+/); - new SuiteBuilder(secondChild).browsers('chrome'); - - assert.deepEqual(suite.browsers, ['ie8', 'ie9', 'chrome']); - assert.deepEqual(firstChild.browsers, ['ie8', 'ie9']); - assert.deepEqual(secondChild.browsers, ['chrome']); + assert.equal(suiteBuilder.browsers, api.browsers); + assert.equal(suiteBuilder.only.in, api.only.in); + assert.equal(suiteBuilder.only.notIn, api.only.notIn); }); - it('should pass filtered browsers from a parent suite to a child one', function() { - var childSuite = Suite.create('child', suite); - - rootSuite.browsers = ['ie8', 'ie9', 'opera', 'chrome']; - - suiteBuilder.browsers('chrome'); - - assert.deepEqual(childSuite.browsers, ['chrome']); + it('should be chainable', () => { + assert.equal(suiteBuilder.browsers('bro'), suiteBuilder); + assert.equal(suiteBuilder.only.in('bro'), suiteBuilder); + assert.equal(suiteBuilder.only.notIn('bro'), suiteBuilder); }); }); }); diff --git a/test/util.js b/test/util.js index 17597cb34..6b3d029af 100644 --- a/test/util.js +++ b/test/util.js @@ -1,8 +1,10 @@ 'use strict'; -var Browser = require('lib/browser'), - State = require('lib/state'), - Suite = require('lib/suite'), - _ = require('lodash'); + +const Browser = require('lib/browser/new-browser'); +const Promise = require('bluebird'); +const State = require('lib/state'); +const Suite = require('lib/suite'); +const _ = require('lodash'); function makeBrowser(capabilities, config) { config = _.merge({}, { @@ -12,36 +14,43 @@ function makeBrowser(capabilities, config) { coverage: {} } }, config); - return Browser.create(config); + return new Browser(config); } function browserWithId(id) { - return Browser.create({ - id: id, + return new Browser({ + id, desiredCapabilities: { browserName: id + }, + system: { + coverage: {} } }); } function makeSuiteStub(opts) { opts = _.defaults(opts || {}, { - name: 'some-default-name_' + new Date().getTime(), + name: `some-default-name_${new Date().getTime()}`, url: 'some-default-url', states: [] }); - var suite = Suite.create(opts.name, opts.parent); + const suite = Suite.create(opts.name, opts.parent); suite.beforeActions = ['before', 'actions']; suite.afterActions = ['after', 'actions']; if (opts.browsers) { suite.browsers = opts.browsers; } + if (opts.path) { + suite.path = opts.path; + } opts.states.forEach(function(state) { suite.addState(state); }); suite.url = opts.url; + suite.file = opts.file; return suite; } @@ -50,13 +59,30 @@ function makeStateStub(suite, opts) { suite = suite || makeSuiteStub(); opts = opts || {}; - var state = new State(suite, opts.name || 'default-state-name'); + const state = new State(suite, opts.name || 'default-state-name'); state.shouldSkip = sinon.stub(); suite.states.push(state); return state; } +function makeStateResult(opts) { + opts = _.defaults(opts || {}, { + name: 'default-name', + updated: false, + equal: false + }); + + const suite = makeSuiteStub({ + name: 'default-suite-name', + path: ['suite'], + file: 'default/path/file.js' + }); + const state = makeStateStub(suite, {fullName: 'full-' + opts.name, name: opts.name}); + + return _.defaultsDeep(opts, {state, suite}); +} + /** * Makes suite tree * @param {Object} sceleton, keys must be unique for all levels @@ -81,16 +107,17 @@ function makeSuiteTree(sceleton, rootOpts) { browsers: ['default-browser1', 'default-browser2'] }); - var tree = {}; + const tree = {}; mkTree_(sceleton, makeSuiteStub(rootOpts)); return tree; function mkTree_(sceleton, parent) { - _.forEach(sceleton, function(val, name) { + _.forEach(sceleton, (val, name) => { if (_.isString(val)) { pushToTree_(val, makeStateStub(parent, {name: val})); } else { - var suite = makeSuiteStub({parent: parent, name: name}); + const suite = makeSuiteStub({parent: parent, name: name}); + parent.addChild(suite); pushToTree_(name, suite); mkTree_(val, suite); } @@ -105,8 +132,23 @@ function makeSuiteTree(sceleton, rootOpts) { } } -exports.makeBrowser = makeBrowser; -exports.browserWithId = browserWithId; -exports.makeStateStub = makeStateStub; -exports.makeSuiteStub = makeSuiteStub; -exports.makeSuiteTree = makeSuiteTree; +function rejectedPromise(error) { + if (!error) { + error = new Error('Rejected'); + } else if (typeof error === 'string') { + error = new Error(error); + } + const promise = Promise.reject(error); + promise.catch(() => {}); + return promise; +} + +module.exports = { + makeBrowser, + browserWithId, + makeStateStub, + makeSuiteStub, + makeStateResult, + makeSuiteTree, + rejectedPromise +};