├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin └── cli.js ├── package-lock.json ├── package.json ├── src ├── controllers │ ├── bot-runner.js │ └── github-controller.js ├── models │ ├── travis-env-model.js │ └── units.js ├── npm-module.js ├── plugins │ ├── plugin-interface.js │ └── size.js └── utils │ └── log-helper.js └── test ├── node ├── plugins │ ├── test-plugin-interface.js │ └── test-size.js ├── test-github-controller.js ├── test-travis-bot.js ├── test-travis-env-model.js └── utils │ └── test-log-helper.js └── static ├── bad-plugin.config.js ├── base-branch-override.config.js ├── example-with-plugin-no-bot-name.config.js ├── example-with-plugin-that-fails-build.js ├── example-with-plugin.config.js ├── example.config.js ├── no-plugin-name.config.js ├── no-repo-details.config.js ├── non-returning.config.js ├── size-example-after ├── content-to-empty.txt ├── dino.jpg ├── empty-to-content.txt ├── empty.txt ├── minor-change.txt ├── new-file.txt └── stays-the-same.txt ├── size-example-before ├── content-to-empty.txt ├── deleted-file.txt ├── dino.jpg ├── empty-to-content.txt ├── empty.txt ├── minor-change.txt └── stays-the-same.txt └── throwing.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | 5 | cache: 6 | directories: 7 | - "node_modules" 8 | 9 | install: 10 | - npm install 11 | 12 | script: 13 | - npm run test-with-coverage 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution, 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pr-bot 2 | 3 | [![Build Status](https://travis-ci.org/GoogleChromeLabs/pr-bot.svg?branch=master)](https://travis-ci.org/GoogleChromeLabs/pr-bot) [![Coverage Status](https://coveralls.io/repos/github/GoogleChromeLabs/pr-bot/badge.svg?branch=master)](https://coveralls.io/github/GoogleChromeLabs/pr-bot?branch=master) [![dependencies Status](https://david-dm.org/googlechromelabs/pr-bot/status.svg)](https://david-dm.org/googlechromelabs/pr-bot) [![devDependencies Status](https://david-dm.org/googlechromelabs/pr-bot/dev-status.svg)](https://david-dm.org/googlechromelabs/pr-bot?type=dev) 4 | 5 | This is a small utility to run a set of "plugins" 6 | against a Pull Request on Travis and then report 7 | a set of results to GitHub. 8 | 9 | ![Example PR-Bot Output](http://i.imgur.com/QMOaiQy.png) 10 | 11 | ## Getting Started 12 | 13 | To use `pr-bot` you'll need to set up a few 14 | things: 15 | 16 | 1. Create a GitHub account to use for bot 17 | activity. This will be the account login and 18 | profile photo that you'll see when the bot 19 | comments on a pull request. 20 | 21 | 1. Add the GitHub bot account to your project as a collaborator. 22 | `https://github.com///settings/collaboration`. 23 | Be sure to accept the invite email! This will enable the bot 24 | to set PR statuses. 25 | 26 | 1. [Create a personal access token for the 27 | GitHub bot account](https://github.com/settings/tokens). 28 | The access token must at least have the `public_repo` scope 29 | enabled. 30 | 31 | 1. In the Travis settings for your repository, 32 | set the personal access token as an environment 33 | variable called `GITHUB_TOKEN`. 34 | 35 | ![Imgur](http://i.imgur.com/QzwmvxD.png) 36 | 37 | 1. Add `pr-bot` as a dependency to your 38 | project: 39 | 40 | ```shell 41 | npm install --save-dev pr-bot 42 | ``` 43 | 44 | 1. Create a file called `pr-bot.config.js` at the 45 | root of your project (i.e. this file needs to be commited 46 | to your GitHub repository). 47 | 48 | 1. In this new file add the following: 49 | 50 | ```javascript 51 | const prbot = require('pr-bot'); 52 | 53 | module.exports = { 54 | botUsername: ``, 55 | repoDetails: { 56 | owner: "", 57 | repo: "" 58 | }, 59 | plugins: [ 60 | new prbot.plugins.Size({ 61 | globPattern: '**/*.js', 62 | globOptions: { 63 | ignore: [ 64 | '**/node_modules/**/*', 65 | ] 66 | }, 67 | }), 68 | ], 69 | }; 70 | ``` 71 | 72 | 1. Add the following to your `.travis.yml` file 73 | 74 | ```yaml 75 | after_script: 76 | - npm install -g pr-bot 77 | - pr-bot 78 | ``` 79 | 80 | Now you can commit your code and if everything is set up correctly, you'll 81 | see comments from your bot account. 82 | 83 | ![Example output from Size Plugin from pr-bot](http://i.imgur.com/oZPrdXr.png) 84 | 85 | ### Running Locally 86 | 87 | You can see what `pr-bot` will do locally with the following: 88 | 89 | ```shell 90 | npm install --global pr-bot 91 | pr-bot 92 | ``` 93 | 94 | This is useful if you want to see the file differences without 95 | waiting on Travis. 96 | 97 | ![Example console output from Size Plugin from pr-bot](http://i.imgur.com/h518U9O.png) 98 | 99 | ### Customising Config Path 100 | 101 | You can use the `-c` flag to define a custom config path: 102 | 103 | ```shell 104 | pr-bot -c ./some-path-my-config.js 105 | ``` 106 | 107 | ### Customising Install and Build 108 | 109 | If `npm install && npm build` will not suffice for your project, 110 | you define a `buildCommand` parameter in your config file 111 | to define the command to run in the two checkouts of your project. 112 | 113 | ```javascript 114 | module.exports = { 115 | // Custom build command in travis.config.js 116 | buildCommand: `npm install && gulp`, 117 | 118 | 119 | botUsername: `....`, 120 | plugins: [...] 121 | } 122 | ``` 123 | 124 | ## How it Works 125 | 126 | When you run `pr-bot` it checks out two versions of your project. 127 | 128 | 1. **If run locally**, it'll checkout the default branch of your repo AND 129 | use the current directory and the current files for the second 130 | version. 131 | 1. **If run on Travis**, it'll checkout the base of the Pull Request, 132 | or the target branch, for the first version and it'll checkout the Pull 133 | Request commit as the second version. 134 | 135 | These are checked out into tempory files under `/tmp` and `pr-bot` 136 | will `npm install && npm run build` in each repository. 137 | 138 | After this, each plugin defined in your config file will be called 139 | with a `beforePath` and `afterPath`. This allows plugins to compare 140 | files or anything else they want. 141 | 142 | Plugins are expected to return a `promise` that resolves to an `object` 143 | with a `prettyLog` parameter and a `markdownLog` parameter. The 144 | `prettyLog` is used to display plugin output to the console and 145 | `markdownLog` is used to print to the GitHub comment raised against 146 | the Pull Request. 147 | 148 | ## Adding Custom Plugins 149 | 150 | You can build custom plugins, the key things to note are: 151 | 152 | Your plugin must: 153 | 154 | 1. ..have a `name` property. 155 | 1. ..have a `run` method with a signature of 156 | `run({beforePath, afterPath} = {})`. 157 | 1. ..return a Promise from the `run` method. 158 | 159 | And your plugin should: 160 | 161 | 1. ..resolve the `run` promise with an `object`with `prettyLog` 162 | and `markdownLog` string parameters to print out info and if you wish 163 | to mark the Pull Request as a bad PR (set status to failure), you can return 164 | the parameter `failPR` with `true`. 165 | 166 | A basic plugin can look like this: 167 | 168 | ```javascript 169 | { 170 | name: 'Example Plugin', 171 | run: () => { 172 | return Promise.resolve({ 173 | failPR: false, 174 | prettyLog: 'Hello from example plugin.', 175 | markdownLog: '## Hello from example plugin.' 176 | }); 177 | }, 178 | } 179 | ``` 180 | 181 | If you want, your custom plugin can also extend the `PluginInterface` from the 182 | module with `const PluginInterface = require('pr-bot').PluginInterface;`. 183 | 184 | ## Different Base Branch 185 | 186 | When developing on a new version, the default branch on GitHub may not be 187 | the branch you want to compare PR's (or locally). 188 | 189 | You can compare to other branches using the `overrideBaseBranch` config. 190 | 191 | ```javascript 192 | module.exports = { 193 | overrideBaseBranch: ' { 47 | logHelper.error(err); 48 | process.exit(1); 49 | }); 50 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pr-bot", 3 | "version": "0.2.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "abbrev": { 8 | "version": "1.0.9", 9 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", 10 | "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", 11 | "dev": true 12 | }, 13 | "acorn": { 14 | "version": "1.2.2", 15 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz", 16 | "integrity": "sha1-yM4n3grMdtiW0rH6099YjZ6C8BQ=", 17 | "dev": true 18 | }, 19 | "agent-base": { 20 | "version": "2.1.1", 21 | "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", 22 | "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", 23 | "requires": { 24 | "extend": "3.0.1", 25 | "semver": "5.0.3" 26 | } 27 | }, 28 | "align-text": { 29 | "version": "0.1.4", 30 | "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", 31 | "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", 32 | "dev": true, 33 | "requires": { 34 | "kind-of": "3.2.2", 35 | "longest": "1.0.1", 36 | "repeat-string": "1.6.1" 37 | } 38 | }, 39 | "amdefine": { 40 | "version": "1.0.1", 41 | "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", 42 | "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", 43 | "dev": true 44 | }, 45 | "ansi-regex": { 46 | "version": "2.1.1", 47 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 48 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", 49 | "dev": true 50 | }, 51 | "ansi-styles": { 52 | "version": "3.2.0", 53 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", 54 | "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", 55 | "requires": { 56 | "color-convert": "1.9.0" 57 | } 58 | }, 59 | "argparse": { 60 | "version": "1.0.9", 61 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", 62 | "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", 63 | "dev": true, 64 | "requires": { 65 | "sprintf-js": "1.0.3" 66 | } 67 | }, 68 | "array-find-index": { 69 | "version": "1.0.2", 70 | "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", 71 | "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" 72 | }, 73 | "asn1": { 74 | "version": "0.2.3", 75 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", 76 | "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", 77 | "dev": true 78 | }, 79 | "assert-plus": { 80 | "version": "0.2.0", 81 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", 82 | "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", 83 | "dev": true 84 | }, 85 | "assertion-error": { 86 | "version": "1.0.2", 87 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", 88 | "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", 89 | "dev": true 90 | }, 91 | "async": { 92 | "version": "1.5.2", 93 | "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", 94 | "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", 95 | "dev": true 96 | }, 97 | "asynckit": { 98 | "version": "0.4.0", 99 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 100 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", 101 | "dev": true 102 | }, 103 | "aws-sign2": { 104 | "version": "0.6.0", 105 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", 106 | "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", 107 | "dev": true 108 | }, 109 | "aws4": { 110 | "version": "1.6.0", 111 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", 112 | "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", 113 | "dev": true 114 | }, 115 | "balanced-match": { 116 | "version": "1.0.0", 117 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 118 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 119 | }, 120 | "bcrypt-pbkdf": { 121 | "version": "1.0.1", 122 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", 123 | "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", 124 | "dev": true, 125 | "optional": true, 126 | "requires": { 127 | "tweetnacl": "0.14.5" 128 | } 129 | }, 130 | "blanket": { 131 | "version": "1.2.3", 132 | "resolved": "https://registry.npmjs.org/blanket/-/blanket-1.2.3.tgz", 133 | "integrity": "sha1-FRtJh8O9hFUrtfA7kO9fflkx5HM=", 134 | "dev": true, 135 | "requires": { 136 | "acorn": "1.2.2", 137 | "falafel": "1.2.0", 138 | "foreach": "2.0.5", 139 | "isarray": "0.0.1", 140 | "object-keys": "1.0.11", 141 | "xtend": "4.0.1" 142 | } 143 | }, 144 | "boom": { 145 | "version": "2.10.1", 146 | "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", 147 | "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", 148 | "dev": true, 149 | "requires": { 150 | "hoek": "2.16.3" 151 | } 152 | }, 153 | "brace-expansion": { 154 | "version": "1.1.8", 155 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", 156 | "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", 157 | "requires": { 158 | "balanced-match": "1.0.0", 159 | "concat-map": "0.0.1" 160 | } 161 | }, 162 | "browser-stdout": { 163 | "version": "1.3.0", 164 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", 165 | "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", 166 | "dev": true 167 | }, 168 | "builtin-modules": { 169 | "version": "1.1.1", 170 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", 171 | "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" 172 | }, 173 | "camelcase": { 174 | "version": "2.1.1", 175 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", 176 | "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" 177 | }, 178 | "camelcase-keys": { 179 | "version": "2.1.0", 180 | "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", 181 | "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", 182 | "requires": { 183 | "camelcase": "2.1.1", 184 | "map-obj": "1.0.1" 185 | } 186 | }, 187 | "caseless": { 188 | "version": "0.11.0", 189 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", 190 | "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", 191 | "dev": true 192 | }, 193 | "center-align": { 194 | "version": "0.1.3", 195 | "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", 196 | "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", 197 | "dev": true, 198 | "optional": true, 199 | "requires": { 200 | "align-text": "0.1.4", 201 | "lazy-cache": "1.0.4" 202 | } 203 | }, 204 | "chai": { 205 | "version": "4.1.0", 206 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", 207 | "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", 208 | "dev": true, 209 | "requires": { 210 | "assertion-error": "1.0.2", 211 | "check-error": "1.0.2", 212 | "deep-eql": "2.0.2", 213 | "get-func-name": "2.0.0", 214 | "pathval": "1.1.0", 215 | "type-detect": "4.0.3" 216 | } 217 | }, 218 | "chalk": { 219 | "version": "2.0.1", 220 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.0.1.tgz", 221 | "integrity": "sha512-Mp+FXEI+FrwY/XYV45b2YD3E8i3HwnEAoFcM0qlZzq/RZ9RwWitt2Y/c7cqRAz70U7hfekqx6qNYthuKFO6K0g==", 222 | "requires": { 223 | "ansi-styles": "3.2.0", 224 | "escape-string-regexp": "1.0.5", 225 | "supports-color": "4.2.1" 226 | } 227 | }, 228 | "check-error": { 229 | "version": "1.0.2", 230 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 231 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 232 | "dev": true 233 | }, 234 | "cliui": { 235 | "version": "2.1.0", 236 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", 237 | "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", 238 | "dev": true, 239 | "optional": true, 240 | "requires": { 241 | "center-align": "0.1.3", 242 | "right-align": "0.1.3", 243 | "wordwrap": "0.0.2" 244 | }, 245 | "dependencies": { 246 | "wordwrap": { 247 | "version": "0.0.2", 248 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", 249 | "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", 250 | "dev": true, 251 | "optional": true 252 | } 253 | } 254 | }, 255 | "color-convert": { 256 | "version": "1.9.0", 257 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", 258 | "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", 259 | "requires": { 260 | "color-name": "1.1.3" 261 | } 262 | }, 263 | "color-name": { 264 | "version": "1.1.3", 265 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 266 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" 267 | }, 268 | "combined-stream": { 269 | "version": "1.0.5", 270 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", 271 | "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", 272 | "dev": true, 273 | "requires": { 274 | "delayed-stream": "1.0.0" 275 | } 276 | }, 277 | "commander": { 278 | "version": "2.11.0", 279 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", 280 | "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", 281 | "dev": true 282 | }, 283 | "concat-map": { 284 | "version": "0.0.1", 285 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 286 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 287 | }, 288 | "core-util-is": { 289 | "version": "1.0.2", 290 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 291 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 292 | "dev": true 293 | }, 294 | "coveralls": { 295 | "version": "2.13.1", 296 | "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.1.tgz", 297 | "integrity": "sha1-1wu5rMGDXsTwY/+drFQjwXsR8Xg=", 298 | "dev": true, 299 | "requires": { 300 | "js-yaml": "3.6.1", 301 | "lcov-parse": "0.0.10", 302 | "log-driver": "1.2.5", 303 | "minimist": "1.2.0", 304 | "request": "2.79.0" 305 | } 306 | }, 307 | "cryptiles": { 308 | "version": "2.0.5", 309 | "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", 310 | "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", 311 | "dev": true, 312 | "requires": { 313 | "boom": "2.10.1" 314 | } 315 | }, 316 | "currently-unhandled": { 317 | "version": "0.4.1", 318 | "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", 319 | "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", 320 | "requires": { 321 | "array-find-index": "1.0.2" 322 | } 323 | }, 324 | "dashdash": { 325 | "version": "1.14.1", 326 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 327 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 328 | "dev": true, 329 | "requires": { 330 | "assert-plus": "1.0.0" 331 | }, 332 | "dependencies": { 333 | "assert-plus": { 334 | "version": "1.0.0", 335 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 336 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", 337 | "dev": true 338 | } 339 | } 340 | }, 341 | "debug": { 342 | "version": "2.6.8", 343 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", 344 | "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", 345 | "requires": { 346 | "ms": "2.0.0" 347 | } 348 | }, 349 | "decamelize": { 350 | "version": "1.2.0", 351 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 352 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" 353 | }, 354 | "deep-eql": { 355 | "version": "2.0.2", 356 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", 357 | "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", 358 | "dev": true, 359 | "requires": { 360 | "type-detect": "3.0.0" 361 | }, 362 | "dependencies": { 363 | "type-detect": { 364 | "version": "3.0.0", 365 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", 366 | "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", 367 | "dev": true 368 | } 369 | } 370 | }, 371 | "deep-is": { 372 | "version": "0.1.3", 373 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 374 | "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", 375 | "dev": true 376 | }, 377 | "delayed-stream": { 378 | "version": "1.0.0", 379 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 380 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", 381 | "dev": true 382 | }, 383 | "diff": { 384 | "version": "3.3.0", 385 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz", 386 | "integrity": "sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==", 387 | "dev": true 388 | }, 389 | "duplexer": { 390 | "version": "0.1.1", 391 | "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", 392 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" 393 | }, 394 | "ecc-jsbn": { 395 | "version": "0.1.1", 396 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", 397 | "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", 398 | "dev": true, 399 | "optional": true, 400 | "requires": { 401 | "jsbn": "0.1.1" 402 | } 403 | }, 404 | "error-ex": { 405 | "version": "1.3.1", 406 | "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", 407 | "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", 408 | "requires": { 409 | "is-arrayish": "0.2.1" 410 | } 411 | }, 412 | "escape-string-regexp": { 413 | "version": "1.0.5", 414 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 415 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" 416 | }, 417 | "escodegen": { 418 | "version": "1.8.1", 419 | "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", 420 | "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", 421 | "dev": true, 422 | "requires": { 423 | "esprima": "2.7.3", 424 | "estraverse": "1.9.3", 425 | "esutils": "2.0.2", 426 | "optionator": "0.8.2", 427 | "source-map": "0.2.0" 428 | } 429 | }, 430 | "esprima": { 431 | "version": "2.7.3", 432 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", 433 | "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", 434 | "dev": true 435 | }, 436 | "estraverse": { 437 | "version": "1.9.3", 438 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", 439 | "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", 440 | "dev": true 441 | }, 442 | "esutils": { 443 | "version": "2.0.2", 444 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", 445 | "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", 446 | "dev": true 447 | }, 448 | "extend": { 449 | "version": "3.0.1", 450 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", 451 | "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" 452 | }, 453 | "extsprintf": { 454 | "version": "1.3.0", 455 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 456 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", 457 | "dev": true 458 | }, 459 | "falafel": { 460 | "version": "1.2.0", 461 | "resolved": "https://registry.npmjs.org/falafel/-/falafel-1.2.0.tgz", 462 | "integrity": "sha1-wY0k71CRF0pJfzGM0ksCaiXN2rQ=", 463 | "dev": true, 464 | "requires": { 465 | "acorn": "1.2.2", 466 | "foreach": "2.0.5", 467 | "isarray": "0.0.1", 468 | "object-keys": "1.0.11" 469 | } 470 | }, 471 | "fast-levenshtein": { 472 | "version": "2.0.6", 473 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 474 | "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", 475 | "dev": true 476 | }, 477 | "fill-keys": { 478 | "version": "1.0.2", 479 | "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", 480 | "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", 481 | "dev": true, 482 | "requires": { 483 | "is-object": "1.0.1", 484 | "merge-descriptors": "1.0.1" 485 | } 486 | }, 487 | "find-up": { 488 | "version": "1.1.2", 489 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", 490 | "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", 491 | "requires": { 492 | "path-exists": "2.1.0", 493 | "pinkie-promise": "2.0.1" 494 | } 495 | }, 496 | "follow-redirects": { 497 | "version": "0.0.7", 498 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.7.tgz", 499 | "integrity": "sha1-NLkLqyqRGqNHVx2pDyK9NuzYqRk=", 500 | "requires": { 501 | "debug": "2.6.8", 502 | "stream-consume": "0.1.0" 503 | } 504 | }, 505 | "foreach": { 506 | "version": "2.0.5", 507 | "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", 508 | "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", 509 | "dev": true 510 | }, 511 | "forever-agent": { 512 | "version": "0.6.1", 513 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 514 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", 515 | "dev": true 516 | }, 517 | "form-data": { 518 | "version": "2.1.4", 519 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", 520 | "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", 521 | "dev": true, 522 | "requires": { 523 | "asynckit": "0.4.0", 524 | "combined-stream": "1.0.5", 525 | "mime-types": "2.1.16" 526 | } 527 | }, 528 | "formatio": { 529 | "version": "1.2.0", 530 | "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", 531 | "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", 532 | "dev": true, 533 | "requires": { 534 | "samsam": "1.2.1" 535 | } 536 | }, 537 | "fs-extra": { 538 | "version": "4.0.1", 539 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.1.tgz", 540 | "integrity": "sha1-f8DGyJV/mD9X8waiTlud3Y0N2IA=", 541 | "requires": { 542 | "graceful-fs": "4.1.11", 543 | "jsonfile": "3.0.1", 544 | "universalify": "0.1.1" 545 | } 546 | }, 547 | "fs.realpath": { 548 | "version": "1.0.0", 549 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 550 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 551 | }, 552 | "generate-function": { 553 | "version": "2.0.0", 554 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", 555 | "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", 556 | "dev": true 557 | }, 558 | "generate-object-property": { 559 | "version": "1.2.0", 560 | "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", 561 | "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", 562 | "dev": true, 563 | "requires": { 564 | "is-property": "1.0.2" 565 | } 566 | }, 567 | "get-func-name": { 568 | "version": "2.0.0", 569 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", 570 | "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", 571 | "dev": true 572 | }, 573 | "get-stdin": { 574 | "version": "4.0.1", 575 | "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", 576 | "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" 577 | }, 578 | "getpass": { 579 | "version": "0.1.7", 580 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 581 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 582 | "dev": true, 583 | "requires": { 584 | "assert-plus": "1.0.0" 585 | }, 586 | "dependencies": { 587 | "assert-plus": { 588 | "version": "1.0.0", 589 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 590 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", 591 | "dev": true 592 | } 593 | } 594 | }, 595 | "github": { 596 | "version": "9.2.0", 597 | "resolved": "https://registry.npmjs.org/github/-/github-9.2.0.tgz", 598 | "integrity": "sha1-iohtxA3WNjZwfcr5nfPfJsWfFvw=", 599 | "requires": { 600 | "follow-redirects": "0.0.7", 601 | "https-proxy-agent": "1.0.0", 602 | "mime": "1.3.6", 603 | "netrc": "0.1.4" 604 | } 605 | }, 606 | "glob": { 607 | "version": "7.1.2", 608 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 609 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 610 | "requires": { 611 | "fs.realpath": "1.0.0", 612 | "inflight": "1.0.6", 613 | "inherits": "2.0.3", 614 | "minimatch": "3.0.4", 615 | "once": "1.4.0", 616 | "path-is-absolute": "1.0.1" 617 | } 618 | }, 619 | "graceful-fs": { 620 | "version": "4.1.11", 621 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", 622 | "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" 623 | }, 624 | "graceful-readlink": { 625 | "version": "1.0.1", 626 | "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", 627 | "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", 628 | "dev": true 629 | }, 630 | "growl": { 631 | "version": "1.9.2", 632 | "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", 633 | "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", 634 | "dev": true 635 | }, 636 | "gzip-size": { 637 | "version": "3.0.0", 638 | "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz", 639 | "integrity": "sha1-VGGI6b3DN/Zzdy+BZgRks4nc5SA=", 640 | "requires": { 641 | "duplexer": "0.1.1" 642 | } 643 | }, 644 | "handlebars": { 645 | "version": "4.0.10", 646 | "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", 647 | "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", 648 | "dev": true, 649 | "requires": { 650 | "async": "1.5.2", 651 | "optimist": "0.6.1", 652 | "source-map": "0.4.4", 653 | "uglify-js": "2.8.29" 654 | }, 655 | "dependencies": { 656 | "source-map": { 657 | "version": "0.4.4", 658 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", 659 | "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", 660 | "dev": true, 661 | "requires": { 662 | "amdefine": "1.0.1" 663 | } 664 | } 665 | } 666 | }, 667 | "har-validator": { 668 | "version": "2.0.6", 669 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", 670 | "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", 671 | "dev": true, 672 | "requires": { 673 | "chalk": "1.1.3", 674 | "commander": "2.11.0", 675 | "is-my-json-valid": "2.16.0", 676 | "pinkie-promise": "2.0.1" 677 | }, 678 | "dependencies": { 679 | "ansi-styles": { 680 | "version": "2.2.1", 681 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", 682 | "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", 683 | "dev": true 684 | }, 685 | "chalk": { 686 | "version": "1.1.3", 687 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", 688 | "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", 689 | "dev": true, 690 | "requires": { 691 | "ansi-styles": "2.2.1", 692 | "escape-string-regexp": "1.0.5", 693 | "has-ansi": "2.0.0", 694 | "strip-ansi": "3.0.1", 695 | "supports-color": "2.0.0" 696 | } 697 | }, 698 | "supports-color": { 699 | "version": "2.0.0", 700 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", 701 | "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", 702 | "dev": true 703 | } 704 | } 705 | }, 706 | "has-ansi": { 707 | "version": "2.0.0", 708 | "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", 709 | "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", 710 | "dev": true, 711 | "requires": { 712 | "ansi-regex": "2.1.1" 713 | } 714 | }, 715 | "has-flag": { 716 | "version": "2.0.0", 717 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", 718 | "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" 719 | }, 720 | "hawk": { 721 | "version": "3.1.3", 722 | "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", 723 | "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", 724 | "dev": true, 725 | "requires": { 726 | "boom": "2.10.1", 727 | "cryptiles": "2.0.5", 728 | "hoek": "2.16.3", 729 | "sntp": "1.0.9" 730 | } 731 | }, 732 | "hoek": { 733 | "version": "2.16.3", 734 | "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", 735 | "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", 736 | "dev": true 737 | }, 738 | "hosted-git-info": { 739 | "version": "2.5.0", 740 | "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", 741 | "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==" 742 | }, 743 | "http-signature": { 744 | "version": "1.1.1", 745 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", 746 | "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", 747 | "dev": true, 748 | "requires": { 749 | "assert-plus": "0.2.0", 750 | "jsprim": "1.4.1", 751 | "sshpk": "1.13.1" 752 | } 753 | }, 754 | "https-proxy-agent": { 755 | "version": "1.0.0", 756 | "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", 757 | "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", 758 | "requires": { 759 | "agent-base": "2.1.1", 760 | "debug": "2.6.8", 761 | "extend": "3.0.1" 762 | } 763 | }, 764 | "indent-string": { 765 | "version": "2.1.0", 766 | "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", 767 | "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", 768 | "requires": { 769 | "repeating": "2.0.1" 770 | } 771 | }, 772 | "inflight": { 773 | "version": "1.0.6", 774 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 775 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 776 | "requires": { 777 | "once": "1.4.0", 778 | "wrappy": "1.0.2" 779 | } 780 | }, 781 | "inherits": { 782 | "version": "2.0.3", 783 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 784 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 785 | }, 786 | "is-arrayish": { 787 | "version": "0.2.1", 788 | "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", 789 | "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" 790 | }, 791 | "is-buffer": { 792 | "version": "1.1.5", 793 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", 794 | "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", 795 | "dev": true 796 | }, 797 | "is-builtin-module": { 798 | "version": "1.0.0", 799 | "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", 800 | "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", 801 | "requires": { 802 | "builtin-modules": "1.1.1" 803 | } 804 | }, 805 | "is-finite": { 806 | "version": "1.0.2", 807 | "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", 808 | "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", 809 | "requires": { 810 | "number-is-nan": "1.0.1" 811 | } 812 | }, 813 | "is-my-json-valid": { 814 | "version": "2.16.0", 815 | "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", 816 | "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=", 817 | "dev": true, 818 | "requires": { 819 | "generate-function": "2.0.0", 820 | "generate-object-property": "1.2.0", 821 | "jsonpointer": "4.0.1", 822 | "xtend": "4.0.1" 823 | } 824 | }, 825 | "is-object": { 826 | "version": "1.0.1", 827 | "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", 828 | "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", 829 | "dev": true 830 | }, 831 | "is-property": { 832 | "version": "1.0.2", 833 | "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", 834 | "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", 835 | "dev": true 836 | }, 837 | "is-typedarray": { 838 | "version": "1.0.0", 839 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 840 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", 841 | "dev": true 842 | }, 843 | "is-utf8": { 844 | "version": "0.2.1", 845 | "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", 846 | "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" 847 | }, 848 | "isarray": { 849 | "version": "0.0.1", 850 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", 851 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", 852 | "dev": true 853 | }, 854 | "isexe": { 855 | "version": "2.0.0", 856 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 857 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 858 | "dev": true 859 | }, 860 | "isstream": { 861 | "version": "0.1.2", 862 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 863 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", 864 | "dev": true 865 | }, 866 | "istanbul": { 867 | "version": "0.4.5", 868 | "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", 869 | "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", 870 | "dev": true, 871 | "requires": { 872 | "abbrev": "1.0.9", 873 | "async": "1.5.2", 874 | "escodegen": "1.8.1", 875 | "esprima": "2.7.3", 876 | "glob": "5.0.15", 877 | "handlebars": "4.0.10", 878 | "js-yaml": "3.6.1", 879 | "mkdirp": "0.5.1", 880 | "nopt": "3.0.6", 881 | "once": "1.4.0", 882 | "resolve": "1.1.7", 883 | "supports-color": "3.2.3", 884 | "which": "1.3.0", 885 | "wordwrap": "1.0.0" 886 | }, 887 | "dependencies": { 888 | "glob": { 889 | "version": "5.0.15", 890 | "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", 891 | "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", 892 | "dev": true, 893 | "requires": { 894 | "inflight": "1.0.6", 895 | "inherits": "2.0.3", 896 | "minimatch": "3.0.4", 897 | "once": "1.4.0", 898 | "path-is-absolute": "1.0.1" 899 | } 900 | }, 901 | "has-flag": { 902 | "version": "1.0.0", 903 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", 904 | "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", 905 | "dev": true 906 | }, 907 | "supports-color": { 908 | "version": "3.2.3", 909 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", 910 | "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", 911 | "dev": true, 912 | "requires": { 913 | "has-flag": "1.0.0" 914 | } 915 | } 916 | } 917 | }, 918 | "js-yaml": { 919 | "version": "3.6.1", 920 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", 921 | "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", 922 | "dev": true, 923 | "requires": { 924 | "argparse": "1.0.9", 925 | "esprima": "2.7.3" 926 | } 927 | }, 928 | "jsbn": { 929 | "version": "0.1.1", 930 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 931 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", 932 | "dev": true, 933 | "optional": true 934 | }, 935 | "json-schema": { 936 | "version": "0.2.3", 937 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 938 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", 939 | "dev": true 940 | }, 941 | "json-stringify-safe": { 942 | "version": "5.0.1", 943 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 944 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", 945 | "dev": true 946 | }, 947 | "json3": { 948 | "version": "3.3.2", 949 | "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", 950 | "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", 951 | "dev": true 952 | }, 953 | "jsonfile": { 954 | "version": "3.0.1", 955 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", 956 | "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", 957 | "requires": { 958 | "graceful-fs": "4.1.11" 959 | } 960 | }, 961 | "jsonpointer": { 962 | "version": "4.0.1", 963 | "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", 964 | "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", 965 | "dev": true 966 | }, 967 | "jsprim": { 968 | "version": "1.4.1", 969 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 970 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 971 | "dev": true, 972 | "requires": { 973 | "assert-plus": "1.0.0", 974 | "extsprintf": "1.3.0", 975 | "json-schema": "0.2.3", 976 | "verror": "1.10.0" 977 | }, 978 | "dependencies": { 979 | "assert-plus": { 980 | "version": "1.0.0", 981 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 982 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", 983 | "dev": true 984 | } 985 | } 986 | }, 987 | "just-extend": { 988 | "version": "1.1.22", 989 | "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.22.tgz", 990 | "integrity": "sha1-MzCvdWyralQnAMZLLk5KoGLVL/8=", 991 | "dev": true 992 | }, 993 | "kind-of": { 994 | "version": "3.2.2", 995 | "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", 996 | "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", 997 | "dev": true, 998 | "requires": { 999 | "is-buffer": "1.1.5" 1000 | } 1001 | }, 1002 | "lazy-cache": { 1003 | "version": "1.0.4", 1004 | "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", 1005 | "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", 1006 | "dev": true, 1007 | "optional": true 1008 | }, 1009 | "lcov-parse": { 1010 | "version": "0.0.10", 1011 | "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", 1012 | "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", 1013 | "dev": true 1014 | }, 1015 | "levn": { 1016 | "version": "0.3.0", 1017 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 1018 | "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", 1019 | "dev": true, 1020 | "requires": { 1021 | "prelude-ls": "1.1.2", 1022 | "type-check": "0.3.2" 1023 | } 1024 | }, 1025 | "load-json-file": { 1026 | "version": "1.1.0", 1027 | "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", 1028 | "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", 1029 | "requires": { 1030 | "graceful-fs": "4.1.11", 1031 | "parse-json": "2.2.0", 1032 | "pify": "2.3.0", 1033 | "pinkie-promise": "2.0.1", 1034 | "strip-bom": "2.0.0" 1035 | } 1036 | }, 1037 | "lodash._baseassign": { 1038 | "version": "3.2.0", 1039 | "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", 1040 | "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", 1041 | "dev": true, 1042 | "requires": { 1043 | "lodash._basecopy": "3.0.1", 1044 | "lodash.keys": "3.1.2" 1045 | } 1046 | }, 1047 | "lodash._basecopy": { 1048 | "version": "3.0.1", 1049 | "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", 1050 | "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", 1051 | "dev": true 1052 | }, 1053 | "lodash._basecreate": { 1054 | "version": "3.0.3", 1055 | "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", 1056 | "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", 1057 | "dev": true 1058 | }, 1059 | "lodash._getnative": { 1060 | "version": "3.9.1", 1061 | "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", 1062 | "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", 1063 | "dev": true 1064 | }, 1065 | "lodash._isiterateecall": { 1066 | "version": "3.0.9", 1067 | "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", 1068 | "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", 1069 | "dev": true 1070 | }, 1071 | "lodash.create": { 1072 | "version": "3.1.1", 1073 | "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", 1074 | "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", 1075 | "dev": true, 1076 | "requires": { 1077 | "lodash._baseassign": "3.2.0", 1078 | "lodash._basecreate": "3.0.3", 1079 | "lodash._isiterateecall": "3.0.9" 1080 | } 1081 | }, 1082 | "lodash.isarguments": { 1083 | "version": "3.1.0", 1084 | "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", 1085 | "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", 1086 | "dev": true 1087 | }, 1088 | "lodash.isarray": { 1089 | "version": "3.0.4", 1090 | "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", 1091 | "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", 1092 | "dev": true 1093 | }, 1094 | "lodash.keys": { 1095 | "version": "3.1.2", 1096 | "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", 1097 | "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", 1098 | "dev": true, 1099 | "requires": { 1100 | "lodash._getnative": "3.9.1", 1101 | "lodash.isarguments": "3.1.0", 1102 | "lodash.isarray": "3.0.4" 1103 | } 1104 | }, 1105 | "log-driver": { 1106 | "version": "1.2.5", 1107 | "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", 1108 | "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", 1109 | "dev": true 1110 | }, 1111 | "lolex": { 1112 | "version": "2.1.2", 1113 | "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.2.tgz", 1114 | "integrity": "sha1-JpS5U8nqTQE+W4v7qJHJkQJbJik=", 1115 | "dev": true 1116 | }, 1117 | "longest": { 1118 | "version": "1.0.1", 1119 | "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", 1120 | "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", 1121 | "dev": true 1122 | }, 1123 | "loud-rejection": { 1124 | "version": "1.6.0", 1125 | "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", 1126 | "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", 1127 | "requires": { 1128 | "currently-unhandled": "0.4.1", 1129 | "signal-exit": "3.0.2" 1130 | } 1131 | }, 1132 | "map-obj": { 1133 | "version": "1.0.1", 1134 | "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", 1135 | "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" 1136 | }, 1137 | "meow": { 1138 | "version": "3.7.0", 1139 | "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", 1140 | "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", 1141 | "requires": { 1142 | "camelcase-keys": "2.1.0", 1143 | "decamelize": "1.2.0", 1144 | "loud-rejection": "1.6.0", 1145 | "map-obj": "1.0.1", 1146 | "minimist": "1.2.0", 1147 | "normalize-package-data": "2.4.0", 1148 | "object-assign": "4.1.1", 1149 | "read-pkg-up": "1.0.1", 1150 | "redent": "1.0.0", 1151 | "trim-newlines": "1.0.0" 1152 | } 1153 | }, 1154 | "merge-descriptors": { 1155 | "version": "1.0.1", 1156 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 1157 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", 1158 | "dev": true 1159 | }, 1160 | "mime": { 1161 | "version": "1.3.6", 1162 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.6.tgz", 1163 | "integrity": "sha1-WR2E02U6awtKO5343lqoEI5y5eA=" 1164 | }, 1165 | "mime-db": { 1166 | "version": "1.29.0", 1167 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", 1168 | "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=", 1169 | "dev": true 1170 | }, 1171 | "mime-types": { 1172 | "version": "2.1.16", 1173 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz", 1174 | "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", 1175 | "dev": true, 1176 | "requires": { 1177 | "mime-db": "1.29.0" 1178 | } 1179 | }, 1180 | "minimatch": { 1181 | "version": "3.0.4", 1182 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 1183 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 1184 | "requires": { 1185 | "brace-expansion": "1.1.8" 1186 | } 1187 | }, 1188 | "minimist": { 1189 | "version": "1.2.0", 1190 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 1191 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" 1192 | }, 1193 | "mkdirp": { 1194 | "version": "0.5.1", 1195 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 1196 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 1197 | "dev": true, 1198 | "requires": { 1199 | "minimist": "0.0.8" 1200 | }, 1201 | "dependencies": { 1202 | "minimist": { 1203 | "version": "0.0.8", 1204 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 1205 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", 1206 | "dev": true 1207 | } 1208 | } 1209 | }, 1210 | "mocha": { 1211 | "version": "3.5.0", 1212 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", 1213 | "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", 1214 | "dev": true, 1215 | "requires": { 1216 | "browser-stdout": "1.3.0", 1217 | "commander": "2.9.0", 1218 | "debug": "2.6.8", 1219 | "diff": "3.2.0", 1220 | "escape-string-regexp": "1.0.5", 1221 | "glob": "7.1.1", 1222 | "growl": "1.9.2", 1223 | "json3": "3.3.2", 1224 | "lodash.create": "3.1.1", 1225 | "mkdirp": "0.5.1", 1226 | "supports-color": "3.1.2" 1227 | }, 1228 | "dependencies": { 1229 | "commander": { 1230 | "version": "2.9.0", 1231 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", 1232 | "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", 1233 | "dev": true, 1234 | "requires": { 1235 | "graceful-readlink": "1.0.1" 1236 | } 1237 | }, 1238 | "diff": { 1239 | "version": "3.2.0", 1240 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", 1241 | "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", 1242 | "dev": true 1243 | }, 1244 | "glob": { 1245 | "version": "7.1.1", 1246 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", 1247 | "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", 1248 | "dev": true, 1249 | "requires": { 1250 | "fs.realpath": "1.0.0", 1251 | "inflight": "1.0.6", 1252 | "inherits": "2.0.3", 1253 | "minimatch": "3.0.4", 1254 | "once": "1.4.0", 1255 | "path-is-absolute": "1.0.1" 1256 | } 1257 | }, 1258 | "has-flag": { 1259 | "version": "1.0.0", 1260 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", 1261 | "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", 1262 | "dev": true 1263 | }, 1264 | "supports-color": { 1265 | "version": "3.1.2", 1266 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", 1267 | "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", 1268 | "dev": true, 1269 | "requires": { 1270 | "has-flag": "1.0.0" 1271 | } 1272 | } 1273 | } 1274 | }, 1275 | "mocha-lcov-reporter": { 1276 | "version": "1.3.0", 1277 | "resolved": "https://registry.npmjs.org/mocha-lcov-reporter/-/mocha-lcov-reporter-1.3.0.tgz", 1278 | "integrity": "sha1-Rpve9PivyaEWBW8HnfYYLQr7A4Q=", 1279 | "dev": true 1280 | }, 1281 | "module-not-found-error": { 1282 | "version": "1.0.1", 1283 | "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", 1284 | "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", 1285 | "dev": true 1286 | }, 1287 | "ms": { 1288 | "version": "2.0.0", 1289 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1290 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 1291 | }, 1292 | "native-promise-only": { 1293 | "version": "0.8.1", 1294 | "resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", 1295 | "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", 1296 | "dev": true 1297 | }, 1298 | "netrc": { 1299 | "version": "0.1.4", 1300 | "resolved": "https://registry.npmjs.org/netrc/-/netrc-0.1.4.tgz", 1301 | "integrity": "sha1-a+lPysqNd63gqWcNxGCRTJRHJEQ=" 1302 | }, 1303 | "nise": { 1304 | "version": "1.0.1", 1305 | "resolved": "https://registry.npmjs.org/nise/-/nise-1.0.1.tgz", 1306 | "integrity": "sha1-DakrEKhU6XwPSW9sKEWjASgLPu8=", 1307 | "dev": true, 1308 | "requires": { 1309 | "formatio": "1.2.0", 1310 | "just-extend": "1.1.22", 1311 | "lolex": "1.6.0", 1312 | "path-to-regexp": "1.7.0" 1313 | }, 1314 | "dependencies": { 1315 | "lolex": { 1316 | "version": "1.6.0", 1317 | "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", 1318 | "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", 1319 | "dev": true 1320 | } 1321 | } 1322 | }, 1323 | "nopt": { 1324 | "version": "3.0.6", 1325 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", 1326 | "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", 1327 | "dev": true, 1328 | "requires": { 1329 | "abbrev": "1.0.9" 1330 | } 1331 | }, 1332 | "normalize-package-data": { 1333 | "version": "2.4.0", 1334 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", 1335 | "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", 1336 | "requires": { 1337 | "hosted-git-info": "2.5.0", 1338 | "is-builtin-module": "1.0.0", 1339 | "semver": "5.0.3", 1340 | "validate-npm-package-license": "3.0.1" 1341 | } 1342 | }, 1343 | "number-is-nan": { 1344 | "version": "1.0.1", 1345 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 1346 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" 1347 | }, 1348 | "oauth-sign": { 1349 | "version": "0.8.2", 1350 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", 1351 | "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", 1352 | "dev": true 1353 | }, 1354 | "object-assign": { 1355 | "version": "4.1.1", 1356 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 1357 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 1358 | }, 1359 | "object-keys": { 1360 | "version": "1.0.11", 1361 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", 1362 | "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", 1363 | "dev": true 1364 | }, 1365 | "once": { 1366 | "version": "1.4.0", 1367 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1368 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1369 | "requires": { 1370 | "wrappy": "1.0.2" 1371 | } 1372 | }, 1373 | "optimist": { 1374 | "version": "0.6.1", 1375 | "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", 1376 | "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", 1377 | "dev": true, 1378 | "requires": { 1379 | "minimist": "0.0.10", 1380 | "wordwrap": "0.0.3" 1381 | }, 1382 | "dependencies": { 1383 | "minimist": { 1384 | "version": "0.0.10", 1385 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", 1386 | "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", 1387 | "dev": true 1388 | }, 1389 | "wordwrap": { 1390 | "version": "0.0.3", 1391 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", 1392 | "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", 1393 | "dev": true 1394 | } 1395 | } 1396 | }, 1397 | "optionator": { 1398 | "version": "0.8.2", 1399 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", 1400 | "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", 1401 | "dev": true, 1402 | "requires": { 1403 | "deep-is": "0.1.3", 1404 | "fast-levenshtein": "2.0.6", 1405 | "levn": "0.3.0", 1406 | "prelude-ls": "1.1.2", 1407 | "type-check": "0.3.2", 1408 | "wordwrap": "1.0.0" 1409 | } 1410 | }, 1411 | "parse-json": { 1412 | "version": "2.2.0", 1413 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", 1414 | "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", 1415 | "requires": { 1416 | "error-ex": "1.3.1" 1417 | } 1418 | }, 1419 | "path-exists": { 1420 | "version": "2.1.0", 1421 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", 1422 | "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", 1423 | "requires": { 1424 | "pinkie-promise": "2.0.1" 1425 | } 1426 | }, 1427 | "path-is-absolute": { 1428 | "version": "1.0.1", 1429 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1430 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 1431 | }, 1432 | "path-to-regexp": { 1433 | "version": "1.7.0", 1434 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", 1435 | "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", 1436 | "dev": true, 1437 | "requires": { 1438 | "isarray": "0.0.1" 1439 | } 1440 | }, 1441 | "path-type": { 1442 | "version": "1.1.0", 1443 | "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", 1444 | "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", 1445 | "requires": { 1446 | "graceful-fs": "4.1.11", 1447 | "pify": "2.3.0", 1448 | "pinkie-promise": "2.0.1" 1449 | } 1450 | }, 1451 | "pathval": { 1452 | "version": "1.1.0", 1453 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", 1454 | "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", 1455 | "dev": true 1456 | }, 1457 | "pify": { 1458 | "version": "2.3.0", 1459 | "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 1460 | "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" 1461 | }, 1462 | "pinkie": { 1463 | "version": "2.0.4", 1464 | "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", 1465 | "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" 1466 | }, 1467 | "pinkie-promise": { 1468 | "version": "2.0.1", 1469 | "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", 1470 | "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", 1471 | "requires": { 1472 | "pinkie": "2.0.4" 1473 | } 1474 | }, 1475 | "prelude-ls": { 1476 | "version": "1.1.2", 1477 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 1478 | "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", 1479 | "dev": true 1480 | }, 1481 | "proxyquire": { 1482 | "version": "1.8.0", 1483 | "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.8.0.tgz", 1484 | "integrity": "sha1-AtUUpb7ZhvBMuyCTrxZ0FTX3ntw=", 1485 | "dev": true, 1486 | "requires": { 1487 | "fill-keys": "1.0.2", 1488 | "module-not-found-error": "1.0.1", 1489 | "resolve": "1.1.7" 1490 | } 1491 | }, 1492 | "punycode": { 1493 | "version": "1.4.1", 1494 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", 1495 | "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", 1496 | "dev": true 1497 | }, 1498 | "qs": { 1499 | "version": "6.3.2", 1500 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", 1501 | "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", 1502 | "dev": true 1503 | }, 1504 | "read-pkg": { 1505 | "version": "1.1.0", 1506 | "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", 1507 | "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", 1508 | "requires": { 1509 | "load-json-file": "1.1.0", 1510 | "normalize-package-data": "2.4.0", 1511 | "path-type": "1.1.0" 1512 | } 1513 | }, 1514 | "read-pkg-up": { 1515 | "version": "1.0.1", 1516 | "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", 1517 | "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", 1518 | "requires": { 1519 | "find-up": "1.1.2", 1520 | "read-pkg": "1.1.0" 1521 | } 1522 | }, 1523 | "redent": { 1524 | "version": "1.0.0", 1525 | "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", 1526 | "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", 1527 | "requires": { 1528 | "indent-string": "2.1.0", 1529 | "strip-indent": "1.0.1" 1530 | } 1531 | }, 1532 | "repeat-string": { 1533 | "version": "1.6.1", 1534 | "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", 1535 | "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", 1536 | "dev": true 1537 | }, 1538 | "repeating": { 1539 | "version": "2.0.1", 1540 | "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", 1541 | "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", 1542 | "requires": { 1543 | "is-finite": "1.0.2" 1544 | } 1545 | }, 1546 | "request": { 1547 | "version": "2.79.0", 1548 | "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", 1549 | "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", 1550 | "dev": true, 1551 | "requires": { 1552 | "aws-sign2": "0.6.0", 1553 | "aws4": "1.6.0", 1554 | "caseless": "0.11.0", 1555 | "combined-stream": "1.0.5", 1556 | "extend": "3.0.1", 1557 | "forever-agent": "0.6.1", 1558 | "form-data": "2.1.4", 1559 | "har-validator": "2.0.6", 1560 | "hawk": "3.1.3", 1561 | "http-signature": "1.1.1", 1562 | "is-typedarray": "1.0.0", 1563 | "isstream": "0.1.2", 1564 | "json-stringify-safe": "5.0.1", 1565 | "mime-types": "2.1.16", 1566 | "oauth-sign": "0.8.2", 1567 | "qs": "6.3.2", 1568 | "stringstream": "0.0.5", 1569 | "tough-cookie": "2.3.2", 1570 | "tunnel-agent": "0.4.3", 1571 | "uuid": "3.1.0" 1572 | } 1573 | }, 1574 | "resolve": { 1575 | "version": "1.1.7", 1576 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", 1577 | "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", 1578 | "dev": true 1579 | }, 1580 | "right-align": { 1581 | "version": "0.1.3", 1582 | "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", 1583 | "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", 1584 | "dev": true, 1585 | "optional": true, 1586 | "requires": { 1587 | "align-text": "0.1.4" 1588 | } 1589 | }, 1590 | "samsam": { 1591 | "version": "1.2.1", 1592 | "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.2.1.tgz", 1593 | "integrity": "sha1-7dOQk6MYQ3DLhZJDsr3yVefY6mc=", 1594 | "dev": true 1595 | }, 1596 | "semver": { 1597 | "version": "5.0.3", 1598 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", 1599 | "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=" 1600 | }, 1601 | "signal-exit": { 1602 | "version": "3.0.2", 1603 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", 1604 | "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" 1605 | }, 1606 | "sinon": { 1607 | "version": "3.0.0", 1608 | "resolved": "https://registry.npmjs.org/sinon/-/sinon-3.0.0.tgz", 1609 | "integrity": "sha512-oGoqOflgmoKm+lHkGsUw5IjxOu3Nat0WfoJpWFj8sklC1KDCGamkg/nDJGJAv9hXLY5KiflDoY/7ewgfsbNLTA==", 1610 | "dev": true, 1611 | "requires": { 1612 | "diff": "3.3.0", 1613 | "formatio": "1.2.0", 1614 | "lolex": "2.1.2", 1615 | "native-promise-only": "0.8.1", 1616 | "nise": "1.0.1", 1617 | "path-to-regexp": "1.7.0", 1618 | "samsam": "1.2.1", 1619 | "text-encoding": "0.6.4", 1620 | "type-detect": "4.0.3" 1621 | } 1622 | }, 1623 | "sntp": { 1624 | "version": "1.0.9", 1625 | "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", 1626 | "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", 1627 | "dev": true, 1628 | "requires": { 1629 | "hoek": "2.16.3" 1630 | } 1631 | }, 1632 | "source-map": { 1633 | "version": "0.2.0", 1634 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", 1635 | "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", 1636 | "dev": true, 1637 | "optional": true, 1638 | "requires": { 1639 | "amdefine": "1.0.1" 1640 | } 1641 | }, 1642 | "spdx-correct": { 1643 | "version": "1.0.2", 1644 | "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", 1645 | "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", 1646 | "requires": { 1647 | "spdx-license-ids": "1.2.2" 1648 | } 1649 | }, 1650 | "spdx-expression-parse": { 1651 | "version": "1.0.4", 1652 | "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", 1653 | "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=" 1654 | }, 1655 | "spdx-license-ids": { 1656 | "version": "1.2.2", 1657 | "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", 1658 | "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=" 1659 | }, 1660 | "sprintf-js": { 1661 | "version": "1.0.3", 1662 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 1663 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 1664 | "dev": true 1665 | }, 1666 | "sshpk": { 1667 | "version": "1.13.1", 1668 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", 1669 | "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", 1670 | "dev": true, 1671 | "requires": { 1672 | "asn1": "0.2.3", 1673 | "assert-plus": "1.0.0", 1674 | "bcrypt-pbkdf": "1.0.1", 1675 | "dashdash": "1.14.1", 1676 | "ecc-jsbn": "0.1.1", 1677 | "getpass": "0.1.7", 1678 | "jsbn": "0.1.1", 1679 | "tweetnacl": "0.14.5" 1680 | }, 1681 | "dependencies": { 1682 | "assert-plus": { 1683 | "version": "1.0.0", 1684 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 1685 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", 1686 | "dev": true 1687 | } 1688 | } 1689 | }, 1690 | "stream-consume": { 1691 | "version": "0.1.0", 1692 | "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", 1693 | "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=" 1694 | }, 1695 | "stringstream": { 1696 | "version": "0.0.5", 1697 | "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", 1698 | "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", 1699 | "dev": true 1700 | }, 1701 | "strip-ansi": { 1702 | "version": "3.0.1", 1703 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 1704 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 1705 | "dev": true, 1706 | "requires": { 1707 | "ansi-regex": "2.1.1" 1708 | } 1709 | }, 1710 | "strip-bom": { 1711 | "version": "2.0.0", 1712 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", 1713 | "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", 1714 | "requires": { 1715 | "is-utf8": "0.2.1" 1716 | } 1717 | }, 1718 | "strip-indent": { 1719 | "version": "1.0.1", 1720 | "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", 1721 | "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", 1722 | "requires": { 1723 | "get-stdin": "4.0.1" 1724 | } 1725 | }, 1726 | "supports-color": { 1727 | "version": "4.2.1", 1728 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", 1729 | "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", 1730 | "requires": { 1731 | "has-flag": "2.0.0" 1732 | } 1733 | }, 1734 | "text-encoding": { 1735 | "version": "0.6.4", 1736 | "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", 1737 | "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", 1738 | "dev": true 1739 | }, 1740 | "tough-cookie": { 1741 | "version": "2.3.2", 1742 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", 1743 | "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", 1744 | "dev": true, 1745 | "requires": { 1746 | "punycode": "1.4.1" 1747 | } 1748 | }, 1749 | "trim-newlines": { 1750 | "version": "1.0.0", 1751 | "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", 1752 | "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" 1753 | }, 1754 | "tunnel-agent": { 1755 | "version": "0.4.3", 1756 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", 1757 | "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", 1758 | "dev": true 1759 | }, 1760 | "tweetnacl": { 1761 | "version": "0.14.5", 1762 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 1763 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", 1764 | "dev": true, 1765 | "optional": true 1766 | }, 1767 | "type-check": { 1768 | "version": "0.3.2", 1769 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 1770 | "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", 1771 | "dev": true, 1772 | "requires": { 1773 | "prelude-ls": "1.1.2" 1774 | } 1775 | }, 1776 | "type-detect": { 1777 | "version": "4.0.3", 1778 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", 1779 | "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", 1780 | "dev": true 1781 | }, 1782 | "uglify-js": { 1783 | "version": "2.8.29", 1784 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", 1785 | "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", 1786 | "dev": true, 1787 | "optional": true, 1788 | "requires": { 1789 | "source-map": "0.5.6", 1790 | "uglify-to-browserify": "1.0.2", 1791 | "yargs": "3.10.0" 1792 | }, 1793 | "dependencies": { 1794 | "source-map": { 1795 | "version": "0.5.6", 1796 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", 1797 | "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", 1798 | "dev": true, 1799 | "optional": true 1800 | } 1801 | } 1802 | }, 1803 | "uglify-to-browserify": { 1804 | "version": "1.0.2", 1805 | "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", 1806 | "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", 1807 | "dev": true, 1808 | "optional": true 1809 | }, 1810 | "universalify": { 1811 | "version": "0.1.1", 1812 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", 1813 | "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" 1814 | }, 1815 | "uuid": { 1816 | "version": "3.1.0", 1817 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", 1818 | "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", 1819 | "dev": true 1820 | }, 1821 | "validate-npm-package-license": { 1822 | "version": "3.0.1", 1823 | "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", 1824 | "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", 1825 | "requires": { 1826 | "spdx-correct": "1.0.2", 1827 | "spdx-expression-parse": "1.0.4" 1828 | } 1829 | }, 1830 | "verror": { 1831 | "version": "1.10.0", 1832 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 1833 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 1834 | "dev": true, 1835 | "requires": { 1836 | "assert-plus": "1.0.0", 1837 | "core-util-is": "1.0.2", 1838 | "extsprintf": "1.3.0" 1839 | }, 1840 | "dependencies": { 1841 | "assert-plus": { 1842 | "version": "1.0.0", 1843 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 1844 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", 1845 | "dev": true 1846 | } 1847 | } 1848 | }, 1849 | "which": { 1850 | "version": "1.3.0", 1851 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", 1852 | "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", 1853 | "dev": true, 1854 | "requires": { 1855 | "isexe": "2.0.0" 1856 | } 1857 | }, 1858 | "window-size": { 1859 | "version": "0.1.0", 1860 | "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", 1861 | "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", 1862 | "dev": true, 1863 | "optional": true 1864 | }, 1865 | "wordwrap": { 1866 | "version": "1.0.0", 1867 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", 1868 | "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", 1869 | "dev": true 1870 | }, 1871 | "wrappy": { 1872 | "version": "1.0.2", 1873 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1874 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1875 | }, 1876 | "xtend": { 1877 | "version": "4.0.1", 1878 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", 1879 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", 1880 | "dev": true 1881 | }, 1882 | "yargs": { 1883 | "version": "3.10.0", 1884 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", 1885 | "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", 1886 | "dev": true, 1887 | "optional": true, 1888 | "requires": { 1889 | "camelcase": "1.2.1", 1890 | "cliui": "2.1.0", 1891 | "decamelize": "1.2.0", 1892 | "window-size": "0.1.0" 1893 | }, 1894 | "dependencies": { 1895 | "camelcase": { 1896 | "version": "1.2.1", 1897 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", 1898 | "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", 1899 | "dev": true, 1900 | "optional": true 1901 | } 1902 | } 1903 | } 1904 | } 1905 | } 1906 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pr-bot", 3 | "version": "0.2.0", 4 | "description": "A bot to run after Travis has run it's build's and tests.", 5 | "main": "src/npm-module.js", 6 | "bin": { 7 | "pr-bot": "bin/cli.js" 8 | }, 9 | "scripts": { 10 | "prepublish": "npm run test", 11 | "test": "_mocha './test/node/**/*.js'", 12 | "test-with-coverage": "istanbul cover _mocha './test/node/**/*.js' --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/gauntface/web-devrel-bot.git" 17 | }, 18 | "author": "Google Web DevRel", 19 | "license": "Apache-2.0", 20 | "bugs": { 21 | "url": "https://github.com/gauntface/web-devrel-bot/issues" 22 | }, 23 | "homepage": "https://github.com/gauntface/web-devrel-bot#readme", 24 | "dependencies": { 25 | "chalk": "^2.0.1", 26 | "fs-extra": "^4.0.1", 27 | "github": "^9.2.0", 28 | "glob": "^7.1.2", 29 | "gzip-size": "^3.0.0", 30 | "meow": "^3.7.0" 31 | }, 32 | "devDependencies": { 33 | "blanket": "^1.2.3", 34 | "chai": "^4.1.0", 35 | "coveralls": "^2.13.1", 36 | "istanbul": "^0.4.5", 37 | "mocha": "^3.5.0", 38 | "mocha-lcov-reporter": "^1.3.0", 39 | "proxyquire": "^1.8.0", 40 | "sinon": "^3.0.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/controllers/bot-runner.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const fs = require('fs-extra'); 17 | const path = require('path'); 18 | const execSync = require('child_process').execSync; 19 | const logHelper = require('../utils/log-helper'); 20 | const TravisEnvModel = require('../models/travis-env-model'); 21 | const GithubController = require('./github-controller'); 22 | 23 | const TMPDIR_PREFIX = `/tmp/pr-bot/`; 24 | 25 | class TravisBot { 26 | constructor({configPath} = {}) { 27 | logHelper.setPrimaryPrefix('PR-Bot 🤖'); 28 | 29 | if (!configPath) { 30 | configPath = path.resolve('pr-bot.config.js') 31 | } 32 | this._configPath = configPath; 33 | } 34 | 35 | run() { 36 | const travisEnv = new TravisEnvModel(); 37 | 38 | return this._readConfig() 39 | .then((configuration) => { 40 | let repoDetails = travisEnv.repoDetails; 41 | if (!repoDetails) { 42 | repoDetails = configuration.repoDetails; 43 | } 44 | if (!repoDetails) { 45 | throw new Error(`Unable to get the Github 'repoDetails' from Travis ` + 46 | `environment variable or the configuration file.`); 47 | } 48 | 49 | const githubController = new GithubController({ 50 | owner: repoDetails.owner, 51 | repo: repoDetails.repo, 52 | }); 53 | 54 | return this._buildBeforeAndAfter(configuration, travisEnv, githubController) 55 | .then(({beforePath, afterPath}) => { 56 | return this._runPlugins(configuration.plugins, {beforePath, afterPath}); 57 | }) 58 | .then((pluginResults) => { 59 | if (!travisEnv.isTravis || !travisEnv.isPullRequest) { 60 | this._logDebugInfo(pluginResults); 61 | return Promise.resolve(); 62 | } 63 | 64 | return this._logGithubState(configuration, travisEnv, githubController, pluginResults); 65 | }); 66 | }); 67 | } 68 | 69 | _readConfig() { 70 | return fs.access(this._configPath) 71 | .catch((err) => { 72 | throw new Error(`Unable to find the config file: '${this._configPath}'.`); 73 | }) 74 | .then(() => { 75 | try { 76 | return require(this._configPath); 77 | } catch (err) { 78 | throw new Error(`A problem occurred running the config file.`); 79 | } 80 | }) 81 | } 82 | 83 | _buildBeforeAndAfter(configuration, travisEnv, githubController) { 84 | fs.ensureDir(TMPDIR_PREFIX); 85 | 86 | return githubController.getRepoDetails() 87 | .then((repoDetails) => { 88 | const cloneUrl = repoDetails.data.clone_url; 89 | const beforePath = fs.mkdtempSync(TMPDIR_PREFIX); 90 | 91 | logHelper.log(`Cloning default branch into: '${beforePath}'.`); 92 | execSync(`git clone ${cloneUrl} ${beforePath}`); 93 | 94 | if (configuration.overrideBaseBranch) { 95 | execSync(`git checkout ${configuration.overrideBaseBranch}`, { 96 | cwd: beforePath 97 | }); 98 | } 99 | 100 | if (!travisEnv.pullRequestSha) { 101 | logHelper.warn(`No 'TRAVIS_PULL_REQUEST_SHA' environment variable, ` + 102 | `so using the current directory for further testing.`); 103 | return { 104 | beforePath, 105 | afterPath: '.', 106 | }; 107 | } 108 | 109 | const afterPath = fs.mkdtempSync(TMPDIR_PREFIX); 110 | 111 | logHelper.log(`Cloning default branch into: '${afterPath}'.`); 112 | execSync(`git clone ${cloneUrl} ${afterPath}`); 113 | execSync(`git checkout ${travisEnv.pullRequestSha}`, { 114 | cwd: afterPath, 115 | }); 116 | 117 | return { 118 | beforePath, 119 | afterPath, 120 | }; 121 | }) 122 | .then(({beforePath, afterPath}) => { 123 | let buildCommand = `npm install && npm run build`; 124 | if (configuration.buildCommand) { 125 | buildCommand = configuration.buildCommand 126 | } 127 | 128 | logHelper.log(`Building before and after versions with: '${buildCommand}'.`); 129 | 130 | try { 131 | execSync(buildCommand, { 132 | cwd: beforePath, 133 | }); 134 | } catch (err) { 135 | logHelper.error(`Unable to run '${buildCommand}' in the "before" version.`); 136 | } 137 | 138 | try { 139 | execSync(buildCommand, { 140 | cwd: afterPath, 141 | }); 142 | } catch (err) { 143 | logHelper.error(`Unable to run '${buildCommand}' in the "after" version.`); 144 | throw err; 145 | } 146 | 147 | return {beforePath, afterPath}; 148 | }); 149 | } 150 | 151 | _runPlugins(plugins, details) { 152 | const pluginResults = {}; 153 | return plugins.reduce((promiseChain, plugin) => { 154 | logHelper.log(`Running Plugins....`); 155 | return promiseChain.then(() => { 156 | if (!plugin.name) { 157 | throw new Error(`One of the plugins has failed to define a name ` + 158 | `property. This is required for reporting.`); 159 | } 160 | 161 | logHelper.log(` ${plugin.name}`); 162 | 163 | return plugin.run(details) 164 | .catch((err) => { 165 | throw new Error(`The '${plugin.name}' threw an error while ` + 166 | `running: '${err.message}'`); 167 | }) 168 | .then((result) => { 169 | pluginResults[plugin.name] = result; 170 | }); 171 | }); 172 | }, Promise.resolve()) 173 | .then(() => { 174 | logHelper.log(``); 175 | return pluginResults; 176 | }); 177 | } 178 | 179 | _logDebugInfo(pluginResults) { 180 | logHelper.log(`Results from plugins`); 181 | 182 | const pluginNames = Object.keys(pluginResults); 183 | pluginNames.forEach((pluginName) => { 184 | const result = pluginResults[pluginName]; 185 | logHelper.log(` ${pluginName}`); 186 | if (result.prettyLog) { 187 | console.log(''); 188 | console.log(result.prettyLog); 189 | console.log(''); 190 | } else { 191 | logHelper.log(' This plugin provided no log output.'); 192 | } 193 | }); 194 | } 195 | 196 | _logGithubState(configuration, travisEnv, githubController, pluginResults) { 197 | let githubComment = ``; 198 | let failPR = false; 199 | const pluginNames = Object.keys(pluginResults); 200 | pluginNames.forEach((pluginName) => { 201 | const result = pluginResults[pluginName]; 202 | githubComment += `### ${pluginName}\n\n`; 203 | if (result.markdownLog) { 204 | githubComment += result.markdownLog; 205 | } else { 206 | githubComment += `This plugin provided no markdown output.`; 207 | } 208 | githubComment += `\n\n`; 209 | 210 | if (result.failPR) { 211 | failPR = true; 212 | } 213 | }); 214 | 215 | let deletePromise = Promise.resolve(); 216 | if (configuration.botUsername) { 217 | deletePromise = githubController.deletePreviousIssueComments({ 218 | number: travisEnv.pullRequestNumber, 219 | botName: configuration.botUsername 220 | }); 221 | } 222 | 223 | return deletePromise 224 | .then(() => { 225 | return githubController.postIssueComment({ 226 | number: travisEnv.pullRequestNumber, 227 | comment: githubComment, 228 | }); 229 | }) 230 | .then(() => { 231 | return githubController.postState({ 232 | sha: travisEnv.pullRequestSha, 233 | state: failPR ? 'failure' : 'success' 234 | }) 235 | }); 236 | } 237 | } 238 | 239 | module.exports = TravisBot; 240 | -------------------------------------------------------------------------------- /src/controllers/github-controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const GitHubApi = require('github'); 17 | const logHelper = require('../utils/log-helper'); 18 | 19 | class GithubController { 20 | constructor({owner, repo}) { 21 | const token = process.env['GITHUB_TOKEN']; 22 | if (!token) { 23 | logHelper.error(`No 'GITHUB_TOKEN' environment variable defined.`); 24 | throw new Error(`No 'GITHUB_TOKEN' environment variable defined.`); 25 | } 26 | 27 | this._github = new GitHubApi(); 28 | // Can this be type of 'token' ? 29 | this._github.authenticate({ 30 | type: 'oauth', 31 | token: token, 32 | }); 33 | 34 | this._owner = owner; 35 | this._repo = repo; 36 | } 37 | 38 | /** 39 | * Pull requests are treated as issues by the Github API. 40 | */ 41 | postIssueComment({number, comment}) { 42 | return this._github.issues.createComment({ 43 | owner: this._owner, 44 | repo: this._repo, 45 | number, 46 | body: comment 47 | }); 48 | } 49 | 50 | /** 51 | * This will show up in PR's as the current state (same place as Travis 52 | * status can block a PR.) 53 | */ 54 | postState({sha, state}) { 55 | return this._github.repos.createStatus({ 56 | owner: this._owner, 57 | repo: this._repo, 58 | sha: sha, 59 | state, 60 | context: 'PR-Bot', 61 | description: 'All PR-Bot plugins passed the build.' 62 | }); 63 | } 64 | 65 | /** 66 | * Get the details for a specific PR 67 | */ 68 | getPRDetails({number}) { 69 | return this._github.pullRequests.get({ 70 | owner: this._owner, 71 | repo: this._repo, 72 | number, 73 | }); 74 | } 75 | 76 | getRepoDetails() { 77 | return this._github.repos.get({ 78 | owner: this._owner, 79 | repo: this._repo, 80 | }); 81 | } 82 | 83 | getBranchDetails({branch}) { 84 | return this._github.repos.getBranch({ 85 | owner: this._owner, 86 | repo: this._repo, 87 | branch, 88 | }); 89 | } 90 | 91 | deletePreviousIssueComments({number, botName}) { 92 | return this._github.issues.getComments({ 93 | owner: this._owner, 94 | repo: this._repo, 95 | number, 96 | }) 97 | .then((issueCommentsData) => { 98 | const issueComments = issueCommentsData.data; 99 | const botIssues = issueComments.filter((issueComment) => { 100 | return (issueComment.user.login === botName); 101 | }); 102 | const deletePromises = botIssues.map((botIssue) => { 103 | return this._github.issues.deleteComment({ 104 | id: botIssue.id, 105 | owner: this._owner, 106 | repo: this._repo, 107 | }); 108 | }); 109 | }); 110 | } 111 | } 112 | 113 | module.exports = GithubController; 114 | -------------------------------------------------------------------------------- /src/models/travis-env-model.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | class TravisEnvModel { 17 | get isTravis() { 18 | return (process.env['TRAVIS'] === 'true'); 19 | } 20 | 21 | get isPullRequest() { 22 | return (process.env['TRAVIS_EVENT_TYPE'] === 'pull_request'); 23 | } 24 | 25 | get repoDetails() { 26 | if (!process.env['TRAVIS_REPO_SLUG']) { 27 | return null; 28 | } 29 | 30 | const splitSlug = process.env['TRAVIS_REPO_SLUG'].split('/'); 31 | if (splitSlug.length !== 2) { 32 | return null; 33 | } 34 | 35 | return { 36 | owner: splitSlug[0], 37 | repo: splitSlug[1], 38 | } 39 | } 40 | 41 | // The target branch of the pull request OR the current 42 | // branch that is commited to. 43 | get gitBranch() { 44 | return process.env['TRAVIS_BRANCH']; 45 | } 46 | 47 | get pullRequestSha() { 48 | return process.env['TRAVIS_PULL_REQUEST_SHA']; 49 | } 50 | 51 | get pullRequestNumber() { 52 | if (!process.env['TRAVIS_PULL_REQUEST'] || process.env['TRAVIS_PULL_REQUEST'] === 'false') { 53 | return undefined; 54 | } 55 | 56 | return process.env['TRAVIS_PULL_REQUEST']; 57 | } 58 | 59 | get isSuccessfulTravisRun() { 60 | const testResult = process.env['TRAVIS_TEST_RESULT']; 61 | if (typeof testResult === 'undefined') { 62 | return undefined; 63 | } 64 | 65 | return (testResult === '0'); 66 | } 67 | } 68 | 69 | module.exports = TravisEnvModel; 70 | -------------------------------------------------------------------------------- /src/models/units.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /** 18 | * Used to abstract away the display string and decimal places for different 19 | * units of storage. 20 | */ 21 | module.exports = { 22 | BYTE: { 23 | display: 'B', 24 | decimalPlaces: 0, 25 | }, 26 | KILOBYTE: { 27 | display: 'KB', 28 | decimalPlaces: 2, 29 | }, 30 | MEGABYTE: { 31 | display: 'MB', 32 | decimalPlaces: 2, 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /src/npm-module.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const PluginInterface = require('./plugins/plugin-interface'); 17 | const SizePlugin = require('./plugins/size'); 18 | 19 | module.exports = { 20 | PluginInterface, 21 | plugins: { 22 | Size: SizePlugin, 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /src/plugins/plugin-interface.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | class PluginInterface { 17 | constructor(pluginName) { 18 | if (!pluginName) { 19 | throw new Error('You must define a plugin name.'); 20 | } 21 | this._pluginName = pluginName; 22 | } 23 | 24 | get name() { 25 | return this._pluginName; 26 | } 27 | 28 | createLogTable(rows) { 29 | if (!rows || rows.length === 0) { 30 | return ''; 31 | } 32 | 33 | let numberOfCols = rows[0].length; 34 | let columnWidths = []; 35 | for (let i = 0; i < numberOfCols; i++) { 36 | columnWidths.push(0); 37 | } 38 | 39 | rows.forEach((row) => { 40 | for (let i = 0; i < numberOfCols; i++) { 41 | let rowEntry = row[i]; 42 | if (rowEntry.length > columnWidths[i]) { 43 | columnWidths[i] = rowEntry.length; 44 | } 45 | } 46 | }); 47 | 48 | const rowStrings = rows.map((row) => { 49 | const rowStrings = []; 50 | for (let i = 0; i < numberOfCols; i++) { 51 | let rowEntry = row[i]; 52 | rowStrings.push( 53 | this._padWithSpaces(rowEntry, columnWidths[i]) 54 | ); 55 | } 56 | return rowStrings.join(' ').trim(); 57 | }); 58 | 59 | return rowStrings.join('\n'); 60 | } 61 | 62 | createMDTable(headings, rows) { 63 | if (!rows || rows.length === 0) { 64 | return ''; 65 | } 66 | 67 | let numberOfCols = headings.length; 68 | let columnWidths = []; 69 | for (let i = 0; i < numberOfCols; i++) { 70 | columnWidths.push(0); 71 | } 72 | 73 | let headingString = `| ${headings.join(' | ')} |`; 74 | let headingEnd = `|${' --- |'.repeat(numberOfCols)}`; 75 | 76 | rows.forEach((row) => { 77 | for (let i = 0; i < numberOfCols; i++) { 78 | let rowEntry = row[i]; 79 | if (rowEntry.length > columnWidths[i]) { 80 | columnWidths[i] = rowEntry.length; 81 | } 82 | } 83 | }); 84 | 85 | const joinedRows = rows.map((row) => { 86 | const rowStrings = []; 87 | for (let i = 0; i < numberOfCols; i++) { 88 | let rowEntry = row[i]; 89 | rowStrings.push( 90 | this._padWithSpaces(rowEntry, columnWidths[i]) 91 | ); 92 | } 93 | return `| ${rowStrings.join(' | ').trim()} |`; 94 | }).join('\n'); 95 | return [headingString, headingEnd, joinedRows].join('\n'); 96 | } 97 | 98 | _padWithSpaces(string, requiredWidth) { 99 | return string + ' '.repeat(requiredWidth - string.length); 100 | } 101 | } 102 | 103 | module.exports = PluginInterface; 104 | -------------------------------------------------------------------------------- /src/plugins/size.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const glob = require('glob'); 17 | const fs = require('fs-extra'); 18 | const path = require('path'); 19 | const chalk = require('chalk'); 20 | const gzipSize = require('gzip-size'); 21 | 22 | const PluginInterface = require('./plugin-interface'); 23 | const UNITS = require('../models/units'); 24 | 25 | const POSITIVE_EMOJI = '✅'; 26 | const NEGATIVE_EMOJI = '🚫'; 27 | 28 | class SizePlugin extends PluginInterface { 29 | constructor({globPattern, globOptions} = {}) { 30 | super('PR-Bot Size Plugin'); 31 | 32 | this._globPattern = globPattern; 33 | this._globOptions = globOptions; 34 | } 35 | 36 | run({beforePath, afterPath} = {}) { 37 | if (!this._globPattern) { 38 | throw new Error(`The '${this.name}' requires a ` + 39 | `'globPattern' parameter in the constructor.`); 40 | } 41 | 42 | return Promise.all([ 43 | this._getFileDetails(beforePath), 44 | this._getFileDetails(afterPath), 45 | ]) 46 | .then((results) => { 47 | const beforeFiles = results[0]; 48 | const afterFiles = results[1]; 49 | 50 | const newFileList = []; 51 | 52 | Object.keys(afterFiles).forEach((relativePathKey) => { 53 | const fileDetails = afterFiles[relativePathKey]; 54 | 55 | const afterDetails = afterFiles[relativePathKey]; 56 | const beforeDetails = beforeFiles[relativePathKey]; 57 | 58 | // If there was a previous file but it's size was 0, 59 | // treat it as a new file (avoids the divide by zero issue with) 60 | // calculating sizeDiff 61 | fileDetails.isNewFile = (typeof beforeDetails === 'undefined'); 62 | 63 | if (!fileDetails.isNewFile) { 64 | fileDetails.previousSize = beforeDetails.sizeInBytes; 65 | fileDetails.sizeDifferenceInBytes = 66 | afterDetails.sizeInBytes - beforeDetails.sizeInBytes; 67 | fileDetails.sizeDifferencePercent = 68 | (afterDetails.sizeInBytes / beforeDetails.sizeInBytes) - 1; 69 | } else { 70 | fileDetails.previousSize = null; 71 | fileDetails.sizeDifferenceInBytes = NaN; 72 | fileDetails.sizeDifferencePercent = NaN; 73 | } 74 | 75 | newFileList.push(fileDetails); 76 | }); 77 | 78 | return newFileList; 79 | }) 80 | .then((allFileInfo) => { 81 | return { 82 | prettyLog: this.getPrettyLogResults(allFileInfo), 83 | markdownLog: this.getMarkdownResults(allFileInfo), 84 | }; 85 | }); 86 | } 87 | 88 | _getFileDetails(directory) { 89 | return new Promise((resolve, reject) => { 90 | const globOptions = this._globOptions || {}; 91 | globOptions.absolute = true; 92 | globOptions.cwd = directory; 93 | globOptions.root = directory; 94 | 95 | glob(this._globPattern, globOptions, (err, matches) => { 96 | if (err) { 97 | return reject(err); 98 | } 99 | resolve(matches); 100 | }); 101 | }) 102 | .then((filePaths) => { 103 | return filePaths.reduce((promiseChain, filePath) => { 104 | return promiseChain.then((fileInfo) => { 105 | return fs.stat(filePath) 106 | .then((stats) => { 107 | const fileContents = fs.readFileSync(filePath); 108 | const gzippedSize = gzipSize.sync(fileContents); 109 | const relativePath = path.relative(directory, filePath); 110 | fileInfo[relativePath] = { 111 | relativePath, 112 | sizeInBytes: stats.size, 113 | gzipSizeInBytes: gzippedSize, 114 | }; 115 | return fileInfo; 116 | }); 117 | }); 118 | }, Promise.resolve({})); 119 | }); 120 | } 121 | 122 | static _convertSize(sizeInBytes) { 123 | if (typeof sizeInBytes !== 'number') { 124 | return null; 125 | } 126 | 127 | let fileSize = sizeInBytes; 128 | let unit = UNITS.BYTE; 129 | if (fileSize >= 1000) { 130 | unit = UNITS.KILOBYTE; 131 | fileSize = fileSize / 1000; 132 | 133 | if (fileSize >= 1000) { 134 | unit = UNITS.MEGABYTE; 135 | fileSize = fileSize / 1000; 136 | } 137 | } 138 | 139 | return { 140 | size: fileSize, 141 | unit, 142 | }; 143 | } 144 | 145 | getPrettyLogResults(allFileInfo) { 146 | let changedFileInfo = allFileInfo.filter((fileInfo) => { 147 | return fileInfo.isNewFile === false && (fileInfo.sizeDifferenceInBytes !== 0); 148 | }); 149 | 150 | const changedFileRows = changedFileInfo.map((fileInfo) => { 151 | const newSizeDetails = SizePlugin._convertSize(fileInfo.sizeInBytes); 152 | const prevSizeDetails = SizePlugin._convertSize(fileInfo.previousSize); 153 | 154 | let percentChangeColor = chalk.dim; 155 | if (fileInfo.sizeDifferencePercent >= 0.1) { 156 | percentChangeColor = chalk.red; 157 | } else if (fileInfo.sizeDifferencePercent <= -0.1) { 158 | percentChangeColor = chalk.green; 159 | } 160 | 161 | let prettyFloat = parseFloat(fileInfo.sizeDifferencePercent * 100) 162 | .toFixed(0); 163 | let prefix = ''; 164 | if (fileInfo.sizeDifferencePercent > 0) { 165 | prefix = '+'; 166 | } 167 | let percentString = percentChangeColor(`${prefix}${prettyFloat}%`); 168 | 169 | const prevSize = parseFloat(prevSizeDetails.size).toFixed( 170 | prevSizeDetails.unit.decimalPlaces); 171 | const newSize = parseFloat(newSizeDetails.size).toFixed( 172 | newSizeDetails.unit.decimalPlaces); 173 | 174 | return [ 175 | chalk.yellow(fileInfo.relativePath), 176 | chalk.dim(`${prevSize} ${prevSizeDetails.unit.display}`), 177 | chalk.dim(`>`), 178 | chalk.blue(`${newSize} ${newSizeDetails.unit.display}`), 179 | percentString 180 | ]; 181 | }); 182 | 183 | let newFileInfo = allFileInfo.filter((fileInfo) => { 184 | return fileInfo.isNewFile; 185 | }); 186 | 187 | let newFileRows = newFileInfo.map((fileInfo) => { 188 | const newSizeDetails = SizePlugin._convertSize(fileInfo.sizeInBytes); 189 | 190 | const newSize = parseFloat(newSizeDetails.size).toFixed( 191 | newSizeDetails.unit.decimalPlaces); 192 | 193 | return [ 194 | chalk.yellow(fileInfo.relativePath), 195 | chalk.blue(`${newSize} ${newSizeDetails.unit.display}`), 196 | ]; 197 | }); 198 | 199 | let changedTable = this.createLogTable(changedFileRows); 200 | let newTable = this.createLogTable(newFileRows); 201 | 202 | if (!changedTable) { 203 | changedTable = 'No file sizes have changed.'; 204 | } 205 | 206 | if (!newTable) { 207 | newTable = 'No new files have been added.'; 208 | } 209 | 210 | const changedTitle = 'Changed File Sizes'; 211 | const changedTitleBar = '-'.repeat(changedTitle.length); 212 | const allChangedTable = [changedTitle, changedTitleBar, changedTable] 213 | .join('\n'); 214 | 215 | const newTitle = 'New Files'; 216 | const newTitleBar = '-'.repeat(newTitle.length); 217 | const allNewTable = [newTitle, newTitleBar, newTable] 218 | .join('\n'); 219 | 220 | return '\n' + [allChangedTable, allNewTable].join('\n\n') + '\n'; 221 | } 222 | 223 | getMarkdownResults(allFileInfo) { 224 | let changedHeadings = [ 225 | 'File', 226 | 'Before', 227 | 'After', 228 | 'Change', 229 | 'GZipped', 230 | '' 231 | ]; 232 | 233 | let changedFileInfo = allFileInfo.filter((fileInfo) => { 234 | return fileInfo.isNewFile === false && (fileInfo.sizeDifferenceInBytes !== 0); 235 | }); 236 | 237 | const changedFileRows = this._getMDFileRows(changedFileInfo); 238 | const fullFileRows = this._getMDFileRows(allFileInfo); 239 | 240 | let newHeadings = [ 241 | 'File', 242 | 'Size', 243 | 'GZipped' 244 | ]; 245 | 246 | let newFileInfo = allFileInfo.filter((fileInfo) => { 247 | return fileInfo.isNewFile; 248 | }); 249 | 250 | let newFileRows = newFileInfo.map((fileInfo) => { 251 | const newSizeDetails = SizePlugin._convertSize(fileInfo.sizeInBytes); 252 | const newGZipDetails = SizePlugin._convertSize(fileInfo.gzipSizeInBytes); 253 | 254 | const newSize = parseFloat(newSizeDetails.size).toFixed( 255 | newSizeDetails.unit.decimalPlaces); 256 | const newGzipSize = parseFloat(newGZipDetails.size).toFixed( 257 | newGZipDetails.unit.decimalPlaces); 258 | 259 | return [ 260 | fileInfo.relativePath, 261 | `${newSize} ${newSizeDetails.unit.display}`, 262 | `${newGzipSize} ${newGZipDetails.unit.display}` 263 | ]; 264 | }); 265 | 266 | let changedTable = this.createMDTable(changedHeadings, changedFileRows); 267 | let newTable = this.createMDTable(newHeadings, newFileRows); 268 | let fullTable = this.createMDTable(changedHeadings, fullFileRows); 269 | 270 | if (!changedTable) { 271 | changedTable = 'No file sizes have changed.'; 272 | } 273 | 274 | if (!newTable) { 275 | newTable = 'No new files have been added.'; 276 | } 277 | 278 | return `#### Changed File Sizes 279 | 280 | ${changedTable} 281 | 282 | #### New Files 283 | 284 | ${newTable} 285 | 286 | #### All File Sizes 287 | 288 |
289 | View Table 290 | 291 | ${fullTable} 292 | 293 |
`; 294 | } 295 | 296 | _getMDFileRows(fileDetails) { 297 | return fileDetails.map((fileInfo) => { 298 | const newSizeDetails = SizePlugin._convertSize(fileInfo.sizeInBytes); 299 | const newGzipDetails = SizePlugin._convertSize(fileInfo.gzipSizeInBytes); 300 | const prevSizeDetails = SizePlugin._convertSize(fileInfo.previousSize); 301 | 302 | let percentString = ''; 303 | if (!isNaN(fileInfo.sizeDifferencePercent)) { 304 | let prettyFloat = parseFloat(fileInfo.sizeDifferencePercent * 100) 305 | .toFixed(0); 306 | let prefix = ''; 307 | if (fileInfo.sizeDifferencePercent > 0) { 308 | prefix = '+'; 309 | } 310 | percentString = `${prefix}${prettyFloat}%`; 311 | } 312 | 313 | let emoji = ''; 314 | if (fileInfo.sizeDifferencePercent > 0.1) { 315 | emoji = '☠️'; 316 | } else if(fileInfo.sizeDifferencePercent < -0.1) { 317 | emoji = '🎉'; 318 | } 319 | 320 | const newSize = parseFloat(newSizeDetails.size).toFixed( 321 | newSizeDetails.unit.decimalPlaces); 322 | const newGzipSize = parseFloat(newGzipDetails.size).toFixed( 323 | newGzipDetails.unit.decimalPlaces); 324 | 325 | return [ 326 | fileInfo.relativePath, 327 | prevSizeDetails ? `${parseFloat(prevSizeDetails.size).toFixed(prevSizeDetails.unit.decimalPlaces)} ${prevSizeDetails.unit.display}` : '', 328 | `${newSize} ${newSizeDetails.unit.display}`, 329 | percentString, 330 | `${newGzipSize} ${newGzipDetails.unit.display}`, 331 | emoji 332 | ]; 333 | }); 334 | } 335 | } 336 | 337 | module.exports = SizePlugin; 338 | -------------------------------------------------------------------------------- /src/utils/log-helper.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const chalk = require('chalk'); 17 | 18 | class LogHelper { 19 | constructor() { 20 | this._prefix; 21 | } 22 | 23 | setPrimaryPrefix(newPrefix) { 24 | this._prefix = newPrefix; 25 | } 26 | 27 | _getPrefix(color) { 28 | if (!this._prefix) { 29 | return ''; 30 | } 31 | 32 | return color(`[${this._prefix}]:`); 33 | } 34 | 35 | log() { 36 | console.log(this._getPrefix(chalk.green), ...arguments); 37 | } 38 | 39 | warn() { 40 | console.log(this._getPrefix(chalk.yellow), ...arguments); 41 | } 42 | 43 | error() { 44 | console.log(this._getPrefix(chalk.red), ...arguments); 45 | } 46 | 47 | logKeyValues(keyValues) { 48 | let longestString = 0; 49 | const keys = Object.keys(keyValues); 50 | keys.forEach((keyName) => { 51 | if (keyName.length > longestString) { 52 | longestString = keyName.length; 53 | } 54 | }); 55 | 56 | keys.forEach((keyName) => { 57 | let spaceString = ' '; 58 | const spaceLength = longestString - keyName.length; 59 | for(let i = 0; i < spaceLength; i++) { 60 | spaceString += ' '; 61 | } 62 | 63 | this.log( 64 | ' ' + 65 | chalk.gray(keyName) + 66 | spaceString + 67 | chalk.blue(`'${keyValues[keyName]}'`) 68 | ); 69 | }); 70 | } 71 | } 72 | 73 | module.exports = new LogHelper(); 74 | -------------------------------------------------------------------------------- /test/node/plugins/test-plugin-interface.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const expect = require('chai').expect; 17 | const PluginInterface = require('../../../src/plugins/plugin-interface'); 18 | 19 | describe('Plugin Interface', function() { 20 | it('should throw when no name defined', function() { 21 | expect(() => { 22 | new PluginInterface(); 23 | }).to.throw('You must define a plugin name.'); 24 | }) 25 | }); 26 | -------------------------------------------------------------------------------- /test/node/plugins/test-size.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const expect = require('chai').expect; 17 | const sinon = require('sinon'); 18 | const path = require('path'); 19 | const proxyquire = require('proxyquire'); 20 | const SizePlugin = require('../../../src/plugins/size'); 21 | const UNITS = require('../../../src/models/units'); 22 | 23 | describe('plugins.Size', function() { 24 | it('should get name', function() { 25 | const plugin = new SizePlugin(); 26 | expect(plugin.name).to.exist; 27 | }); 28 | 29 | it('should throw when no globPattern', function() { 30 | expect(() => { 31 | const plugin = new SizePlugin(); 32 | return plugin.run() 33 | }).to.throw(`requires a 'globPattern'`); 34 | }); 35 | 36 | it('should reject on glob error', function() { 37 | const injectedError = new Error('Inject test error.'); 38 | const SizePlugin = proxyquire('../../../src/plugins/size', { 39 | 'glob': (pattern, opts, cb) => { 40 | cb(injectedError) 41 | } 42 | }); 43 | const sizePlugin = new SizePlugin({ 44 | globPattern: '**/*', 45 | }); 46 | return sizePlugin.run() 47 | .then(() => { 48 | throw new Error('Expected run to throw an injected error.'); 49 | }, (err) => { 50 | expect(err).to.equal(injectedError); 51 | }); 52 | }); 53 | 54 | it('should mark file changes', function() { 55 | const plugin = new SizePlugin({ 56 | globPattern: '**/*', 57 | }); 58 | return plugin.run({ 59 | beforePath: path.join(__dirname, '..', '..', 'static', 'size-example-before'), 60 | afterPath: path.join(__dirname, '..', '..', 'static', 'size-example-after'), 61 | }) 62 | .then((results) => { 63 | expect(results.prettyLog).to.exist; 64 | 65 | console.log(results.prettyLog); 66 | 67 | // Print all logs when nothings changed. 68 | const cleanLog = results.prettyLog.replace( 69 | /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, 70 | ''); 71 | expect(cleanLog).to.equal(` 72 | Changed File Sizes 73 | ------------------ 74 | content-to-empty.txt 45 B > 0 B -100% 75 | dino.jpg 268.63 KB > 104.00 KB -61% 76 | empty-to-content.txt 0 B > 38 B +Infinity% 77 | minor-change.txt 7.13 KB > 7.13 KB -0% 78 | stays-the-same.txt 29 B > 50 B +72% 79 | 80 | New Files 81 | --------- 82 | new-file.txt 21 B 83 | `); 84 | 85 | expect(results.markdownLog).to.exist; 86 | 87 | console.log(results.markdownLog); 88 | 89 | expect(results.markdownLog).to.equal(`#### Changed File Sizes 90 | 91 | | File | Before | After | Change | GZipped | | 92 | | --- | --- | --- | --- | --- | --- | 93 | | content-to-empty.txt | 45 B | 0 B | -100% | 20 B | 🎉 | 94 | | dino.jpg | 268.63 KB | 104.00 KB | -61% | 103.24 KB | 🎉 | 95 | | empty-to-content.txt | 0 B | 38 B | +Infinity% | 56 B | ☠️ | 96 | | minor-change.txt | 7.13 KB | 7.13 KB | -0% | 2.52 KB | | 97 | | stays-the-same.txt | 29 B | 50 B | +72% | 67 B | ☠️ | 98 | 99 | #### New Files 100 | 101 | | File | Size | GZipped | 102 | | --- | --- | --- | 103 | | new-file.txt | 21 B | 41 B | 104 | 105 | #### All File Sizes 106 | 107 |
108 | View Table 109 | 110 | | File | Before | After | Change | GZipped | | 111 | | --- | --- | --- | --- | --- | --- | 112 | | content-to-empty.txt | 45 B | 0 B | -100% | 20 B | 🎉 | 113 | | dino.jpg | 268.63 KB | 104.00 KB | -61% | 103.24 KB | 🎉 | 114 | | empty-to-content.txt | 0 B | 38 B | +Infinity% | 56 B | ☠️ | 115 | | empty.txt | 0 B | 0 B | | 20 B | | 116 | | minor-change.txt | 7.13 KB | 7.13 KB | -0% | 2.52 KB | | 117 | | new-file.txt | | 21 B | | 41 B | | 118 | | stays-the-same.txt | 29 B | 50 B | +72% | 67 B | ☠️ | 119 | 120 |
`); 121 | }); 122 | }); 123 | 124 | it('should handle no file changed gracefully', function() { 125 | const plugin = new SizePlugin({ 126 | globPattern: '**/*', 127 | }); 128 | return plugin.run({ 129 | beforePath: path.join(__dirname, '..', '..', 'static', 'size-example-after'), 130 | afterPath: path.join(__dirname, '..', '..', 'static', 'size-example-after'), 131 | }) 132 | .then((results) => { 133 | expect(results.prettyLog).to.exist; 134 | 135 | const cleanLog = results.prettyLog.replace( 136 | /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, 137 | ''); 138 | expect(cleanLog).to.equal(` 139 | Changed File Sizes 140 | ------------------ 141 | No file sizes have changed. 142 | 143 | New Files 144 | --------- 145 | No new files have been added. 146 | `); 147 | 148 | expect(results.markdownLog).to.exist; 149 | 150 | console.log(results.markdownLog); 151 | 152 | expect(results.markdownLog).to.equal(`#### Changed File Sizes 153 | 154 | No file sizes have changed. 155 | 156 | #### New Files 157 | 158 | No new files have been added. 159 | 160 | #### All File Sizes 161 | 162 |
163 | View Table 164 | 165 | | File | Before | After | Change | GZipped | | 166 | | --- | --- | --- | --- | --- | --- | 167 | | content-to-empty.txt | 0 B | 0 B | | 20 B | | 168 | | dino.jpg | 104.00 KB | 104.00 KB | 0% | 103.24 KB | | 169 | | empty-to-content.txt | 38 B | 38 B | 0% | 56 B | | 170 | | empty.txt | 0 B | 0 B | | 20 B | | 171 | | minor-change.txt | 7.13 KB | 7.13 KB | 0% | 2.52 KB | | 172 | | new-file.txt | 21 B | 21 B | 0% | 41 B | | 173 | | stays-the-same.txt | 50 B | 50 B | 0% | 67 B | | 174 | 175 |
`); 176 | }); 177 | }) 178 | 179 | it('should return 1KB', function() { 180 | const result = SizePlugin._convertSize(1000); 181 | expect(result).to.deep.equal({ 182 | size: 1, 183 | unit: UNITS.KILOBYTE, 184 | }); 185 | }); 186 | 187 | it('should return 1.5KB', function() { 188 | const result = SizePlugin._convertSize(1500); 189 | expect(result).to.deep.equal({ 190 | size: 1.5, 191 | unit: UNITS.KILOBYTE, 192 | }); 193 | }); 194 | 195 | it('should return 1MB', function() { 196 | const result = SizePlugin._convertSize(1000000); 197 | expect(result).to.deep.equal({ 198 | size: 1, 199 | unit: UNITS.MEGABYTE, 200 | }); 201 | }); 202 | 203 | it('should return 1.5MB', function() { 204 | const result = SizePlugin._convertSize(1500000); 205 | expect(result).to.deep.equal({ 206 | size: 1.5, 207 | unit: UNITS.MEGABYTE, 208 | }); 209 | }); 210 | }); 211 | -------------------------------------------------------------------------------- /test/node/test-github-controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const expect = require('chai').expect; 17 | const sinon = require('sinon'); 18 | const GithubController = require('../../src/controllers/github-controller'); 19 | 20 | describe('github-controller', function() { 21 | let stubs = []; 22 | 23 | afterEach(function() { 24 | stubs.forEach((stub) => { 25 | stub.restore(); 26 | }); 27 | stubs = []; 28 | }); 29 | 30 | it('should throw without token', function() { 31 | delete process.env['GITHUB_TOKEN']; 32 | 33 | expect(() => { 34 | new GithubController({owner: 'example-owner', repo: 'example-repo'}); 35 | }).to.throw(`No 'GITHUB_TOKEN' environment variable defined.`); 36 | }); 37 | 38 | it('should instiate with token', function() { 39 | process.env['GITHUB_TOKEN'] = 'example-token'; 40 | 41 | expect(() => { 42 | new GithubController({owner: 'example-owner', repo: 'example-repo'}); 43 | }).to.not.throw(); 44 | }); 45 | 46 | it('should throw without input to postIssueComment', function() { 47 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 48 | expect(() => { 49 | controller.postIssueComment(); 50 | }).to.throw(); 51 | }); 52 | 53 | it('should throw on github API error postIssueComment', function() { 54 | const injectedError = new Error('Injected error.'); 55 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 56 | 57 | const stub = sinon.stub(controller._github.issues, 'createComment').callsFake(() => { 58 | return Promise.reject(injectedError); 59 | }); 60 | stubs.push(stub); 61 | 62 | return controller.postIssueComment({ 63 | number: -1, 64 | comment: `Example comment text` 65 | }) 66 | .then(() => { 67 | throw new Error(`Expected injected error to be thrown.`); 68 | }, (err) => { 69 | expect(err).to.equal(injectedError); 70 | }); 71 | }); 72 | 73 | it('should resolve on valid github API postIssueComment', function() { 74 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 75 | 76 | const stub = sinon.stub(controller._github.issues, 'createComment').callsFake(() => { 77 | return Promise.resolve(); 78 | }); 79 | stubs.push(stub); 80 | 81 | return controller.postIssueComment({ 82 | number: -1, 83 | comment: `Example comment text` 84 | }); 85 | }); 86 | 87 | it('should throw without input to postState', function() { 88 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 89 | expect(() => { 90 | controller.postState(); 91 | }).to.throw(); 92 | }); 93 | 94 | it('should throw on github API error postState', function() { 95 | const injectedError = new Error('Injected error.'); 96 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 97 | 98 | const stub = sinon.stub(controller._github.repos, 'createStatus').callsFake(() => { 99 | return Promise.reject(injectedError); 100 | }); 101 | stubs.push(stub); 102 | 103 | return controller.postState({ 104 | sha: '-1', 105 | state: `error` 106 | }) 107 | .then(() => { 108 | throw new Error(`Expected injected error to be thrown.`); 109 | }, (err) => { 110 | expect(err).to.equal(injectedError); 111 | }); 112 | }); 113 | 114 | it('should resolve on valid github API postState', function() { 115 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 116 | 117 | const stub = sinon.stub(controller._github.repos, 'createStatus').callsFake(() => { 118 | return Promise.resolve(); 119 | }); 120 | stubs.push(stub); 121 | 122 | return controller.postState({ 123 | sha: '1234', 124 | state: `success` 125 | }); 126 | }); 127 | 128 | it('should reject PR details from github', function() { 129 | const injectedError = new Error('Injected Error.'); 130 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 131 | 132 | const stub = sinon.stub(controller._github.pullRequests, 'get').callsFake(() => { 133 | return Promise.reject(injectedError); 134 | }); 135 | stubs.push(stub); 136 | 137 | return controller.getPRDetails({ 138 | number: '-1', 139 | }) 140 | .then(() => { 141 | throw new Error('Expected injected error to be thrown.'); 142 | }, (err) => { 143 | expect(err).to.equal(injectedError); 144 | }); 145 | }); 146 | 147 | it('should resolve with PR details', function() { 148 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 149 | 150 | const stub = sinon.stub(controller._github.pullRequests, 'get').callsFake(() => { 151 | return Promise.resolve(); 152 | }); 153 | stubs.push(stub); 154 | 155 | return controller.getPRDetails({ 156 | number: '1234', 157 | }); 158 | }); 159 | 160 | it('should reject repo details from github', function() { 161 | const injectedError = new Error('Injected Error.'); 162 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 163 | 164 | const stub = sinon.stub(controller._github.repos, 'get').callsFake(() => { 165 | return Promise.reject(injectedError); 166 | }); 167 | stubs.push(stub); 168 | 169 | return controller.getRepoDetails() 170 | .then(() => { 171 | throw new Error('Expected injected error to be thrown.'); 172 | }, (err) => { 173 | expect(err).to.equal(injectedError); 174 | }); 175 | }); 176 | 177 | it('should resolve with repo details', function() { 178 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 179 | 180 | const stub = sinon.stub(controller._github.repos, 'get').callsFake(() => { 181 | return Promise.resolve(); 182 | }); 183 | stubs.push(stub); 184 | 185 | return controller.getRepoDetails(); 186 | }); 187 | 188 | it('should reject branch details from github', function() { 189 | const injectedError = new Error('Injected Error.'); 190 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 191 | 192 | const stub = sinon.stub(controller._github.repos, 'getBranch').callsFake(() => { 193 | return Promise.reject(injectedError); 194 | }); 195 | stubs.push(stub); 196 | 197 | return controller.getBranchDetails({ 198 | branch: 'branchName', 199 | }) 200 | .then(() => { 201 | throw new Error('Expected injected error to be thrown.'); 202 | }, (err) => { 203 | expect(err).to.equal(injectedError); 204 | }); 205 | }); 206 | 207 | it('should resolve with branch details', function() { 208 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 209 | 210 | const stub = sinon.stub(controller._github.repos, 'getBranch').callsFake(() => { 211 | return Promise.resolve(); 212 | }); 213 | stubs.push(stub); 214 | 215 | return controller.getBranchDetails({ 216 | branch: 'branchName', 217 | }); 218 | }); 219 | 220 | it('should remove previous bot comments', function() { 221 | const EXAMPLE_BOT_NAME = `example-bot-name`; 222 | const controller = new GithubController({owner: 'example-owner', repo: 'example-repo'}); 223 | 224 | const getStub = sinon.stub(controller._github.issues, 'getComments').callsFake(() => { 225 | return Promise.resolve({ 226 | data: [ 227 | { 228 | id: '1', 229 | user: { 230 | login: EXAMPLE_BOT_NAME 231 | } 232 | }, 233 | { 234 | id: '2', 235 | user: { 236 | login: 'someone-else' 237 | } 238 | }, 239 | { 240 | id: '3', 241 | user: { 242 | login: EXAMPLE_BOT_NAME 243 | } 244 | } 245 | ] 246 | }); 247 | }); 248 | stubs.push(getStub); 249 | 250 | const deleteStub = sinon.stub(controller._github.issues, 'deleteComment').callsFake((input) => { 251 | if (input.id !== '1' && input.id !== '3') { 252 | return Promise.reject(`Unexpected ID deleted: ${input.id}`); 253 | } 254 | return Promise.resolve(); 255 | }); 256 | stubs.push(deleteStub); 257 | 258 | return controller.deletePreviousIssueComments({ 259 | number: '1', 260 | botName: EXAMPLE_BOT_NAME 261 | }); 262 | }); 263 | }); 264 | -------------------------------------------------------------------------------- /test/node/test-travis-bot.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const sinon = require('sinon'); 17 | const path = require('path'); 18 | const proxyquire = require('proxyquire'); 19 | const expect = require('chai').expect; 20 | 21 | class FakeGithubController { 22 | getRepoDetails() { 23 | return Promise.resolve({ 24 | data: { 25 | clone_url: 'http://fake-url.from/fake-github-controller' 26 | } 27 | }); 28 | } 29 | postIssueComment(options) { 30 | console.log(options); 31 | } 32 | } 33 | 34 | const BotRunner = proxyquire('../../src/controllers/bot-runner.js', { 35 | './github-controller': FakeGithubController, 36 | 'child_process': { 37 | execSync: (command) => { 38 | console.log(`Running fake execSync command: '${command}'`); 39 | } 40 | } 41 | }); 42 | 43 | describe('bot-runner', function() { 44 | let stubs = []; 45 | 46 | afterEach(function() { 47 | stubs.forEach((stub) => { 48 | stub.restore(); 49 | }); 50 | stubs = []; 51 | 52 | delete process.env['TRAVIS']; 53 | delete process.env['TRAVIS_EVENT_TYPE']; 54 | delete process.env['TRAVIS_PULL_REQUEST']; 55 | delete process.env['TRAVIS_REPO_SLUG']; 56 | }); 57 | 58 | it('should instantiate Travis Bot', function() { 59 | new BotRunner(); 60 | }); 61 | 62 | it('should error when no repo-details in config or travis', function() { 63 | const bot = new BotRunner({ 64 | configPath: path.join(__dirname, '../static/no-repo-details.config.js') 65 | }); 66 | 67 | return bot.run() 68 | .then(() => { 69 | throw new Error('Expected error to be thrown due to no repo details'); 70 | }, (err) => { 71 | expect(err.message.indexOf(`Unable to get the Github 'repoDetails'`)) 72 | .to.not.equal(-1); 73 | }); 74 | }); 75 | 76 | it ('should get repo details from travis', function() { 77 | process.env['TRAVIS_REPO_SLUG'] = 'gauntface/example-repo'; 78 | 79 | const bot = new BotRunner({ 80 | configPath: path.join(__dirname, '../static/no-repo-details.config.js') 81 | }); 82 | 83 | return bot.run(); 84 | }) 85 | 86 | it('should instantiate Travis Bot and print to log', function() { 87 | const bot = new BotRunner({ 88 | configPath: path.join(__dirname, '../static/example.config.js') 89 | }); 90 | 91 | const logSpy = sinon.spy(bot, '_logDebugInfo'); 92 | 93 | return bot.run() 94 | .then(() => { 95 | expect(logSpy.calledOnce).to.equal(true); 96 | }); 97 | }); 98 | 99 | it('should handle no name plugins', function() { 100 | const bot = new BotRunner({ 101 | configPath: path.join(__dirname, '../static/no-plugin-name.config.js') 102 | }); 103 | 104 | return bot.run() 105 | .then(() => { 106 | throw new Error('Expect bad plugin to throw error.'); 107 | }, (err) => { 108 | expect(err.message).to.equal('One of the plugins has failed to define a name property. This is required for reporting.'); 109 | }); 110 | }); 111 | 112 | it('should handle bad plugins', function() { 113 | const bot = new BotRunner({ 114 | configPath: path.join(__dirname, '../static/bad-plugin.config.js') 115 | }); 116 | 117 | return bot.run() 118 | .then(() => { 119 | throw new Error('Expect bad plugin to throw error.'); 120 | }, (err) => { 121 | expect(err.message).to.equal(`The 'Bad Plugin will Error.' threw an error while running: 'Inject Error'`); 122 | }); 123 | }); 124 | 125 | it('should handle good custom plugin', function() { 126 | const bot = new BotRunner({ 127 | configPath: path.join(__dirname, '../static/example-with-plugin.config.js') 128 | }); 129 | 130 | return bot.run(); 131 | }); 132 | 133 | it('should try to print to Github', function() { 134 | process.env['TRAVIS'] = 'true'; 135 | process.env['TRAVIS_EVENT_TYPE'] = 'pull_request'; 136 | process.env['TRAVIS_PULL_REQUEST'] = '123'; 137 | process.env['TRAVIS_PULL_REQUEST_SHA'] = 'ABCSHA'; 138 | 139 | const deleteStub = sinon.stub(FakeGithubController.prototype, 'deletePreviousIssueComments').callsFake((input) => { 140 | expect(input).to.deep.equal({ 141 | number: '123', 142 | botName: 'test-bot' 143 | }); 144 | return Promise.resolve(); 145 | }); 146 | stubs.push(deleteStub); 147 | 148 | const stateStub = sinon.stub(FakeGithubController.prototype, 'postState').callsFake((input) => { 149 | expect(input).to.deep.equal({ 150 | sha: 'ABCSHA', 151 | state: 'success' 152 | }); 153 | return Promise.resolve(); 154 | }); 155 | stubs.push(stateStub); 156 | 157 | const issueStub = sinon.stub(FakeGithubController.prototype, 'postIssueComment').callsFake((input) => { 158 | expect(input).to.deep.equal({ 159 | number: '123', 160 | comment: '### Good Plugin.\n\nThis plugin provided no markdown output.\n\n### Good Plugin 2.\n\n`Hello from good plugin.`\n\n', 161 | }); 162 | return Promise.resolve(); 163 | }); 164 | stubs.push(issueStub); 165 | 166 | const bot = new BotRunner({ 167 | configPath: path.join(__dirname, '../static/example-with-plugin.config.js') 168 | }); 169 | 170 | return bot.run(); 171 | }); 172 | 173 | it('should try to print to Github without deleting previous comments', function() { 174 | process.env['TRAVIS'] = 'true'; 175 | process.env['TRAVIS_EVENT_TYPE'] = 'pull_request'; 176 | process.env['TRAVIS_PULL_REQUEST'] = '123'; 177 | process.env['TRAVIS_PULL_REQUEST_SHA'] = 'ABCSHA'; 178 | 179 | const stateStub = sinon.stub(FakeGithubController.prototype, 'postState').callsFake((input) => { 180 | expect(input).to.deep.equal({ 181 | sha: 'ABCSHA', 182 | state: 'success' 183 | }); 184 | return Promise.resolve(); 185 | }); 186 | stubs.push(stateStub); 187 | 188 | const issueStub = sinon.stub(FakeGithubController.prototype, 'postIssueComment').callsFake((input) => { 189 | expect(input).to.deep.equal({ 190 | number: '123', 191 | comment: '### Good Plugin.\n\nThis plugin provided no markdown output.\n\n### Good Plugin 2.\n\n`Hello from good plugin.`\n\n' 192 | }); 193 | return Promise.resolve(); 194 | }); 195 | stubs.push(issueStub); 196 | 197 | const bot = new BotRunner({ 198 | configPath: path.join(__dirname, '../static/example-with-plugin-no-bot-name.config.js') 199 | }); 200 | 201 | return bot.run(); 202 | }); 203 | 204 | it('should fail the PR', function() { 205 | process.env['TRAVIS'] = 'true'; 206 | process.env['TRAVIS_EVENT_TYPE'] = 'pull_request'; 207 | process.env['TRAVIS_PULL_REQUEST'] = '123'; 208 | process.env['TRAVIS_PULL_REQUEST_SHA'] = 'ABCSHA'; 209 | 210 | const deleteStub = sinon.stub(FakeGithubController.prototype, 'deletePreviousIssueComments').callsFake((input) => { 211 | expect(input).to.deep.equal({ 212 | number: '123', 213 | botName: 'test-bot' 214 | }); 215 | return Promise.resolve(); 216 | }); 217 | stubs.push(deleteStub); 218 | 219 | const stateStub = sinon.stub(FakeGithubController.prototype, 'postState').callsFake((input) => { 220 | expect(input).to.deep.equal({ 221 | sha: 'ABCSHA', 222 | state: 'failure' 223 | }); 224 | return Promise.resolve(); 225 | }); 226 | stubs.push(stateStub); 227 | 228 | const issueStub = sinon.stub(FakeGithubController.prototype, 'postIssueComment').callsFake((input) => { 229 | expect(input).to.deep.equal({ 230 | number: '123', 231 | comment: '### Good Plugin that will fail build.\n\n`Hello from failing build plugin.`\n\n', 232 | }); 233 | return Promise.resolve(); 234 | }); 235 | stubs.push(issueStub); 236 | 237 | const bot = new BotRunner({ 238 | configPath: path.join(__dirname, '../static/example-with-plugin-that-fails-build.js') 239 | }); 240 | 241 | return bot.run(); 242 | }); 243 | 244 | it('should pull from repo when its a Travis PR', function() { 245 | process.env['TRAVIS_PULL_REQUEST_SHA'] = '123'; 246 | 247 | const bot = new BotRunner({ 248 | configPath: path.join(__dirname, '../static/example-with-plugin.config.js') 249 | }); 250 | 251 | return bot.run(); 252 | }); 253 | 254 | it('should handle non-existant config file', function() { 255 | const bot = new BotRunner({ 256 | configPath: path.join(__dirname, '../static/doesnt-exist.config.js') 257 | }); 258 | 259 | return bot.run() 260 | .then(() => { 261 | throw new Error('Expected error to be thrown.'); 262 | }, (err) => { 263 | expect(err.message.indexOf('Unable to find the config file')).to.equal(0); 264 | }); 265 | }); 266 | 267 | it('should handle throwing config file', function() { 268 | const bot = new BotRunner({ 269 | configPath: path.join(__dirname, '../static/throwing.config.js') 270 | }); 271 | 272 | return bot.run() 273 | .then(() => { 274 | throw new Error('Expected error to be thrown.'); 275 | }, (err) => { 276 | expect(err.message.indexOf('A problem occurred running the config file.')).to.equal(0); 277 | }); 278 | }); 279 | 280 | it('should handle non-returning config file', function() { 281 | const bot = new BotRunner({ 282 | configPath: path.join(__dirname, '../static/non-returning.config.js') 283 | }); 284 | 285 | return bot.run() 286 | .then(() => { 287 | throw new Error('Expected error to be thrown.'); 288 | }, (err) => { 289 | expect(err.message).to.equal(`Unable to get the Github 'repoDetails' from Travis environment variable or the configuration file.`); 290 | }); 291 | }); 292 | 293 | it('should be ok building for local folder and tmp master checkout when run locally', function() { 294 | delete process.env['TRAVIS_PULL_REQUEST_SHA']; 295 | 296 | const bot = new BotRunner({ 297 | configPath: path.join(__dirname, '../static/example-with-plugin.config.js') 298 | }); 299 | 300 | return bot.run(); 301 | }); 302 | 303 | it('should checkout the base branch override', function() { 304 | let currentCallNumber = 0; 305 | const CustomBotRunner = proxyquire('../../src/controllers/bot-runner.js', { 306 | './github-controller': FakeGithubController, 307 | 'child_process': { 308 | execSync: (command, options) => { 309 | switch(currentCallNumber) { 310 | case 0: 311 | expect(command.indexOf('git clone http://fake-url.from/fake-github-controller /tmp/pr-bot/')).to.equal(0); 312 | break; 313 | case 1: 314 | expect(command).to.equal('git checkout example-base-branch-override'); 315 | expect(options.cwd.indexOf('/tmp/pr-bot/')).to.equal(0); 316 | break; 317 | case 2: 318 | case 3: 319 | expect(command).to.equal('gulp example-build-rule'); 320 | break; 321 | default: 322 | throw new Error('Unexpected number of execSync calls'); 323 | } 324 | currentCallNumber++; 325 | } 326 | } 327 | }); 328 | 329 | const bot = new CustomBotRunner({ 330 | configPath: path.join(__dirname, '../static/base-branch-override.config.js') 331 | }); 332 | return bot.run() 333 | .then(() => { 334 | if (currentCallNumber !== 4) { 335 | throw new Error('Expected execSync to be called 4 times.'); 336 | } 337 | }); 338 | }); 339 | }); 340 | -------------------------------------------------------------------------------- /test/node/test-travis-env-model.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const expect = require('chai').expect; 17 | const TravisEnvModel = require('../../src/models/travis-env-model'); 18 | 19 | describe('travis-env-model', function() { 20 | it('is not travis', function() { 21 | delete process.env['TRAVIS']; 22 | 23 | const travisEnv = new TravisEnvModel(); 24 | expect(travisEnv.isTravis).to.equal(false); 25 | }); 26 | 27 | it('is travis', function() { 28 | process.env['TRAVIS'] = 'true'; 29 | 30 | const travisEnv = new TravisEnvModel(); 31 | expect(travisEnv.isTravis).to.equal(true); 32 | }); 33 | 34 | it('is not pull request', function() { 35 | delete process.env['TRAVIS_EVENT_TYPE']; 36 | 37 | const travisEnv = new TravisEnvModel(); 38 | expect(travisEnv.isPullRequest).to.equal(false); 39 | }); 40 | 41 | it('is not pull request either', function() { 42 | process.env['TRAVIS_EVENT_TYPE'] = 'push'; 43 | 44 | const travisEnv = new TravisEnvModel(); 45 | expect(travisEnv.isPullRequest).to.equal(false); 46 | }); 47 | 48 | it('is pull request', function() { 49 | process.env['TRAVIS_EVENT_TYPE'] = 'pull_request'; 50 | 51 | const travisEnv = new TravisEnvModel(); 52 | expect(travisEnv.isPullRequest).to.equal(true); 53 | }); 54 | 55 | it('no repo details', function() { 56 | delete process.env['TRAVIS_REPO_SLUG']; 57 | 58 | const travisEnv = new TravisEnvModel(); 59 | expect(travisEnv.repoDetails).to.equal(null); 60 | }); 61 | 62 | it('no repo details either', function() { 63 | process.env['TRAVIS_REPO_SLUG'] = 'example'; 64 | 65 | const travisEnv = new TravisEnvModel(); 66 | expect(travisEnv.repoDetails).to.equal(null); 67 | }); 68 | 69 | it('no repo details as well', function() { 70 | process.env['TRAVIS_REPO_SLUG'] = 'example/example-two/nope'; 71 | 72 | const travisEnv = new TravisEnvModel(); 73 | expect(travisEnv.repoDetails).to.equal(null); 74 | }); 75 | 76 | it('get repo details', function() { 77 | process.env['TRAVIS_REPO_SLUG'] = 'example-owner/example-repo'; 78 | 79 | const travisEnv = new TravisEnvModel(); 80 | expect(travisEnv.repoDetails).to.deep.equal({ 81 | owner: 'example-owner', 82 | repo: 'example-repo', 83 | }); 84 | }); 85 | 86 | it('no PR sha', function() { 87 | delete process.env['TRAVIS_PULL_REQUEST_SHA']; 88 | 89 | const travisEnv = new TravisEnvModel(); 90 | expect(travisEnv.pullRequestSha).to.equal(undefined); 91 | }); 92 | 93 | it('get PR sha', function() { 94 | const injectedSha = '123456789abcde'; 95 | process.env['TRAVIS_PULL_REQUEST_SHA'] = injectedSha; 96 | 97 | const travisEnv = new TravisEnvModel(); 98 | expect(travisEnv.pullRequestSha).to.equal(injectedSha); 99 | }); 100 | 101 | it('no PR number', function() { 102 | delete process.env['TRAVIS_PULL_REQUEST']; 103 | 104 | const travisEnv = new TravisEnvModel(); 105 | expect(travisEnv.pullRequestNumber).to.equal(undefined); 106 | }); 107 | 108 | it('get PR number', function() { 109 | const injectedPR = '123456'; 110 | process.env['TRAVIS_PULL_REQUEST'] = injectedPR; 111 | 112 | const travisEnv = new TravisEnvModel(); 113 | expect(travisEnv.pullRequestNumber).to.equal(injectedPR); 114 | }); 115 | 116 | it('no test results', function() { 117 | delete process.env['TRAVIS_TEST_RESULT']; 118 | 119 | const travisEnv = new TravisEnvModel(); 120 | expect(travisEnv.isSuccessfulTravisRun).to.equal(undefined); 121 | }); 122 | 123 | it('bad test results', function() { 124 | process.env['TRAVIS_TEST_RESULT'] = '1'; 125 | 126 | const travisEnv = new TravisEnvModel(); 127 | expect(travisEnv.isSuccessfulTravisRun).to.equal(false); 128 | }); 129 | 130 | it('good test results', function() { 131 | process.env['TRAVIS_TEST_RESULT'] = '0'; 132 | 133 | const travisEnv = new TravisEnvModel(); 134 | expect(travisEnv.isSuccessfulTravisRun).to.equal(true); 135 | }); 136 | 137 | it('should return undefined for no git branch', function() { 138 | delete process.env['TRAVIS_BRANCH']; 139 | 140 | const travisEnv = new TravisEnvModel(); 141 | expect(travisEnv.gitBranch).to.equal(undefined); 142 | }); 143 | 144 | it('should return git branch', function() { 145 | const branch = 'my-random-branch'; 146 | process.env['TRAVIS_BRANCH'] = branch; 147 | 148 | const travisEnv = new TravisEnvModel(); 149 | expect(travisEnv.gitBranch).to.equal(branch); 150 | }); 151 | 152 | it('should return undefined for PR num', function() { 153 | delete process.env['TRAVIS_PULL_REQUEST']; 154 | 155 | const travisEnv = new TravisEnvModel(); 156 | expect(travisEnv.pullRequestNumber).to.equal(undefined); 157 | }); 158 | 159 | it('should return undefined for PR num === false', function() { 160 | process.env['TRAVIS_PULL_REQUEST'] = 'false'; 161 | 162 | const travisEnv = new TravisEnvModel(); 163 | expect(travisEnv.pullRequestNumber).to.equal(undefined); 164 | }); 165 | 166 | it('should return the PR num', function() { 167 | const prNum = '123'; 168 | process.env['TRAVIS_PULL_REQUEST'] = prNum; 169 | 170 | const travisEnv = new TravisEnvModel(); 171 | expect(travisEnv.pullRequestNumber).to.equal(prNum); 172 | }); 173 | }); 174 | -------------------------------------------------------------------------------- /test/node/utils/test-log-helper.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const logHelper = require('../../../src/utils/log-helper'); 17 | describe('LogHelper', function() { 18 | it('should warn', function() { 19 | logHelper.warn('Warning.'); 20 | }); 21 | 22 | it('should print key value pairs', function() { 23 | logHelper.logKeyValues({ 24 | 'Example': 'Example Value', 25 | 'a': 'Short Value', 26 | }); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /test/static/bad-plugin.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | buildCommand: 'echo "Im such a bad build command."', 20 | repoDetails: { 21 | owner: 'example-owner', 22 | repo: 'example-repo', 23 | }, 24 | plugins: [ 25 | { 26 | name: 'Bad Plugin will Error.', 27 | run: () => { 28 | return Promise.reject(new Error('Inject Error')); 29 | }, 30 | } 31 | ] 32 | }; 33 | -------------------------------------------------------------------------------- /test/static/base-branch-override.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | overrideBaseBranch: 'example-base-branch-override', 20 | buildCommand: 'gulp example-build-rule', 21 | repoDetails: { 22 | owner: 'example-owner', 23 | repo: 'example-repo', 24 | }, 25 | plugins: [] 26 | }; 27 | -------------------------------------------------------------------------------- /test/static/example-with-plugin-no-bot-name.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | repoDetails: { 20 | owner: 'example-owner', 21 | repo: 'example-repo', 22 | }, 23 | plugins: [ 24 | { 25 | name: 'Good Plugin.', 26 | run: () => { 27 | return Promise.resolve({ 28 | 29 | }); 30 | }, 31 | }, 32 | { 33 | name: 'Good Plugin 2.', 34 | run: () => { 35 | return Promise.resolve({ 36 | prettyLog: 'Hello from good plugin.', 37 | markdownLog: '`Hello from good plugin.`' 38 | }); 39 | }, 40 | } 41 | ] 42 | }; 43 | -------------------------------------------------------------------------------- /test/static/example-with-plugin-that-fails-build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | botUsername: 'test-bot', 20 | repoDetails: { 21 | owner: 'example-owner', 22 | repo: 'example-repo', 23 | }, 24 | plugins: [ 25 | { 26 | name: 'Good Plugin that will fail build.', 27 | run: () => { 28 | return Promise.resolve({ 29 | failPR: true, 30 | prettyLog: 'Hello from failing build plugin.', 31 | markdownLog: '`Hello from failing build plugin.`' 32 | }); 33 | }, 34 | } 35 | ] 36 | }; 37 | -------------------------------------------------------------------------------- /test/static/example-with-plugin.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | botUsername: 'test-bot', 20 | repoDetails: { 21 | owner: 'example-owner', 22 | repo: 'example-repo', 23 | }, 24 | plugins: [ 25 | { 26 | name: 'Good Plugin.', 27 | run: () => { 28 | return Promise.resolve({ 29 | 30 | }); 31 | }, 32 | }, 33 | { 34 | name: 'Good Plugin 2.', 35 | run: () => { 36 | return Promise.resolve({ 37 | failPR: false, 38 | prettyLog: 'Hello from good plugin.', 39 | markdownLog: '`Hello from good plugin.`' 40 | }); 41 | }, 42 | } 43 | ] 44 | }; 45 | -------------------------------------------------------------------------------- /test/static/example.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | repoDetails: { 20 | owner: 'example-owner', 21 | repo: 'example-repo', 22 | }, 23 | plugins: [] 24 | }; 25 | -------------------------------------------------------------------------------- /test/static/no-plugin-name.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | repoDetails: { 20 | owner: 'example-owner', 21 | repo: 'example-repo', 22 | }, 23 | plugins: [ 24 | { 25 | run: () => { 26 | return Promise.resolve(); 27 | }, 28 | } 29 | ] 30 | }; 31 | -------------------------------------------------------------------------------- /test/static/no-repo-details.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | const travisbot = require('../../src/npm-module.js'); 17 | 18 | module.exports = { 19 | plugins: [] 20 | }; 21 | -------------------------------------------------------------------------------- /test/static/non-returning.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | console.log('This file will expose no module export.'); 17 | -------------------------------------------------------------------------------- /test/static/size-example-after/content-to-empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-after/content-to-empty.txt -------------------------------------------------------------------------------- /test/static/size-example-after/dino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-after/dino.jpg -------------------------------------------------------------------------------- /test/static/size-example-after/empty-to-content.txt: -------------------------------------------------------------------------------- 1 | Hello From File 2 - This is new text. 2 | -------------------------------------------------------------------------------- /test/static/size-example-after/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-after/empty.txt -------------------------------------------------------------------------------- /test/static/size-example-after/minor-change.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras auctor libero vitae elementum volutpat. Ut porta dapibus accumsan. Donec id massa ac nunc placerat dignissim. Proin vulputate tincidunt odio et dignissim. Phasellus vel porttitor massa, varius tincidunt nisl. Fusce ornare mauris sit amet odio cursus, sed tincidunt velit porttitor. Curabitur congue, lorem vel sollicitudin hendrerit, justo nisl posuere quam, eget euismod est ex eget enim. In molestie sapien sit amet purus iaculis, eget viverra dui scelerisque. Sed pulvinar libero nec urna bibendum finibus. Nulla elementum auctor molestie. Vestibulum et magna at ante luctus scelerisque. Suspendisse imperdiet erat nec purus mattis, at euismod mauris porta. Aenean non nisi vel turpis semper aliquam. Praesent dui ipsum, congue eget sollicitudin id, tincidunt non nisl. 2 | 3 | Praesent odio nisl, tempor nec nisl feugiat, accumsan scelerisque augue. Sed sollicitudin feugiat justo. Vivamus at auctor purus. Vivamus ut lacus sed augue varius pulvinar. Donec id nunc vel massa sollicitudin vehicula. In luctus ex sit amet eros dignissim, vel venenatis risus molestie. Quisque hendrerit justo id nibh finibus suscipit. Morbi venenatis efficitur malesuada. 4 | 5 | Proin quis diam massa. In posuere ligula et lacinia finibus. Morbi sit amet molestie urna, a porttitor turpis. Integer interdum commodo libero eget euismod. Fusce commodo massa sit amet pretium luctus. Fusce vitae nibh at nisi elementum accumsan. Sed sit amet metus accumsan, pellentesque risus vitae, tincidunt leo. Proin aliquet, ante ac faciisis malesuada, justo elit interdum metus, sit amet sagittis quam est ac ligula. Aenean nisi est, lobortis nec tristique ultrices, mollis in urna. Fusce ac lorem urna. Sed eros magna, tempus non urna at, pulvinar faucibus mi. Phasellus viverra pharetra purus vel porta. Nulla sed eros eu ante scelerisque efficitur. 6 | 7 | Nunc ut sapien augue. Nullam at elit sit amet nunc pretium tristique sed vel ligula. Sed nec euismod diam. Nam sodales ex id aliquet ultrices. Mauris euismod elementum eros, sit amet semper diam iaculis vel. Etiam id volutpat nisi. Cras tortor felis, euismod rutrum urna ut, accumsan viverra dolor. Phasellus rhoncus elit at neque rhoncus consequat. In ex augue, malesuada ut ipsum a, hendrerit maximus erat. Duis faucibus varius sodales. Maecenas ut leo at nulla semper blandit. Proin eros lectus, vestibulum ac molestie tempus, fringilla a massa. Fusce pretium euismod tellus vel iaculis. Aliquam imperdiet tincidunt tortor id rhoncus. Sed dictum condimentum ex, vel malesuada elit viverra nec. Nunc non augue non tortor viverra aliquet eu sit amet ante. 8 | 9 | In bibendum lectus iaculis nisl vehicula, id tincidunt mi sodales. Nunc a nisl non elit luctus mattis. Duis pulvinar orci in hendrerit mattis. Duis in nisi tortor. Maecenas sapien dolor, sollicitudin eu iaculis vel, sollicitudin vel lectus. Nulla gravida lectus eu nunc rhoncus, quis imperdiet felis viverra. Ut dignissim, quam eu tristique sagittis, magna magna hendrerit urna, vitae pharetra enim neque vel nisi. Proin congue, sapien nec tempus iaculis, odio massa ultricies odio, vitae feugiat turpis purus id elit. Nunc vel tincidunt turpis. Aliquam luctus, sem ac viverra dignissim, augue metus venenatis ex, nec viverra erat massa imperdiet nisi. Fusce pellentesque nunc sit amet neque varius, nec facilisis augue iaculis. Phasellus mollis quam sit amet justo condimentum, et scelerisque elit elementum. In hac habitasse platea dictumst. In nec quam posuere, ornare odio ut, egestas urna. 10 | 11 | Etiam non felis pharetra, ultricies est sit amet, bibendum dui. Mauris accumsan, urna vitae gravida aliquam, ex purus pulvinar dolor, at lobortis leo nibh vitae erat. Vestibulum lacinia sem nulla, nec interdum dui malesuada eget. Curabitur venenatis nibh quis lacinia pellentesque. Sed condimentum elit ante, eu laoreet lectus rutrum ut. In venenatis mi lacus, sed auctor tortor auctor nec. Sed a justo ac ipsum finibus pulvinar. In id justo maximus, tempor quam vel, congue leo. Curabitur ipsum dolor, placerat eget nibh quis, volutpat facilisis nibh. 12 | 13 | Nullam malesuada dui sapien, a suscipit lectus blandit tincidunt. Phasellus magna mi, pretium ut eros vitae, interdum viverra risus. Sed dignissim commodo ultricies. Phasellus condimentum convallis faucibus. Vivamus feugiat turpis vitae erat dapibus, vitae aliquam felis aliquet. In venenatis ligula lorem, nec vestibulum metus molestie egestas. Ut vitae volutpat nulla. Pellentesque pretium arcu sit amet rhoncus sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi at vehicula velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque porttitor, tellus sit amet finibus fermentum, risus mauris venenatis elit, quis rhoncus tortor justo eu lacus. Nunc eros ante, consectetur et eros a, consequat scelerisque sem. Donec id eros tincidunt, aliquet ex nec, rhoncus urna. Vestibulum a lacinia felis. 14 | 15 | Mauris dictum quam sit amet quam tempor, vitae auctor tellus lobortis. Pellentesque nec pulvinar orci. Proin in tortor vel massa malesuada commodo. Aenean at mollis justo. Mauris porta metus nisi, eget convallis metus cursus eget. Aenean quis ex sed dolor fringilla laoreet at sed arcu. Etiam in nisl in sapien pretium convallis a ac ligula. Nulla eget ornare velit. Nulla tincidunt convallis massa vulputate feugiat. Donec commodo pulvinar justo, ut porttitor turpis suscipit non. Nullam dignissim accumsan mauris, id vulputate odio interdum quis. Phasellus consectetur eleifend nunc. Maecenas luctus augue sit amet porttitor consequat. Fusce congue est quis justo blandit, at consequat diam varius. 16 | 17 | Nullam sit amet tempus metus, eu condimentum ante. Aliquam erat massa, facilisis non vestibulum eu, dictum ac dolor. Suspendisse potenti. Curabitur vitae semper libero. Vestibulum ut porta tortor. Fusce nibh leo, pellentesque sit amet aliquet accumsan, egestas in magna. Proin consectetur purus id nulla bibendum mollis. Duis bibendum ornare mauris venenatis pharetra. In ullamcorper suscipit nisi, quis laoreet tortor placerat a. Vestibulum id cursus velit. Mauris lobortis, erat vitae mollis gravida, lectus nulla suscipit lorem, ut viverra massa velit ut quam. In rhoncus condimentum dolor, vel tristique ligula pellentesque sit amet. In porttitor diam quis posuere dictum. Morbi gravida eros quis ipsum elementum, non malesuada lorem porta. Sed consectetur condimentum lacus, et sagittis ipsum volutpat quis. Nunc auctor urna sed lacus ultricies ultrices. 18 | 19 | Integer eu mi non sapien consectetur molestie id sed leo. Cras cursus massa sit amet dui interdum laoreet. Cras ut aliquam velit. Suspendisse posuere arcu dui, non pulvinar enim volutpat eget. Vivamus eget sem lacus. In scelerisque fermentum nisl at tincidunt. Vivamus ultricies lacinia ante, sed auctor magna sollicitudin in. Pellentesque ut quam in lectus eleifend venenatis. Nam fringilla nisl a blandit hendrerit. Vivamus sit amet ornare elit. Proin tristique sapien vitae velit maximus egestas. Vivamus massa dolor, pulvinar ullamcorper cursus at, efficitur quis sem. 20 | -------------------------------------------------------------------------------- /test/static/size-example-after/new-file.txt: -------------------------------------------------------------------------------- 1 | Completely new file. 2 | -------------------------------------------------------------------------------- /test/static/size-example-after/stays-the-same.txt: -------------------------------------------------------------------------------- 1 | This file has some contents. And now it has more. 2 | -------------------------------------------------------------------------------- /test/static/size-example-before/content-to-empty.txt: -------------------------------------------------------------------------------- 1 | This text will be removed after. 2 | 3 | All of it. 4 | -------------------------------------------------------------------------------- /test/static/size-example-before/deleted-file.txt: -------------------------------------------------------------------------------- 1 | This file has some contents. 2 | -------------------------------------------------------------------------------- /test/static/size-example-before/dino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-before/dino.jpg -------------------------------------------------------------------------------- /test/static/size-example-before/empty-to-content.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-before/empty-to-content.txt -------------------------------------------------------------------------------- /test/static/size-example-before/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoogleChromeLabs/pr-bot/88c9ca265ee66ccbd8a3c36592853611126dbb70/test/static/size-example-before/empty.txt -------------------------------------------------------------------------------- /test/static/size-example-before/minor-change.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras auctor libero vitae elementum volutpat. Ut porta dapibus accumsan. Donec id massa ac nunc placerat dignissim. Proin vulputate tincidunt odio et dignissim. Phasellus vel porttitor massa, varius tincidunt nisl. Fusce ornare mauris sit amet odio cursus, sed tincidunt velit porttitor. Curabitur congue, lorem vel sollicitudin hendrerit, justo nisl posuere quam, eget euismod est ex eget enim. In molestie sapien sit amet purus iaculis, eget viverra dui scelerisque. Sed pulvinar libero nec urna bibendum finibus. Nulla elementum auctor molestie. Vestibulum et magna at ante luctus scelerisque. Suspendisse imperdiet erat nec purus mattis, at euismod mauris porta. Aenean non nisi vel turpis semper aliquam. Praesent dui ipsum, congue eget sollicitudin id, tincidunt non nisl. 2 | 3 | Praesent odio nisl, tempor nec nisl feugiat, accumsan scelerisque augue. Sed sollicitudin feugiat justo. Vivamus at auctor purus. Vivamus ut lacus sed augue varius pulvinar. Donec id nunc vel massa sollicitudin vehicula. In luctus ex sit amet eros dignissim, vel venenatis risus molestie. Quisque hendrerit justo id nibh finibus suscipit. Morbi venenatis efficitur malesuada. 4 | 5 | Proin quis diam massa. In posuere ligula et lacinia finibus. Morbi sit amet molestie urna, a porttitor turpis. Integer interdum commodo libero eget euismod. Fusce commodo massa sit amet pretium luctus. Fusce vitae nibh at nisi elementum accumsan. Sed sit amet metus accumsan, pellentesque risus vitae, tincidunt leo. Proin aliquet, ante ac facilisis malesuada, justo elit interdum metus, sit amet sagittis quam est ac ligula. Aenean nisi est, lobortis nec tristique ultrices, mollis in urna. Fusce ac lorem urna. Sed eros magna, tempus non urna at, pulvinar faucibus mi. Phasellus viverra pharetra purus vel porta. Nulla sed eros eu ante scelerisque efficitur. 6 | 7 | Nunc ut sapien augue. Nullam at elit sit amet nunc pretium tristique sed vel ligula. Sed nec euismod diam. Nam sodales ex id aliquet ultrices. Mauris euismod elementum eros, sit amet semper diam iaculis vel. Etiam id volutpat nisi. Cras tortor felis, euismod rutrum urna ut, accumsan viverra dolor. Phasellus rhoncus elit at neque rhoncus consequat. In ex augue, malesuada ut ipsum a, hendrerit maximus erat. Duis faucibus varius sodales. Maecenas ut leo at nulla semper blandit. Proin eros lectus, vestibulum ac molestie tempus, fringilla a massa. Fusce pretium euismod tellus vel iaculis. Aliquam imperdiet tincidunt tortor id rhoncus. Sed dictum condimentum ex, vel malesuada elit viverra nec. Nunc non augue non tortor viverra aliquet eu sit amet ante. 8 | 9 | In bibendum lectus iaculis nisl vehicula, id tincidunt mi sodales. Nunc a nisl non elit luctus mattis. Duis pulvinar orci in hendrerit mattis. Duis in nisi tortor. Maecenas sapien dolor, sollicitudin eu iaculis vel, sollicitudin vel lectus. Nulla gravida lectus eu nunc rhoncus, quis imperdiet felis viverra. Ut dignissim, quam eu tristique sagittis, magna magna hendrerit urna, vitae pharetra enim neque vel nisi. Proin congue, sapien nec tempus iaculis, odio massa ultricies odio, vitae feugiat turpis purus id elit. Nunc vel tincidunt turpis. Aliquam luctus, sem ac viverra dignissim, augue metus venenatis ex, nec viverra erat massa imperdiet nisi. Fusce pellentesque nunc sit amet neque varius, nec facilisis augue iaculis. Phasellus mollis quam sit amet justo condimentum, et scelerisque elit elementum. In hac habitasse platea dictumst. In nec quam posuere, ornare odio ut, egestas urna. 10 | 11 | Etiam non felis pharetra, ultricies est sit amet, bibendum dui. Mauris accumsan, urna vitae gravida aliquam, ex purus pulvinar dolor, at lobortis leo nibh vitae erat. Vestibulum lacinia sem nulla, nec interdum dui malesuada eget. Curabitur venenatis nibh quis lacinia pellentesque. Sed condimentum elit ante, eu laoreet lectus rutrum ut. In venenatis mi lacus, sed auctor tortor auctor nec. Sed a justo ac ipsum finibus pulvinar. In id justo maximus, tempor quam vel, congue leo. Curabitur ipsum dolor, placerat eget nibh quis, volutpat facilisis nibh. 12 | 13 | Nullam malesuada dui sapien, a suscipit lectus blandit tincidunt. Phasellus magna mi, pretium ut eros vitae, interdum viverra risus. Sed dignissim commodo ultricies. Phasellus condimentum convallis faucibus. Vivamus feugiat turpis vitae erat dapibus, vitae aliquam felis aliquet. In venenatis ligula lorem, nec vestibulum metus molestie egestas. Ut vitae volutpat nulla. Pellentesque pretium arcu sit amet rhoncus sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi at vehicula velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque porttitor, tellus sit amet finibus fermentum, risus mauris venenatis elit, quis rhoncus tortor justo eu lacus. Nunc eros ante, consectetur et eros a, consequat scelerisque sem. Donec id eros tincidunt, aliquet ex nec, rhoncus urna. Vestibulum a lacinia felis. 14 | 15 | Mauris dictum quam sit amet quam tempor, vitae auctor tellus lobortis. Pellentesque nec pulvinar orci. Proin in tortor vel massa malesuada commodo. Aenean at mollis justo. Mauris porta metus nisi, eget convallis metus cursus eget. Aenean quis ex sed dolor fringilla laoreet at sed arcu. Etiam in nisl in sapien pretium convallis a ac ligula. Nulla eget ornare velit. Nulla tincidunt convallis massa vulputate feugiat. Donec commodo pulvinar justo, ut porttitor turpis suscipit non. Nullam dignissim accumsan mauris, id vulputate odio interdum quis. Phasellus consectetur eleifend nunc. Maecenas luctus augue sit amet porttitor consequat. Fusce congue est quis justo blandit, at consequat diam varius. 16 | 17 | Nullam sit amet tempus metus, eu condimentum ante. Aliquam erat massa, facilisis non vestibulum eu, dictum ac dolor. Suspendisse potenti. Curabitur vitae semper libero. Vestibulum ut porta tortor. Fusce nibh leo, pellentesque sit amet aliquet accumsan, egestas in magna. Proin consectetur purus id nulla bibendum mollis. Duis bibendum ornare mauris venenatis pharetra. In ullamcorper suscipit nisi, quis laoreet tortor placerat a. Vestibulum id cursus velit. Mauris lobortis, erat vitae mollis gravida, lectus nulla suscipit lorem, ut viverra massa velit ut quam. In rhoncus condimentum dolor, vel tristique ligula pellentesque sit amet. In porttitor diam quis posuere dictum. Morbi gravida eros quis ipsum elementum, non malesuada lorem porta. Sed consectetur condimentum lacus, et sagittis ipsum volutpat quis. Nunc auctor urna sed lacus ultricies ultrices. 18 | 19 | Integer eu mi non sapien consectetur molestie id sed leo. Cras cursus massa sit amet dui interdum laoreet. Cras ut aliquam velit. Suspendisse posuere arcu dui, non pulvinar enim volutpat eget. Vivamus eget sem lacus. In scelerisque fermentum nisl at tincidunt. Vivamus ultricies lacinia ante, sed auctor magna sollicitudin in. Pellentesque ut quam in lectus eleifend venenatis. Nam fringilla nisl a blandit hendrerit. Vivamus sit amet ornare elit. Proin tristique sapien vitae velit maximus egestas. Vivamus massa dolor, pulvinar ullamcorper cursus at, efficitur quis sem. 20 | -------------------------------------------------------------------------------- /test/static/size-example-before/stays-the-same.txt: -------------------------------------------------------------------------------- 1 | This file has some contents. 2 | -------------------------------------------------------------------------------- /test/static/throwing.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | throw new Error('Try and get this export.'); 17 | 18 | module.exports = {}; 19 | --------------------------------------------------------------------------------