├── .clang-format ├── .github └── workflows │ ├── ci.yml │ └── lh-smoke.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── bin └── print-chrome-path.cjs ├── changelog.md ├── chrome-launcher └── index.js ├── compiled-check.js ├── contributing.md ├── docs └── chrome-flags-for-tools.md ├── manual-chrome-launcher.js ├── package.json ├── scripts ├── download-chrome.sh └── format.sh ├── src ├── chrome-finder.ts ├── chrome-launcher.ts ├── flags.ts ├── index.ts ├── random-port.ts └── utils.ts ├── test ├── check-formatting.sh ├── chrome-launcher-test.ts ├── chrome_extension_fixture │ ├── background.js │ ├── contentscript.js │ └── manifest.json ├── launch-signature-test.ts ├── load-extension-test.ts ├── random-port-test.ts ├── run-tests.sh ├── tsconfig.json └── utils-test.ts ├── tsconfig.json └── yarn.lock /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | Language: JavaScript 4 | ColumnLimit: 100 5 | ReflowComments: false 6 | SpacesBeforeTrailingComments: 1 7 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: 🛠 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: # run on all PRs, not just PRs to a particular branch 7 | 8 | jobs: 9 | basics: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node: [ 'latest', 'lts/*', 'lts/-1' ] 14 | name: basics (node ${{ matrix.node }}) 15 | 16 | steps: 17 | - name: git clone 18 | uses: actions/checkout@v3 19 | 20 | - name: Setup node 21 | uses: actions/setup-node@v3 22 | with: 23 | node-version: ${{ matrix.node }} 24 | cache: 'yarn' 25 | 26 | - run: yarn --frozen-lockfile --network-timeout 1000000 27 | - run: yarn build 28 | 29 | - run: yarn test-formatting 30 | - run: yarn type-check 31 | 32 | # Run tests that require headful Chrome. 33 | - run: sudo apt-get install xvfb 34 | - name: yarn test 35 | run: xvfb-run --auto-servernum yarn test --reporter=spec 36 | 37 | unit: 38 | strategy: 39 | matrix: 40 | os: [macos-latest, windows-latest] 41 | runs-on: ${{ matrix.os }} 42 | name: unit_${{ matrix.os }} 43 | 44 | steps: 45 | - name: git clone 46 | uses: actions/checkout@v3 47 | 48 | - name: Use Node.js 49 | uses: actions/setup-node@v3 50 | with: 51 | node-version: lts/* 52 | cache: 'yarn' 53 | 54 | - run: yarn --frozen-lockfile --network-timeout 1000000 55 | - run: yarn build 56 | - run: yarn test --reporter=spec 57 | -------------------------------------------------------------------------------- /.github/workflows/lh-smoke.yml: -------------------------------------------------------------------------------- 1 | name: smoke 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: # run on all PRs, not just PRs to a particular branch 7 | 8 | jobs: 9 | # Only run smoke tests for windows against stable chrome. 10 | lh-smoke-windows: 11 | strategy: 12 | matrix: 13 | smoke-test-shard: [1, 2] 14 | # e.g. if set 1 fails, continue with set 2 anyway 15 | fail-fast: false 16 | runs-on: windows-latest 17 | name: Windows smoke ${{ matrix.smoke-test-shard }}/2 18 | 19 | steps: 20 | - name: git clone 21 | uses: actions/checkout@v3 22 | 23 | - name: Use Node.js 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: lts/* 27 | cache: 'yarn' 28 | 29 | # chrome-launcher 30 | # This'll add lighthouse AND install chrome-launcher's deps 31 | - run: yarn add --frozen-lockfile --network-timeout 1000000 -D https://github.com/GoogleChrome/lighthouse.git#main 32 | - run: yarn build 33 | 34 | # lighthouse 35 | - run: yarn --cwd node_modules/lighthouse/ install --frozen-lockfile --network-timeout 1000000 36 | - run: yarn reset-link 37 | - run: yarn --cwd node_modules/lighthouse/ build-report 38 | 39 | - name: Run smoke tests 40 | # Windows bots are slow, so only run enough tests to verify matching behavior. 41 | run: yarn --cwd node_modules/lighthouse/ smoke --debug -j=2 --retries=5 --shard=${{ matrix.smoke-test-shard }}/2 dbw oopif offline lantern metrics 42 | 43 | - name: Upload failures 44 | if: failure() 45 | uses: actions/upload-artifact@v4 46 | with: 47 | name: Smokehouse (windows) 48 | path: node_modules/lighthouse/.tmp/smokehouse-ci-failures/ 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # folders 2 | .vscode/ 3 | test/ 4 | 5 | # dev files 6 | .appveyor.yml 7 | .editorconfig 8 | .eslintignore 9 | .eslintrc.js 10 | .travis.yml 11 | gulpfile.js 12 | 13 | # ignore TypeScript source files 14 | src/ 15 | 16 | # allow JS & TypeScript declaration files 17 | !dist/ 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2014 Google Inc. 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chrome Launcher [![GitHub Actions Status Badge](https://github.com/GoogleChrome/chrome-launcher/workflows/🛠/badge.svg)](https://github.com/GoogleChrome/chrome-launcher/actions) [![NPM chrome-launcher package](https://img.shields.io/npm/v/chrome-launcher.svg)](https://npmjs.org/package/chrome-launcher) 2 | 3 | 4 | 5 | Launch Google Chrome with ease from node. 6 | 7 | * [Disables many Chrome services](https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts) that add noise to automated scenarios 8 | * Opens up the browser's `remote-debugging-port` on an available port 9 | * Automagically locates a Chrome binary to launch 10 | * Uses a fresh Chrome profile for each launch, and cleans itself up on `kill()` 11 | * Binds `Ctrl-C` (by default) to terminate the Chrome process 12 | * Exposes a small set of [options](#api) for configurability over these details 13 | 14 | Once launched, interacting with the browser must be done over the [devtools protocol](https://chromedevtools.github.io/devtools-protocol/), typically via [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface/). For many cases [Puppeteer](https://github.com/GoogleChrome/puppeteer) is recommended, though it has its own chrome launching mechanism. 15 | 16 | ### Installing 17 | 18 | ```sh 19 | yarn add chrome-launcher 20 | 21 | # or with npm: 22 | npm install chrome-launcher 23 | ``` 24 | 25 | 26 | ## API 27 | 28 | ### `.launch([opts])` 29 | 30 | #### Launch options 31 | 32 | ```js 33 | { 34 | // (optional) remote debugging port number to use. If provided port is already busy, launch() will reject 35 | // Default: an available port is autoselected 36 | port: number; 37 | 38 | // (optional) When `port` is specified *and* no Chrome is found at that port, 39 | // * if `false` (default), chrome-launcher will launch a new Chrome with that port. 40 | // * if `true`, throw an error 41 | // This option is useful when you wish to explicitly connect to a running Chrome, such as on a mobile device via adb 42 | // Default: false 43 | portStrictMode: boolean; 44 | 45 | // (optional) Additional flags to pass to Chrome, for example: ['--headless', '--disable-gpu'] 46 | // See: https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md 47 | // Do note, many flags are set by default: https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts 48 | chromeFlags: Array; 49 | 50 | // (optional) Additional preferences to be set in Chrome, for example: {'download.default_directory': __dirname} 51 | // See: https://chromium.googlesource.com/chromium/src/+/main/chrome/common/pref_names.cc 52 | // Do note, if you set preferences when using your default profile it will overwrite these 53 | prefs: {[key: string]: Object}; 54 | 55 | // (optional) Close the Chrome process on `Ctrl-C` 56 | // Default: true 57 | handleSIGINT: boolean; 58 | 59 | // (optional) Explicit path of intended Chrome binary 60 |  // * If this `chromePath` option is defined, it will be used. 61 | // * Otherwise, the `CHROME_PATH` env variable will be used if set. (`LIGHTHOUSE_CHROMIUM_PATH` is deprecated) 62 |  // * Otherwise, a detected Chrome Canary will be used if found 63 | // * Otherwise, a detected Chrome (stable) will be used 64 | chromePath: string; 65 | 66 | // (optional) Chrome profile path to use, if set to `false` then the default profile will be used. 67 | // By default, a fresh Chrome profile will be created 68 | userDataDir: string | boolean; 69 | 70 | // (optional) Starting URL to open the browser with 71 | // Default: `about:blank` 72 | startingUrl: string; 73 | 74 | // (optional) Logging level 75 | // Default: 'silent' 76 | logLevel: 'verbose'|'info'|'error'|'silent'; 77 | 78 | // (optional) Flags specific in [flags.ts](src/flags.ts) will not be included. 79 | // Typically used with the defaultFlags() method and chromeFlags option. 80 | // Default: false 81 | ignoreDefaultFlags: boolean; 82 | 83 | // (optional) Interval in ms, which defines how often launcher checks browser port to be ready. 84 | // Default: 500 85 | connectionPollInterval: number; 86 | 87 | // (optional) A number of retries, before browser launch considered unsuccessful. 88 | // Default: 50 89 | maxConnectionRetries: number; 90 | 91 | // (optional) A dict of environmental key value pairs to pass to the spawned chrome process. 92 | envVars: {[key: string]: string}; 93 | }; 94 | ``` 95 | 96 | #### Launched chrome interface 97 | 98 | #### `.launch().then(chrome => ...` 99 | 100 | ```js 101 | // The remote debugging port exposed by the launched chrome 102 | chrome.port: number; 103 | 104 | // Method to kill Chrome (and cleanup the profile folder) 105 | chrome.kill: () => Promise; 106 | 107 | // The process id 108 | chrome.pid: number; 109 | 110 | // The childProcess object for the launched Chrome 111 | chrome.process: childProcess 112 | 113 | // If chromeFlags contains --remote-debugging-pipe. Otherwise remoteDebuggingPipes is null. 114 | chrome.remoteDebuggingPipes.incoming: ReadableStream 115 | chrome.remoteDebuggingPipes.outgoing: WritableStream 116 | ``` 117 | 118 | When `--remote-debugging-pipe` is passed via `chromeFlags`, then `port` will be 119 | unusable (0) by default. Instead, debugging messages are exchanged via 120 | `remoteDebuggingPipes.incoming` and `remoteDebuggingPipes.outgoing`. The data 121 | in these pipes are JSON values terminated by a NULL byte (`\x00`). 122 | Data written to `remoteDebuggingPipes.outgoing` are sent to Chrome, 123 | data read from `remoteDebuggingPipes.incoming` are received from Chrome. 124 | 125 | ### `ChromeLauncher.Launcher.defaultFlags()` 126 | 127 | Returns an `Array` of the default [flags](docs/chrome-flags-for-tools.md) Chrome is launched with. Typically used along with the `ignoreDefaultFlags` and `chromeFlags` options. 128 | 129 | Note: This array will exclude the following flags: `--remote-debugging-port` `--disable-setuid-sandbox` `--user-data-dir`. 130 | 131 | ### `ChromeLauncher.Launcher.getInstallations()` 132 | 133 | Returns an `Array` of paths to available Chrome installations. When `chromePath` is not provided to `.launch()`, the first installation returned from this method is used instead. 134 | 135 | Note: This method performs synchronous I/O operations. 136 | 137 | ### `.killAll()` 138 | 139 | Attempts to kill all Chrome instances created with [`.launch([opts])`](#launchopts). Returns a Promise that resolves to an array of errors that occurred while killing instances. If all instances were killed successfully, the array will be empty. 140 | 141 | ```js 142 | import * as ChromeLauncher from 'chrome-launcher'; 143 | 144 | async function cleanup() { 145 | await ChromeLauncher.killAll(); 146 | } 147 | ``` 148 | 149 | ## Examples 150 | 151 | #### Launching chrome: 152 | 153 | ```js 154 | import * as ChromeLauncher from 'chrome-launcher'; 155 | 156 | ChromeLauncher.launch({ 157 | startingUrl: 'https://google.com' 158 | }).then(chrome => { 159 | console.log(`Chrome debugging port running on ${chrome.port}`); 160 | }); 161 | ``` 162 | 163 | 164 | #### Launching headless chrome: 165 | 166 | ```js 167 | import * as ChromeLauncher from 'chrome-launcher'; 168 | 169 | ChromeLauncher.launch({ 170 | startingUrl: 'https://google.com', 171 | chromeFlags: ['--headless', '--disable-gpu'] 172 | }).then(chrome => { 173 | console.log(`Chrome debugging port running on ${chrome.port}`); 174 | }); 175 | ``` 176 | 177 | #### Launching with support for extensions and audio: 178 | 179 | ```js 180 | import * as ChromeLauncher from 'chrome-launcher'; 181 | 182 | const newFlags = ChromeLauncher.Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions' && flag !== '--mute-audio'); 183 | 184 | ChromeLauncher.launch({ 185 | ignoreDefaultFlags: true, 186 | chromeFlags: newFlags, 187 | }).then(chrome => { ... }); 188 | ``` 189 | 190 | To programatically load an extension at runtime, use `--remote-debugging-pipe` 191 | as shown in [test/load-extension-test.ts](test/load-extension-test.ts). 192 | 193 | ### Continuous Integration 194 | 195 | In a CI environment like Travis, Chrome may not be installed. If you want to use `chrome-launcher`, Travis can [install Chrome at run time with an addon](https://docs.travis-ci.com/user/chrome). Alternatively, you can also install Chrome using the [`download-chrome.sh`](https://raw.githubusercontent.com/GoogleChrome/chrome-launcher/v0.8.0/scripts/download-chrome.sh) script. 196 | 197 | Then in `.travis.yml`, use it like so: 198 | 199 | ```yaml 200 | language: node_js 201 | install: 202 | - yarn install 203 | before_script: 204 | - export DISPLAY=:99.0 205 | - export CHROME_PATH="$(pwd)/chrome-linux/chrome" 206 | - sh -e /etc/init.d/xvfb start 207 | - sleep 3 # wait for xvfb to boot 208 | 209 | addons: 210 | chrome: stable 211 | ``` 212 | -------------------------------------------------------------------------------- /bin/print-chrome-path.cjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * @license Copyright 2021 Google Inc. All Rights Reserved. 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 7 | */ 8 | 'use strict'; 9 | 10 | /** @fileoverview Prints the Chrome path that chrome-launcher will use. */ 11 | 12 | const {getChromePath} = require('../dist/chrome-launcher.js'); 13 | 14 | const chromePath = getChromePath(); 15 | process.stdout.write(chromePath); 16 | process.exit(0); 17 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## v1.0.0 (Tue, Jul 18 2023) 2 | 3 | * `37609a01` deps: upgrade `lighthouse-logger` to 2.0.1 ([#309](https://github.com/GoogleChrome/chrome-launcher/pull/309)) 4 | * `dacd3578` Publish as ESM ([#302](https://github.com/GoogleChrome/chrome-launcher/pull/302)) 5 | * `f9e43693` fix: always close file handles to stdout/stderr logs ([#259](https://github.com/GoogleChrome/chrome-launcher/pull/259)) 6 | 7 | ## v0.15.2 (Mon, April 17 2023) 8 | 9 | * `76b6a13c` Update logLevel option typing ([#295](https://github.com/GoogleChrome/chrome-launcher/pull/295)) 10 | * `60044483` Update headless=chrome flag to headless=new ([#290](https://github.com/GoogleChrome/chrome-launcher/pull/290)) 11 | * `b041125a` log when connection to existing chrome found for requested port ([#291](https://github.com/GoogleChrome/chrome-launcher/pull/291)) 12 | * `f64a7d89` docs(flags): fix description of mock-keychain flag 13 | * `c753ba08` use updating node versions in CI ([#286](https://github.com/GoogleChrome/chrome-launcher/pull/286)) 14 | * `8d1d85dc` docs(flags): adjust grouping. add in several features ([#283](https://github.com/GoogleChrome/chrome-launcher/pull/283)) 15 | * `471a97c7` flags: disable optimization guide and media router ([#282](https://github.com/GoogleChrome/chrome-launcher/pull/282)) 16 | * `83f08461` docs(flags): add disable-features=MediaRouter which is surprisingly active 17 | * `346b3c2c` rename master branch references to main ([#280](https://github.com/GoogleChrome/chrome-launcher/pull/280)) 18 | * `f618e7e5` docs: a few additions to the flags doc 19 | * `c36bd8dc` docs: add OptimizationHints to flags 20 | * `1cbf8b9a` Make LaunchedChrome.kill sync ([#269](https://github.com/GoogleChrome/chrome-launcher/pull/269)) 21 | 22 | 23 | ## v0.15.1 (Tue, May 31 2022) 24 | 25 | * `3724165a` make launcher.kill() synchronous ([#268](https://github.com/GoogleChrome/chrome-launcher/pull/268)) 26 | * `3561350a` revise taskkill procedure on windows ([#267](https://github.com/GoogleChrome/chrome-launcher/pull/267)) 27 | * `690ae983` add lighthouse smoketests (windows) to CI ([#265](https://github.com/GoogleChrome/chrome-launcher/pull/265)) 28 | * `279577fd` docs(chrome-flags-for-tools): add link to overview of features ([#235](https://github.com/GoogleChrome/chrome-launcher/pull/235)) 29 | * `ff91c18b` fix: use `wslpath` to resolve Windows paths ([#200](https://github.com/GoogleChrome/chrome-launcher/pull/200)) 30 | * `30755cde` test: run latest versions of node in CI ([#257](https://github.com/GoogleChrome/chrome-launcher/pull/257)) 31 | 32 | ## v0.15.0 (Wed, Nov 10 2021) 33 | 34 | * `1af60cb` add `getChromePath()` method for printing found chrome path ([#255](https://github.com/GoogleChrome/chrome-launcher/pull/255)) 35 | 36 | ## v0.14.2 (Tue, Nov 2 2021) 37 | 38 | * `ba8d76bd` fix chrome connection in node 17, use 127.0.0.1 explicitly ([#253](https://github.com/GoogleChrome/chrome-launcher/pull/253)) 39 | * `56731dd8` fix: forward support for fs.rm in node 14.14+ ([#242](https://github.com/GoogleChrome/chrome-launcher/pull/242)) 40 | 41 | ## v0.14.1 (Wed, Oct 6 2021) 42 | 43 | * `630bb77f` feat: set browser preferences ([#247](https://github.com/GoogleChrome/chrome-launcher/pull/247)) 44 | * `12b2c8e3` docs(flags): note that disable-gpu isnt needed 45 | 46 | 47 | ## v0.14.0 (Tue, May 18 2021) 48 | * `ac1f4aff` move to minimum node 12; remove `rimraf` ([#237](https://github.com/GoogleChrome/chrome-launcher/pull/237)) 49 | * `dec646c4` deps: remove `mkdirp` for `fs.mkdirSync` ([#234](https://github.com/GoogleChrome/chrome-launcher/pull/234)) 50 | * `83ab178a` update minimum node version ([#222](https://github.com/GoogleChrome/chrome-launcher/pull/222)) 51 | * `a5f6eb2f` add additional chrome flags ([#227](https://github.com/GoogleChrome/chrome-launcher/pull/227)) 52 | * `3a7c9610` reword unset-`CHROME_PATH` error message 53 | * `b1b8dc74` rename disabled `TranslateUI` to `Translate` to match Chrome ([#225](https://github.com/GoogleChrome/chrome-launcher/pull/225)) 54 | * `beb41360` chore: update dependencies and test targets ([#221](https://github.com/GoogleChrome/chrome-launcher/pull/221)) 55 | * `df9d564a` tests: migrate from travis to github actions ([#228](https://github.com/GoogleChrome/chrome-launcher/pull/228)) 56 | * `673da08b` tests: add mac/win bots to ci ([#232](https://github.com/GoogleChrome/chrome-launcher/pull/232)) 57 | * `a700ae0c` docs: fix readme's `getInstallations()` section ([#212](https://github.com/GoogleChrome/chrome-launcher/pull/212)) 58 | * [`chrome-flags-for-tools.md`](https://github.com/GoogleChrome/chrome-launcher/blob/b00fa22f94371f6d38d2d23e6e0b32fc7af470f0/docs/chrome-flags-for-tools.md) update 59 | - `4b98587d` massive update and refactor ([#226](https://github.com/GoogleChrome/chrome-launcher/pull/226)) 60 | - `e45b100f` minor tweaks to headless and others 61 | - `3a90c21b` fix links 62 | - `8429ca93` add feature flags description 63 | - `21db5f9f` even more documented flags ([#231](https://github.com/GoogleChrome/chrome-launcher/pull/231)) 64 | 65 | ## v0.13.4 (Tue, Jul 7 2020) 66 | * `08406b28` fix: preserve existing getInstallations output 67 | * `f3669f45` perf: check default paths first when running on Mac (#209) 68 | * `aef94948` docs: update defaultFlags() example for new API (#205) 69 | 70 | ## v0.13.3 (Thu, Jun 4 2020) 71 | * `6a5d0c72` flags: disable background tracing (#203) 72 | * `d9154291` chore(deps): update typescript and types (#202) 73 | * `88e49686` test: use strict version of assert functions (#201) 74 | 75 | ## v0.13.2 (Thu, May 7 2020) 76 | * `7c1ea547` deps: bump to is-wsl@2.2.0 (#187) 77 | * `2ae5591d` fix: sanitize environment variables used in RegExp (#197) 78 | 79 | ## v0.13.1 (Wed, Apr 1 2020) 80 | * `bf2957ac` deps: update various dependencies (#192) 81 | 82 | ## v0.13.0 (Thu, Feb 27 2020) 83 | * `83da1e41` feat: add killAll function (#186) 84 | * `b8c89f84` flags: disable the default browser check (#181) (#182) 85 | * `6112555c` fix: log taskkill error based on logging opts (#178) (#179) 86 | * `7c935efa` docs: add missing quote in README.md example (#180) 87 | * `2e829c7d` Skip --disable-setuid-sandbox flag when ignoreDefaultFlags = true (#171) 88 | 89 | ## v0.12.0 (Wed, Oct 30 2019) 90 | * `66a5e226` flags: add new --disable flags to reduce noise and disable backgrounding (#170) 91 | - --disable-component-extensions-with-background-pages 92 | - --disable-backgrounding-occluded-windows 93 | - --disable-renderer-backgrounding 94 | - --disable-background-timer-throttling 95 | * `c4890ee3` feat: expose public interface for locating Chrome installations (#177) 96 | - `Launcher.getInstallations()` returns an array of paths to available Chrome binaries 97 | * `a5ccaa4e` deps: update assorted dependencies (#175) 98 | * `e67a10df` --disable-translation is now --disable-features=TranslateUI (#167) 99 | 100 | ## v0.11.2 (Mon, Jul 29 2019) 101 | * `1928187` fix: prevent mutation of default flags (#162) 102 | * `02a23c2` docs: fix launcher example in README (#160) 103 | * `90dc0e4` update manual-chrome-launcher with fixes from LH 104 | 105 | ## v0.11.1 (Tue, Jul 09 2019) 106 | * `ec80f0ca` tests: drop support for node 9. continue supporting node 8 LTS (#159) 107 | * `4865f3af` deps(security): bump mocha to latest (#158) 108 | * `e0d2b09b` deps(security): bump handlebars from 4.0.11 to 4.1.2 (#157) 109 | * `982be53f` update changelog for v0.10.7 and v0.11.0 110 | 111 | ## v0.11.0 (Tue, Jul 09 2019) 112 | * `a860504f` [Breaking change] remove enableExtensions. add ignoreDefaultFlags & defaultFlags() (#124) 113 | * `448a1d48` chrome-finder: Add support for MacOS Catalina (#149) 114 | * `55b891bb` deps(is-wsl): add support for WSL 2; drop Node 6 (#152) 115 | * `57e18181` deps: upgrade typescript and ts-node (#155) 116 | * `a8848116` deps(security): bump lodash from 4.17.4 to 4.17.11 (#147) 117 | * `0a775dab` Document that --enable-automation disables automatic page reloads (#140) 118 | * `c9f653e2` Removing dead --safebrowsing-disable-auto-update flag. (#139) 119 | * `be12d564` yarn.lock add integrity 120 | * `e361aa43` Update changelog.md (#137) 121 | 122 | ## v0.10.7 (Wed, May 01 2019) 123 | * `55397e0c` deps: update yarn.lock from #142 124 | * `179a3f33` silence grep (#138) 125 | * `d2f6037a` fix: move unneeded ts types to devDeps (#142) 126 | * `984d61ce` docs(flags): remove a few flags that are gone. 127 | * `6316362c` docs: fix link to chrome-launcher's flags (#128) 128 | * `f1f6d162` Update chrome-flags-for-tools.md 129 | 130 | ## v0.10.5 (Tue, Sep 25 2018) 131 | * `1328319b` fix: set the `which` command's stdio to pipe (#125) 132 | 133 | ## v0.10.4 (Mon, Sep 17 2018) 134 | * `35842ba4` fix: ignore stdio on `which` call (#121) 135 | * `f126c3a0` fix: reject promise on failed kill() (#112) 136 | * `5ee0fde2` Set custom error codes for all errors. 137 | * `841bdf3f` Fix picking CHROME_PATH priority over other matches. 138 | * `6b10d748` Fix Travis CI build: GCE for chrome bug (#87) 139 | * `d4aa8295` Fix readme's default logLevel (#85) 140 | * `5be71243` Type improvements (#102) 141 | * `dd5fdd49` Stricter typing for logLevel (#105) 142 | * `c9394cf7` Fix README typo: booelan ==> boolean (#104) 143 | * Update chrome-flags-for-tools.md 144 | 145 | ## v0.10.3 (Mon, Sep 17 2018) 146 | Bad release. Had a breaking change (#70). Unpublished. 147 | 148 | ## v0.10.2 (Mon, Jan 8 2018) 149 | * `ef91605f` Fix TS typing (#82) 150 | * `baf2205f` tests(travis): test on Node 9, drop testing on Node 7 (#80) 151 | 152 | ## v0.10.1 (Fri, Jan 5 2018) 153 | * `a5bc8180` Fix getLocalAppDataPath for wsl (#75) 154 | * `70a91885` readme: recommend use of cri with chrome-launcher (#78) 155 | * `d3ee63bd` folder refactor: ts in /src, js in /dist (#69) 156 | 157 | ## 0.10.0 (Fri, Dec 8 2017) 158 | * `449c5238` Expose launched chrome child process object. (#67) 159 | * `0978891c` Enable users to pass env vars into spawned chrome. (#66) 160 | * `0261f43b` Add document covering the various chrome flags 161 | * `5617473c` Make launcher the default export. (#63) 162 | * `483acff5` fix: support alpine linux by retrying grep with -r (#61) 163 | * `eaa0bb87` docs: update maxConnectionRetries default to 50 (#58) 164 | 165 | ## 0.9.0 (Mon, 27 Nov 2017) 166 | * `4cc9c075` New: Add `userDataDir` flag to use default user profile instead (#48) 167 | * `94137051` Avoid selecting google-emacs (#35) 168 | 169 | ## 0.8.0 (Wed, 20 Sept 2017) 170 | * `256399c` Add support for Windows Subsystem for Linux / BashOnWindows (#27) 171 | 172 | ## 0.7.0 (Thu, 14 Sept 2017) 173 | * Project moved to its own repo: https://github.com/GoogleChrome/chrome-launcher 174 | * `8d0766eb` Retry connection for longer (#21) 175 | * `52cb50af` only include PROGRAMFILES(X86) if present (#20) 176 | * `530822b9` log pid to kill (#22) 177 | * `1d617ab3` add support for `connectionPollInterval ` and `maxConnectionRetries` (#19) 178 | * `7474971f` Fix errors inside spawnPromise being ignored (https://github.com/GoogleChrome/lighthouse/pull/2939) 179 | 180 | ## 0.6.0 (Thu, 17 Aug 2017) 181 | * `43baee69` mute any audio (#3028) 182 | * `ae6e9551` Better SIGINT handling (#2959) 183 | * `3ab3a117` docs: add changelog to launcher (#2987) 184 | 185 | ## 0.5.0 (Mon, 14 Aug 2017) 186 | * `494f9911` clarify priority of chromePath options 187 | * `1c11021a` add support for finding Chromium on Linux (#2950) 188 | * `391e2043` Publish type definitions instead of source TypeScript files (#2898) 189 | * `de408ad3` readme: update example using deprecated `LIGHTHOUSE_CHROMIUM_PATH` (#2929) 190 | * `8bc6d18e` add license file to launcher package. (#2849) 191 | 192 | ## 0.4.0 (Tue, 1 Aug 2017) 193 | * `37fd38ce` pass --enable-extensions on from manual-chrome-launcher (#2735) 194 | * `c942d17e` support enabling extension loading (#2650) 195 | 196 | ## 0.3.2 (Wed, 19 Jul 2017) 197 | * `112c2c7f` Fix chrome finder on linux/osx when process.env isn't populated (#2687) 198 | * `5728695f` Added CHROME_PATH to readme (#2694) 199 | * `fedc76a3` test: fix clang-format error (#2691) 200 | * `a6bbcaba` nuke 'as string' 201 | * `41df647f` cli: remove --select-chrome,--skip-autolaunch. Support CHROME_PATH env (#2659) 202 | * `8c9724e2` fix launcher w/ arbitrary flags (#2670) 203 | * `9c0c0788` Expose LHR to modules consuming cli/run.ts (#2654) 204 | * `6df6b0e2` support custom port via chrome-debug binary (#2644) 205 | * `3f143b19` log the specific chrome spawn command. 206 | 207 | ## 0.3.1 (Wed, 5 Jul 2017) 208 | * `ef081063` upgrade rimraf to latest (#2641) 209 | 210 | ## 0.3.0 (Fri, 30 Jun 2017) 211 | * `edbb40d9` fix(driver): move performance observer registration to setupDriver (#2611) 212 | -------------------------------------------------------------------------------- /chrome-launcher/index.js: -------------------------------------------------------------------------------- 1 | // This provides legacy support for a previously documented require pattern 2 | // const chromeLauncher = require('chrome-launcher/chrome-launcher'); 3 | 4 | module.exports = require('../'); 5 | -------------------------------------------------------------------------------- /compiled-check.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | 6 | module.exports = function(filename) { 7 | if (!fs.existsSync(path.join(__dirname, filename))) { 8 | console.log( 9 | 'Oops! Looks like the chrome-launcher files needs to be compiled. Please run:'); 10 | console.log(' yarn; yarn build;'); 11 | process.exit(1); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Release Procedure 2 | 3 | 1. When good, do `npm publish`. it'll run the prepublish script (build & test) 4 | * complete publishing to npm. (we now have the tagged commit, too). 5 | 1. To complete the changelog: Do `git log --oneline` and then edit the resulting text to match the style in `changelog.md`. it's pretty manual. update that file. commit. 6 | 1. Push back up to origin. Do `git push --tags` to ensure the tag is there. 7 | 1. Open up https://github.com/GoogleChrome/chrome-launcher/releases and _Draft a New Release_. Use the same changelog.md markdown. Publish. 8 | -------------------------------------------------------------------------------- /docs/chrome-flags-for-tools.md: -------------------------------------------------------------------------------- 1 | # Chrome Flags for Tooling 2 | 3 | Many tools maintain a list of runtime flags for Chrome to configure the environment. This file 4 | is an attempt to document all chrome flags that are relevant to tools, automation, benchmarking, etc. 5 | 6 | All use cases are different, so you'll have to choose which flags are most appropriate. 7 | 8 | Here's a **[Nov 2022 comparison of what flags](https://docs.google.com/spreadsheets/d/1n-vw_PCPS45jX3Jt9jQaAhFqBY6Ge1vWF_Pa0k7dCk4/edit#gid=1265672696)** all these [tools](#sources) use. 9 | 10 | ## Commonly unwanted browser features 11 | 12 | * `--disable-client-side-phishing-detection`: Disables client-side phishing detection 13 | * `--disable-component-extensions-with-background-pages`: Disable some built-in extensions that aren't affected by `--disable-extensions` 14 | * `--disable-default-apps`: Disable installation of default apps 15 | * `--disable-extensions`: Disable all chrome extensions 16 | * `--disable-features=InterestFeedContentSuggestions`: Disables the Discover feed on NTP 17 | * `--disable-features=Translate`: Disables Chrome translation, both the manual option and the popup prompt when a page with differing language is detected. 18 | * `--hide-scrollbars`: Hide scrollbars from screenshots. 19 | * `--mute-audio`: Mute any audio 20 | * `--no-default-browser-check`: Disable the default browser check, do not prompt to set it as such 21 | * `--no-first-run`: Skip first run wizards 22 | * `--ash-no-nudges`: Avoids blue bubble "user education" nudges (eg., "… give your browser a new look", Memory Saver) 23 | * `--disable-search-engine-choice-screen`: Disable the 2023+ search engine choice screen 24 | * `--propagate-iph-for-testing`: Specifies which in-product help (IPH) features are allowed. If no arguments are provided, then all IPH features are disabled. 25 | 26 | ## Task throttling 27 | 28 | * `--disable-background-timer-throttling`: Disable timers being throttled in background pages/tabs 29 | * `--disable-backgrounding-occluded-windows`: Normally, Chrome will treat a 'foreground' tab instead as _backgrounded_ if the surrounding window is occluded (aka visually covered) by another window. This flag disables that. 30 | * `--disable-features=CalculateNativeWinOcclusion`: Disable the feature of: Calculate window occlusion on Windows will be used in the future to throttle and potentially unload foreground tabs in occluded windows. 31 | * `--disable-hang-monitor`: Suppresses hang monitor dialogs in renderer processes. This flag may allow slow unload handlers on a page to prevent the tab from closing. 32 | * `--disable-ipc-flooding-protection`: Some javascript functions can be used to flood the browser process with IPC. By default, protection is on to limit the number of IPC sent to 10 per second per frame. This flag disables it. https://crrev.com/604305 33 | * `--disable-renderer-backgrounding`: This disables non-foreground tabs from getting a lower process priority This doesn't (on its own) affect timers or painting behavior. [karma-chrome-launcher#123](https://github.com/karma-runner/karma-chrome-launcher/issues/123) 34 | 35 | ## Web platform behavior 36 | 37 | * `--aggressive-cache-discard` 38 | * `--allow-running-insecure-content` 39 | * `--disable-back-forward-cache`: Disables the BackForwardCache feature. 40 | * `--disable-features=AcceptCHFrame`: Disable accepting h2/h3 [ACCEPT_CH](https://datatracker.ietf.org/doc/html/draft-davidben-http-client-hint-reliability-02#section-4.3) Client Hints frames. 41 | * `--disable-features=AutoExpandDetailsElement`: Removed in [Sept 2022](https://bugs.chromium.org/p/chromium/issues/detail?id=1185950#c62). 42 | * `--disable-features=AvoidUnnecessaryBeforeUnloadCheckSync`: If enabled, this feature results in the browser process only asking the renderer process to run beforeunload handlers if it knows such handlers are registered. With `kAvoidUnnecessaryBeforeUnloadCheckSync`, content does not report a beforeunload handler is present. A ramification of this is navigations that would normally check beforeunload handlers before continuing will not, and navigation will synchronously continue. 43 | * `--disable-features=BackForwardCache`: Disable the bfcache. 44 | * `--disable-features=HeavyAdPrivacyMitigations`: Disables the privacy mitigations for the heavy ad intervention. This throttles the amount of interventions that can occur on a given host in a time period. It also adds noise to the thresholds used. This is separate from the intervention feature so it does not interfere with field trial activation, as this blocklist is created for every user, and noise is decided prior to seeing a heavy ad. 45 | * `--disable-features=IsolateOrigins` 46 | * `--disable-features=LazyFrameLoading` 47 | * `--disable-features=ScriptStreaming`: V8 script streaming 48 | * `--no-process-per-site`: Disables renderer process reuse (across tabs of the same site). 49 | * `--enable-precise-memory-info`: Make the values returned to window.performance.memory more granular and more up to date in shared worker. Without this flag, the memory information is still available, but it is bucketized and updated less frequently. This flag also applys to workers. 50 | * `--js-flags=--random-seed=1157259157`: Initialize V8's RNG with a fixed seed. 51 | * `--use-fake-device-for-media-stream`: Use fake device for Media Stream to replace camera and microphone 52 | * `--use-fake-ui-for-media-stream`: Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream. 53 | * `--use-file-for-fake-video-capture=`: Use file for fake video capture (.y4m or .mjpeg) Needs `--use-fake-device-for-media-stream` 54 | 55 | ## Interactivity suppression 56 | 57 | * `--autoplay-policy=...`: Value of `user-gesture-required` to not autoplay video. Value of `no-user-gesture-required` to always autoplay video. 58 | * `--deny-permission-prompts`: Suppress all permission prompts by automatically denying them. 59 | * `--disable-external-intent-requests`: Disallow opening links in external applications 60 | * `--disable-features=GlobalMediaControls`: Hide toolbar button that opens dialog for controlling media sessions. 61 | * `--disable-features=ImprovedCookieControls`: Disables an improved UI for third-party cookie blocking in incognito mode. 62 | * `--disable-features=PrivacySandboxSettings4`: Disables "Enhanced ad privacy in Chrome" dialog (if it wasn't disabled through other means). 63 | * `--disable-notifications`: Disables the Web Notification and the Push APIs. 64 | * `--disable-popup-blocking`: Disable popup blocking. `--block-new-web-contents` is the strict version of this. 65 | * `--disable-prompt-on-repost`: Reloading a page that came from a POST normally prompts the user. 66 | * `--noerrdialogs`: Suppresses all error dialogs when present. 67 | 68 | ## Catch-all automation 69 | * `--enable-automation`: Disable a few things considered not appropriate for automation. ([Original design doc](https://docs.google.com/a/google.com/document/d/1JYj9K61UyxIYavR8_HATYIglR9T_rDwAtLLsD3fbDQg/preview), though renamed [here](https://codereview.chromium.org/2564973002#msg24)) [codesearch](https://cs.chromium.org/search/?q=kEnableAutomation&type=cs). Note that some projects have chosen to **avoid** using this flag: [web-platform-tests/wpt/#6348](https://github.com/web-platform-tests/wpt/pull/6348), [crbug.com/1277272](https://crbug.com/1277272) 70 | - sets `window.navigator.webdriver` to `true` within all JS contexts. This is also set [when using](https://source.chromium.org/chromium/chromium/src/+/main:content/child/runtime_features.cc;l=374-376;drc=4a843634b8b3006e431add55968f6f45ee54d35e) `--headless`, `--remote-debugging-pipe` and `--remote-debugging-port=0` (yes, [_specifically_ 0](https://source.chromium.org/chromium/chromium/src/+/main:content/child/runtime_features.cc;l=412-427;drc=4a843634b8b3006e431add55968f6f45ee54d35e)). 71 | - disables bubble notification about running development/unpacked extensions ([source](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/extensions/extension_message_bubble_factory.cc;l=71-76;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed)) 72 | - disables the password saving UI (which [covers](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/password_manager/chrome_password_manager_client.cc;l=301-308;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed) the usecase of the [defunct](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1015) `--disable-save-password-bubble` flag) 73 | - disables infobar animations ([source](https://source.chromium.org/chromium/chromium/src/+/main:components/infobars/content/content_infobar_manager.cc;l=48-52;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed)) 74 | - disables auto-reloading on network errors ([source](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/chrome_content_browser_client.cc;l=1328-1331;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed)) 75 | - enables the CDP method [`Browser.getBrowserCommandLine`](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getBrowserCommandLine). 76 | - avoids showing these 4 infobars: ShowBadFlagsPrompt, GoogleApiKeysInfoBarDelegate, ObsoleteSystemInfoBarDelegate, LacrosButterBar 77 | - adds this infobar: ![image](https://user-images.githubusercontent.com/39191/30349667-92a7a086-97c8-11e7-86b2-1365e3d407e3.png) ... which is known to [adversely affect screenshots](https://bugs.chromium.org/p/chromium/issues/detail?id=1277272). 78 | * `--test-type`: Basically the 2014 version of `--enable-automation`. [codesearch](https://cs.chromium.org/search/?q=kTestType%5Cb&type=cs) 79 | - It avoids creating application stubs in ~/Applications on mac. 80 | - It makes exit codes slightly more correct 81 | - windows navigation jumplists arent updated https://crbug.com/389375 82 | - doesn't start some chrome StartPageService 83 | - disables initializing chromecast service 84 | - "Component extensions with background pages are not enabled during tests because they generate a lot of background behavior that can interfere." 85 | - when quitting the browser, it disables additional checks that may stop that quitting process. (like unsaved form modifications or unhandled profile notifications..) 86 | * `--remote-debugging-pipe`: more secure than using protocol over a websocket 87 | * `--remote-debugging-port=...`: With a value of 0, Chrome will automatically select a useable port _and_ will set `navigator.webdriver` to `true`. 88 | * `--silent-debugger-extension-api`: Does not show an infobar when a Chrome extension attaches to a page using `chrome.debugger` page. Required to attach to extension background pages. 89 | 90 | ## General 91 | 92 | * `--enable-logging=stderr`: Logging behavior slightly more appropriate for a server-type process. 93 | * `--log-level=0`: 0 means INFO and higher. `2` is the most verbose. Protip: Use `--enable-logging=stderr --v=2` and you may spot additional components active that you may want to disable. 94 | * `--user-data-dir=...`: Directory where the browser stores the user profile. 95 | 96 | ## Chromium Annoyances 97 | 98 | * `--disable-features=MediaRouter`: Avoid the startup dialog for _Do you want the application “Chromium.app” to accept incoming network connections?_. Also disables the [Chrome Media Router](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/media/media_router.md) which creates background networking activity to discover cast targets. A superset of disabling `DialMediaRouteProvider`. 99 | * `--password-store=basic`: Avoid potential instability of using Gnome Keyring or KDE wallet. [chromium/linux/password_storage.md](https://chromium.googlesource.com/chromium/src/+/main/docs/linux/password_storage.md) https://crbug.com/571003 100 | * `--use-mock-keychain`: Use mock keychain on Mac to prevent the blocking permissions dialog abou: _Chrome wants to use your confidential information stored in your keychain_ 101 | 102 | ## Background networking 103 | 104 | * `--disable-background-networking`: Disable various background network services, including extension updating,safe browsing service, upgrade detector, translate, UMA 105 | * `--disable-breakpad`: Disable crashdump collection (reporting is already disabled in Chromium) 106 | * `--disable-component-update`: Don't update the browser 'components' listed at chrome://components/ 107 | * `--disable-domain-reliability`: Disables Domain Reliability Monitoring, which tracks whether the browser has difficulty contacting Google-owned sites and uploads reports to Google. 108 | * `--disable-features=AutofillServerCommunication`: Disables autofill server communication. This feature isn't disabled via other 'parent' flags. 109 | * `--disable-features=CertificateTransparencyComponentUpdater` 110 | * `--disable-sync`: Disable syncing to a Google account 111 | * `--enable-crash-reporter-for-testing`: Used for turning on Breakpad crash reporting in a debug environment where crash reporting is typically compiled but disabled. 112 | * `--metrics-recording-only`: Disable reporting to UMA, but allows for collection 113 | * `--disable-features=OptimizationHints`: Disable the [Chrome Optimization Guide](https://chromium.googlesource.com/chromium/src/+/HEAD/components/optimization_guide/) and networking with its service API 114 | * `--disable-features=DialMediaRouteProvider`: A weaker form of disabling the `MediaRouter` feature. See that flag's details. 115 | * `--no-pings`: Don't send hyperlink auditing pings 116 | 117 | ## Rendering & GPU 118 | 119 | * `--allow-pre-commit-input`: Allows processing of input before a frame has been committed. Used by headless. https://crbug.com/987626 120 | * `--deterministic-mode`: An experimental meta flag. This sets the below indented flags which put the browser into a mode where rendering (border radius, etc) is deterministic and begin frames should be issued over DevTools Protocol. [codesearch](https://source.chromium.org/chromium/chromium/src/+/main:headless/app/headless_shell.cc;drc=df45d1abbc20abc7670643adda6d9625eea55b4d) 121 | - `--run-all-compositor-stages-before-draw` 122 | - `--disable-new-content-rendering-timeout` 123 | - `--enable-begin-frame-control` 124 | - `--disable-threaded-animation` 125 | - `--disable-threaded-scrolling` 126 | - `--disable-checker-imaging` 127 | - `--disable-image-animation-resync` 128 | * `--disable-features=PaintHolding`: Don't defer paint commits (normally used to avoid flash of unstyled content) 129 | * `--disable-partial-raster`: https://crbug.com/919955 130 | * `--disable-skia-runtime-opts`: Do not use runtime-detected high-end CPU optimizations in Skia. 131 | * `--in-process-gpu`: Saves some memory by moving GPU process into a browser process thread 132 | * `--use-gl="swiftshader"`: Select which implementation of GL the GPU process should use. Options are: `desktop`: whatever desktop OpenGL the user has installed (Linux and Mac default). `egl`: whatever EGL / GLES2 the user has installed (Windows default - actually ANGLE). `swiftshader`: The SwiftShader software renderer. 133 | 134 | ## Window & screen management 135 | 136 | * `--block-new-web-contents`: All pop-ups and calls to window.open will fail. 137 | * `--force-color-profile=srgb`: Force all monitors to be treated as though they have the specified color profile. 138 | * `--new-window`: Launches URL in new browser window. 139 | * `--window-position=0,0`: Specify the initial window position: --window-position=x,y 140 | * `--window-size=1600,1024`: Sets the initial window size. Provided as string in the format "800,600". 141 | 142 | ## Process management 143 | 144 | * `--disable-features=DestroyProfileOnBrowserClose`: Disable the feature of: Destroy profiles when their last browser window is closed, instead of when the browser exits. 145 | * `--disable-features=site-per-process`: Disables OOPIF. https://www.chromium.org/Home/chromium-security/site-isolation 146 | * `--no-service-autorun`: Disables the service process from adding itself as an autorun process. This does not delete existing autorun registrations, it just prevents the service from registering a new one. 147 | * `--process-per-tab`: [Doesn't do anything](https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_switches.cc;l=602-605;drc=2149a93144ce2030ab20863c2983b6c9d7bfd177). Use --single-process instead. 148 | * `--single-process`: Runs the renderer and plugins in the same process as the browser. 149 | 150 | ## Headless 151 | 152 | * `--headless`: Run in headless mode, i.e., without a UI or display server dependencies. 153 | * `--no-sandbox`: [Sometimes used](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#setting-up-chrome-linux-sandbox) with headless, though not recommended. 154 | * `--disable-dev-shm-usage`: Often used in Lambda, Cloud Functions scenarios. ([pptr issue](https://github.com/GoogleChrome/puppeteer/issues/1834), [crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=736452)) 155 | * `--disable-gpu`: Was often [used](https://bugs.chromium.org/p/chromium/issues/detail?id=737678) along with `--headless`, but as of 2021, isn't needed. 156 | 157 | # ~Removed~ flags 158 | 159 | * `--disable-add-to-shelf`: [Removed June 2017](https://codereview.chromium.org/2944283002) 160 | * `--disable-background-downloads`: [Removed Oct 2014](https://codereview.chromium.org/607843002). 161 | * `--disable-browser-side-navigation`: Removed. It disabled PlzNavigate. 162 | * `--disable-datasaver-prompt`: Removed 163 | * `--disable-desktop-notifications`: Removed 164 | * `--disable-device-discovery-notifications`: Removed. Avoided messages like "New printer on your network". [Replaced](https://crbug.com/1020447#c1) with `--disable-features=MediaRouter`. 165 | * `--disable-features=TranslateUI`: Removed as `TranslateUI` changed to `Translate` in [Sept 2020](https://chromium-review.googlesource.com/c/chromium/src/+/2404484). 166 | * `--disable-infobars`: [Removed May 2019](https://chromium-review.googlesource.com/c/chromium/src/+/1599303) 167 | * `--disable-save-password-bubble`: [Removed May 2016](https://codereview.chromium.org/1978563002) 168 | * `--disable-search-geolocation-disclosure`: Removed. 169 | * `--disable-translate`: [Removed April 2017](https://codereview.chromium.org/2819813002/) Used to disable built-in Google Translate service. 170 | * `--headless=new`: Unnecessary [from January 2025 with Chrome 132](https://developer.chrome.com/blog/removing-headless-old-from-chrome) since just `--headless` runs the new headless mode too. 171 | * `--ignore-autoplay-restrictions`: [Removed December 2017](https://chromium-review.googlesource.com/#/c/816855/) Can use `--autoplay-policy=no-user-gesture-required` instead. 172 | * `--safebrowsing-disable-auto-update`: [Removed Nov 2017](https://bugs.chromium.org/p/chromium/issues/detail?id=74848#c26) 173 | 174 | # Sources 175 | 176 | * [chrome-launcher's flags](https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts) 177 | * [Chromedriver's flags](https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome_launcher.cc?type=cs&q=f:chrome_launcher++kDesktopSwitches&sq=package:chromium) 178 | * [Puppeteer's flags](https://github.com/puppeteer/puppeteer/blob/3f2c0590f154aefd2ad3449a3f943ee79d1e33a9/packages/puppeteer-core/src/node/ChromeLauncher.ts#L159) 179 | * [WebpageTest's flags](https://github.com/WPO-Foundation/wptagent/blob/master/internal/chrome_desktop.py) 180 | * [Catapult's flags](https://source.chromium.org/chromium/chromium/src/+/main:third_party/catapult/telemetry/telemetry/internal/backends/chrome/chrome_startup_args.py) and [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/catapult/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py;l=218;drc=4a0e6f034e9756605cfc837c8526588d6c13436b) 181 | * [Karma's flags](https://github.com/karma-runner/karma-chrome-launcher/blob/master/index.js) 182 | * [Playwright's](https://github.com/microsoft/playwright/blob/e998b6cab94d1462192987537b924ef86153ea09/packages/playwright-core/src/server/chromium/chromiumSwitches.ts#L20) [flags](https://github.com/microsoft/playwright/blob/e998b6cab94d1462192987537b924ef86153ea09/packages/playwright-core/src/server/chromium/chromium.ts#L263) 183 | 184 | [The canonical list of Chrome command-line switches on peter.sh](http://peter.sh/experiments/chromium-command-line-switches/) (maintained by the Chromium team) 185 | 186 | FYI: (Probably) all flags are defined in files matching the pattern of [`*_switches.cc`](https://source.chromium.org/search?q=f:_switches%5C.cc&ss=chromium%2Fchromium%2Fsrc). 187 | 188 | ## Set Preferences 189 | 190 | Many Chrome settings are defined in a JSON file located at `USER_DATA_DIR/Default/Preferences`. Browse your own Preferences file to see what's in there; some, but not all, preferences are defined in [pref_names.h](https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/pref_names.h) 191 | 192 | If you wanted to launch a fresh Chrome profile **_with_** some Preferences set, for example: disable DevTools source-map fetching: 193 | 194 | ```sh 195 | mkdir -p your_empty_user_data_dir/Default/ 196 | echo '{"devtools":{"preferences":{"jsSourceMapsEnabled":"false","cssSourceMapsEnabled":"false"}}}' > your_empty_user_data_dir/Default/Preferences 197 | 198 | chrome --user-data-dir=your_empty_user_data_dir ... 199 | ``` 200 | 201 | ## Feature Flags FYI 202 | 203 | Chromium and Blink use feature flags to disable/enable many features at runtime. Chromium has [~400 features](https://source.chromium.org/search?q=%22const%20base::Feature%22%20f:%5C.cc&sq=&ss=chromium%2Fchromium%2Fsrc) that can be toggled with `--enable-features` / `--disable-features`. https://niek.github.io/chrome-features/ presents all of them very clearly. 204 | 205 | 206 | Independently, Blink has [many features](https://source.chromium.org/chromium/chromium/src/+/main:out/Debug/gen/third_party/blink/renderer/platform/runtime_enabled_features.cc;l=1969;drc=d6e91a65ded605d8577f0651b3665c8206ae6ce3) that can be toggled [with commandline switches](https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/RuntimeEnabledFeatures.md#command_line-switches): `--enable-blink-features` / `--disable-blink-features`. 207 | -------------------------------------------------------------------------------- /manual-chrome-launcher.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | // Keep this file in sync with lighthouse 5 | // TODO: have LH depend on this one. 6 | 7 | /** 8 | * @fileoverview Script to launch a clean Chrome instance on-demand. 9 | * 10 | * Assuming Lighthouse is installed globally or `npm link`ed, use via: 11 | * chrome-debug 12 | * Optionally enable extensions or pass a port, additional chrome flags, and/or a URL 13 | * chrome-debug --port=9222 14 | * chrome-debug http://goat.com 15 | * chrome-debug --show-paint-rects 16 | * chrome-debug --enable-extensions 17 | */ 18 | 19 | require('./compiled-check.js')('./dist/chrome-launcher.js'); 20 | const {Launcher, launch} = require('./dist/chrome-launcher'); 21 | 22 | const args = process.argv.slice(2); 23 | const chromeFlags = []; 24 | let startingUrl; 25 | let port; 26 | let ignoreDefaultFlags; 27 | 28 | if (args.length) { 29 | const providedFlags = args.filter(flag => flag.startsWith('--')); 30 | 31 | const portFlag = providedFlags.find(flag => flag.startsWith('--port=')); 32 | if (portFlag) port = parseInt(portFlag.replace('--port=', ''), 10); 33 | 34 | const enableExtensions = !!providedFlags.find(flag => flag === '--enable-extensions'); 35 | // The basic pattern for enabling Chrome extensions 36 | if (enableExtensions) { 37 | ignoreDefaultFlags = true; 38 | chromeFlags.push(...Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions')); 39 | } 40 | 41 | chromeFlags.push(...providedFlags); 42 | startingUrl = args.find(flag => !flag.startsWith('--')); 43 | } 44 | 45 | launch({ 46 | startingUrl, 47 | port, 48 | ignoreDefaultFlags, 49 | chromeFlags, 50 | }) 51 | // eslint-disable-next-line no-console 52 | .then(v => console.log(`✨ Chrome debugging port: ${v.port}`)); 53 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-launcher", 3 | "main": "./dist/index.js", 4 | "type": "module", 5 | "engines": { 6 | "node": ">=12.13.0" 7 | }, 8 | "scripts": { 9 | "build": "tsc", 10 | "dev": "tsc -w", 11 | "test": "test/run-tests.sh", 12 | "test-formatting": "test/check-formatting.sh", 13 | "format": "scripts/format.sh", 14 | "type-check": "tsc --allowJs --checkJs --noEmit --target es2019 *.js", 15 | "prepublishOnly": "npm run build && npm run test", 16 | "reset-link": "(yarn unlink || true) && yarn link && yarn --cwd node_modules/lighthouse/ link chrome-launcher" 17 | }, 18 | "bin": { 19 | "print-chrome-path": "bin/print-chrome-path.cjs" 20 | }, 21 | "devDependencies": { 22 | "@types/mocha": "^8.0.4", 23 | "@types/sinon": "^9.0.1", 24 | "clang-format": "^1.0.50", 25 | "mocha": "^10.2.0", 26 | "sinon": "^9.0.1", 27 | "ts-node": "^10.9.1", 28 | "typescript": "^4.1.2" 29 | }, 30 | "dependencies": { 31 | "@types/node": "*", 32 | "escape-string-regexp": "^4.0.0", 33 | "is-wsl": "^2.2.0", 34 | "lighthouse-logger": "^2.0.1" 35 | }, 36 | "version": "1.1.2", 37 | "types": "./dist/index.d.ts", 38 | "description": "Launch latest Chrome with the Devtools Protocol port open", 39 | "repository": "https://github.com/GoogleChrome/chrome-launcher/", 40 | "author": "The Chromium Authors", 41 | "license": "Apache-2.0" 42 | } 43 | -------------------------------------------------------------------------------- /scripts/download-chrome.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## 4 | # @license Copyright 2017 Google Inc. All Rights Reserved. 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 7 | ## 8 | 9 | # Download chrome inside of our CI env. 10 | 11 | if [ "$APPVEYOR" == "True" ]; then 12 | url="https://download-chromium.appspot.com/dl/Win?type=snapshots" 13 | else 14 | url="https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots" 15 | fi 16 | 17 | if [ x"$LIGHTHOUSE_CHROMIUM_PATH" == x ]; then 18 | echo "Error: Environment variable LIGHTHOUSE_CHROMIUM_PATH not set" 19 | exit 1 20 | fi 21 | 22 | if [ -e "$LIGHTHOUSE_CHROMIUM_PATH" ]; then 23 | echo "cached chrome found" 24 | else 25 | wget "$url" --no-check-certificate -q -O chrome.zip && unzip chrome.zip 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | FILES="`find src -type f -name '*.ts'`" 4 | 5 | ./node_modules/.bin/clang-format -i -style=file $FILES 6 | -------------------------------------------------------------------------------- /src/chrome-finder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2016 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | import fs from 'fs'; 9 | import path from 'path'; 10 | import {homedir} from 'os'; 11 | import {execSync, execFileSync} from 'child_process'; 12 | import escapeRegExp from 'escape-string-regexp'; 13 | import log from 'lighthouse-logger'; 14 | 15 | import {getWSLLocalAppDataPath, toWSLPath, ChromePathNotSetError} from './utils.js'; 16 | 17 | const newLineRegex = /\r?\n/; 18 | 19 | type Priorities = Array<{regex: RegExp, weight: number}>; 20 | 21 | /** 22 | * check for MacOS default app paths first to avoid waiting for the slow lsregister command 23 | */ 24 | export function darwinFast(): string|undefined { 25 | const priorityOptions: Array = [ 26 | process.env.CHROME_PATH, 27 | process.env.LIGHTHOUSE_CHROMIUM_PATH, 28 | '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary', 29 | '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', 30 | ]; 31 | 32 | for (const chromePath of priorityOptions) { 33 | if (chromePath && canAccess(chromePath)) return chromePath; 34 | } 35 | 36 | return darwin()[0] 37 | } 38 | 39 | export function darwin() { 40 | const suffixes = ['/Contents/MacOS/Google Chrome Canary', '/Contents/MacOS/Google Chrome']; 41 | 42 | const LSREGISTER = '/System/Library/Frameworks/CoreServices.framework' + 43 | '/Versions/A/Frameworks/LaunchServices.framework' + 44 | '/Versions/A/Support/lsregister'; 45 | 46 | const installations: Array = []; 47 | 48 | const customChromePath = resolveChromePath(); 49 | if (customChromePath) { 50 | installations.push(customChromePath); 51 | } 52 | 53 | execSync( 54 | `${LSREGISTER} -dump` + 55 | ' | grep -i \'google chrome\\( canary\\)\\?\\.app\'' + 56 | ' | awk \'{$1=""; print $0}\'') 57 | .toString() 58 | .split(newLineRegex) 59 | .forEach((inst: string) => { 60 | suffixes.forEach(suffix => { 61 | const execPath = path.join(inst.substring(0, inst.indexOf('.app') + 4).trim(), suffix); 62 | if (canAccess(execPath) && installations.indexOf(execPath) === -1) { 63 | installations.push(execPath); 64 | } 65 | }); 66 | }); 67 | 68 | 69 | // Retains one per line to maintain readability. 70 | // clang-format off 71 | const home = escapeRegExp(process.env.HOME || homedir()); 72 | const priorities: Priorities = [ 73 | {regex: new RegExp(`^${home}/Applications/.*Chrome\\.app`), weight: 50}, 74 | {regex: new RegExp(`^${home}/Applications/.*Chrome Canary\\.app`), weight: 51}, 75 | {regex: /^\/Applications\/.*Chrome.app/, weight: 100}, 76 | {regex: /^\/Applications\/.*Chrome Canary.app/, weight: 101}, 77 | {regex: /^\/Volumes\/.*Chrome.app/, weight: -2}, 78 | {regex: /^\/Volumes\/.*Chrome Canary.app/, weight: -1}, 79 | ]; 80 | 81 | if (process.env.LIGHTHOUSE_CHROMIUM_PATH) { 82 | priorities.unshift({regex: new RegExp(escapeRegExp(process.env.LIGHTHOUSE_CHROMIUM_PATH)), weight: 150}); 83 | } 84 | 85 | if (process.env.CHROME_PATH) { 86 | priorities.unshift({regex: new RegExp(escapeRegExp(process.env.CHROME_PATH)), weight: 151}); 87 | } 88 | 89 | // clang-format on 90 | return sort(installations, priorities); 91 | } 92 | 93 | function resolveChromePath() { 94 | if (canAccess(process.env.CHROME_PATH)) { 95 | return process.env.CHROME_PATH; 96 | } 97 | 98 | if (canAccess(process.env.LIGHTHOUSE_CHROMIUM_PATH)) { 99 | log.warn( 100 | 'ChromeLauncher', 101 | 'LIGHTHOUSE_CHROMIUM_PATH is deprecated, use CHROME_PATH env variable instead.'); 102 | return process.env.LIGHTHOUSE_CHROMIUM_PATH; 103 | } 104 | 105 | return undefined; 106 | } 107 | 108 | /** 109 | * Look for linux executables in 3 ways 110 | * 1. Look into CHROME_PATH env variable 111 | * 2. Look into the directories where .desktop are saved on gnome based distro's 112 | * 3. Look for google-chrome-stable & google-chrome executables by using the which command 113 | */ 114 | export function linux() { 115 | let installations: string[] = []; 116 | 117 | // 1. Look into CHROME_PATH env variable 118 | const customChromePath = resolveChromePath(); 119 | if (customChromePath) { 120 | installations.push(customChromePath); 121 | } 122 | 123 | // 2. Look into the directories where .desktop are saved on gnome based distro's 124 | const desktopInstallationFolders = [ 125 | path.join(homedir(), '.local/share/applications/'), 126 | '/usr/share/applications/', 127 | ]; 128 | desktopInstallationFolders.forEach(folder => { 129 | installations = installations.concat(findChromeExecutables(folder)); 130 | }); 131 | 132 | // Look for google-chrome(-stable) & chromium(-browser) executables by using the which command 133 | const executables = [ 134 | 'google-chrome-stable', 135 | 'google-chrome', 136 | 'chromium-browser', 137 | 'chromium', 138 | ]; 139 | executables.forEach((executable: string) => { 140 | try { 141 | const chromePath = 142 | execFileSync('which', [executable], {stdio: 'pipe'}).toString().split(newLineRegex)[0]; 143 | 144 | if (canAccess(chromePath)) { 145 | installations.push(chromePath); 146 | } 147 | } catch (e) { 148 | // Not installed. 149 | } 150 | }); 151 | 152 | if (!installations.length) { 153 | throw new ChromePathNotSetError(); 154 | } 155 | 156 | const priorities: Priorities = [ 157 | {regex: /chrome-wrapper$/, weight: 51}, 158 | {regex: /google-chrome-stable$/, weight: 50}, 159 | {regex: /google-chrome$/, weight: 49}, 160 | {regex: /chromium-browser$/, weight: 48}, 161 | {regex: /chromium$/, weight: 47}, 162 | ]; 163 | 164 | if (process.env.LIGHTHOUSE_CHROMIUM_PATH) { 165 | priorities.unshift( 166 | {regex: new RegExp(escapeRegExp(process.env.LIGHTHOUSE_CHROMIUM_PATH)), weight: 100}); 167 | } 168 | 169 | if (process.env.CHROME_PATH) { 170 | priorities.unshift({regex: new RegExp(escapeRegExp(process.env.CHROME_PATH)), weight: 101}); 171 | } 172 | 173 | return sort(uniq(installations.filter(Boolean)), priorities); 174 | } 175 | 176 | export function wsl() { 177 | // Manually populate the environment variables assuming it's the default config 178 | process.env.LOCALAPPDATA = getWSLLocalAppDataPath(`${process.env.PATH}`); 179 | process.env.PROGRAMFILES = toWSLPath('C:/Program Files', '/mnt/c/Program Files'); 180 | process.env['PROGRAMFILES(X86)'] = 181 | toWSLPath('C:/Program Files (x86)', '/mnt/c/Program Files (x86)'); 182 | 183 | return win32(); 184 | } 185 | 186 | export function win32() { 187 | const installations: Array = []; 188 | const suffixes = [ 189 | `${path.sep}Google${path.sep}Chrome SxS${path.sep}Application${path.sep}chrome.exe`, 190 | `${path.sep}Google${path.sep}Chrome${path.sep}Application${path.sep}chrome.exe` 191 | ]; 192 | const prefixes = [ 193 | process.env.LOCALAPPDATA, process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)'] 194 | ].filter(Boolean) as string[]; 195 | 196 | const customChromePath = resolveChromePath(); 197 | if (customChromePath) { 198 | installations.push(customChromePath); 199 | } 200 | 201 | prefixes.forEach(prefix => suffixes.forEach(suffix => { 202 | const chromePath = path.join(prefix, suffix); 203 | if (canAccess(chromePath)) { 204 | installations.push(chromePath); 205 | } 206 | })); 207 | return installations; 208 | } 209 | 210 | function sort(installations: string[], priorities: Priorities) { 211 | const defaultPriority = 10; 212 | return installations 213 | // assign priorities 214 | .map((inst: string) => { 215 | for (const pair of priorities) { 216 | if (pair.regex.test(inst)) { 217 | return {path: inst, weight: pair.weight}; 218 | } 219 | } 220 | return {path: inst, weight: defaultPriority}; 221 | }) 222 | // sort based on priorities 223 | .sort((a, b) => (b.weight - a.weight)) 224 | // remove priority flag 225 | .map(pair => pair.path); 226 | } 227 | 228 | function canAccess(file: string|undefined): Boolean { 229 | if (!file) { 230 | return false; 231 | } 232 | 233 | try { 234 | fs.accessSync(file); 235 | return true; 236 | } catch (e) { 237 | return false; 238 | } 239 | } 240 | 241 | function uniq(arr: Array) { 242 | return Array.from(new Set(arr)); 243 | } 244 | 245 | function findChromeExecutables(folder: string): Array { 246 | const argumentsRegex = /(^[^ ]+).*/; // Take everything up to the first space 247 | const chromeExecRegex = '^Exec=\/.*\/(google-chrome|chrome|chromium)-.*'; 248 | 249 | let installations: Array = []; 250 | if (canAccess(folder)) { 251 | // Output of the grep & print looks like: 252 | // /opt/google/chrome/google-chrome --profile-directory 253 | // /home/user/Downloads/chrome-linux/chrome-wrapper %U 254 | let execPaths; 255 | 256 | // Some systems do not support grep -R so fallback to -r. 257 | // See https://github.com/GoogleChrome/chrome-launcher/issues/46 for more context. 258 | try { 259 | execPaths = execSync( 260 | `grep -ER "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`, {stdio: 'pipe'}); 261 | } catch (e) { 262 | execPaths = execSync( 263 | `grep -Er "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`, {stdio: 'pipe'}); 264 | } 265 | 266 | execPaths = execPaths.toString() 267 | .split(newLineRegex) 268 | .map((execPath: string) => execPath.replace(argumentsRegex, '$1')); 269 | 270 | execPaths.forEach((execPath: string) => canAccess(execPath) && installations.push(execPath)); 271 | } 272 | 273 | return installations; 274 | } 275 | -------------------------------------------------------------------------------- /src/chrome-launcher.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2016 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | import * as childProcess from 'child_process'; 9 | import * as fs from 'fs'; 10 | import * as net from 'net'; 11 | import * as chromeFinder from './chrome-finder.js'; 12 | import {getRandomPort} from './random-port.js'; 13 | import {DEFAULT_FLAGS} from './flags.js'; 14 | import {makeTmpDir, defaults, delay, getPlatform, toWin32Path, InvalidUserDataDirectoryError, UnsupportedPlatformError, ChromeNotInstalledError} from './utils.js'; 15 | import {ChildProcess} from 'child_process'; 16 | import {spawn, spawnSync} from 'child_process'; 17 | import log from 'lighthouse-logger'; 18 | 19 | const isWsl = getPlatform() === 'wsl'; 20 | const isWindows = getPlatform() === 'win32'; 21 | const _SIGINT = 'SIGINT'; 22 | const _SIGINT_EXIT_CODE = 130; 23 | const _SUPPORTED_PLATFORMS = new Set(['darwin', 'linux', 'win32', 'wsl']); 24 | 25 | type SupportedPlatforms = 'darwin'|'linux'|'win32'|'wsl'; 26 | 27 | const instances = new Set(); 28 | 29 | type JSONLike =|{[property: string]: JSONLike}|readonly JSONLike[]|string|number|boolean|null; 30 | 31 | export interface Options { 32 | startingUrl?: string; 33 | chromeFlags?: Array; 34 | prefs?: Record; 35 | port?: number; 36 | portStrictMode?: boolean; 37 | handleSIGINT?: boolean; 38 | chromePath?: string; 39 | userDataDir?: string|boolean; 40 | logLevel?: 'verbose'|'info'|'error'|'warn'|'silent'; 41 | ignoreDefaultFlags?: boolean; 42 | connectionPollInterval?: number; 43 | maxConnectionRetries?: number; 44 | envVars?: {[key: string]: string|undefined}; 45 | } 46 | 47 | export interface RemoteDebuggingPipes { 48 | incoming: NodeJS.ReadableStream, outgoing: NodeJS.WritableStream, 49 | } 50 | 51 | export interface LaunchedChrome { 52 | pid: number; 53 | port: number; 54 | process: ChildProcess; 55 | remoteDebuggingPipes: RemoteDebuggingPipes|null; 56 | kill: () => void; 57 | } 58 | 59 | export interface ModuleOverrides { 60 | fs?: typeof fs; 61 | spawn?: typeof childProcess.spawn; 62 | } 63 | 64 | const sigintListener = () => { 65 | killAll(); 66 | process.exit(_SIGINT_EXIT_CODE); 67 | }; 68 | 69 | async function launch(opts: Options = {}): Promise { 70 | opts.handleSIGINT = defaults(opts.handleSIGINT, true); 71 | 72 | const instance = new Launcher(opts); 73 | 74 | // Kill spawned Chrome process in case of ctrl-C. 75 | if (opts.handleSIGINT && instances.size === 0) { 76 | process.on(_SIGINT, sigintListener); 77 | } 78 | instances.add(instance); 79 | 80 | await instance.launch(); 81 | 82 | const kill = () => { 83 | instances.delete(instance); 84 | if (instances.size === 0) { 85 | process.removeListener(_SIGINT, sigintListener); 86 | } 87 | instance.kill(); 88 | }; 89 | 90 | return { 91 | pid: instance.pid!, 92 | port: instance.port!, 93 | process: instance.chromeProcess!, 94 | remoteDebuggingPipes: instance.remoteDebuggingPipes, 95 | kill, 96 | }; 97 | } 98 | 99 | /** Returns Chrome installation path that chrome-launcher will launch by default. */ 100 | function getChromePath(): string { 101 | const installation = Launcher.getFirstInstallation(); 102 | if (!installation) { 103 | throw new ChromeNotInstalledError(); 104 | } 105 | return installation; 106 | } 107 | 108 | function killAll(): Array { 109 | let errors = []; 110 | for (const instance of instances) { 111 | try { 112 | instance.kill(); 113 | // only delete if kill did not error 114 | // this means erroring instances remain in the Set 115 | instances.delete(instance); 116 | } catch (err) { 117 | errors.push(err); 118 | } 119 | } 120 | return errors; 121 | } 122 | 123 | class Launcher { 124 | private tmpDirandPidFileReady = false; 125 | private pidFile: string; 126 | private startingUrl: string; 127 | private outFile?: number; 128 | private errFile?: number; 129 | private chromePath?: string; 130 | private ignoreDefaultFlags?: boolean; 131 | private chromeFlags: string[]; 132 | private prefs: Record; 133 | private requestedPort?: number; 134 | private portStrictMode?: boolean; 135 | private useRemoteDebuggingPipe: boolean; 136 | private connectionPollInterval: number; 137 | private maxConnectionRetries: number; 138 | private fs: typeof fs; 139 | private spawn: typeof childProcess.spawn; 140 | private useDefaultProfile: boolean; 141 | private envVars: {[key: string]: string|undefined}; 142 | 143 | chromeProcess?: childProcess.ChildProcess; 144 | userDataDir?: string; 145 | port?: number; 146 | remoteDebuggingPipes: RemoteDebuggingPipes|null = null; 147 | pid?: number; 148 | 149 | constructor(private opts: Options = {}, moduleOverrides: ModuleOverrides = {}) { 150 | this.fs = moduleOverrides.fs || fs; 151 | this.spawn = moduleOverrides.spawn || spawn; 152 | 153 | log.setLevel(defaults(this.opts.logLevel, 'silent')); 154 | 155 | // choose the first one (default) 156 | this.startingUrl = defaults(this.opts.startingUrl, 'about:blank'); 157 | this.chromeFlags = defaults(this.opts.chromeFlags, []); 158 | this.prefs = defaults(this.opts.prefs, {}); 159 | this.requestedPort = defaults(this.opts.port, 0); 160 | this.portStrictMode = opts.portStrictMode; 161 | this.chromePath = this.opts.chromePath; 162 | this.ignoreDefaultFlags = defaults(this.opts.ignoreDefaultFlags, false); 163 | this.connectionPollInterval = defaults(this.opts.connectionPollInterval, 500); 164 | this.maxConnectionRetries = defaults(this.opts.maxConnectionRetries, 50); 165 | this.envVars = defaults(opts.envVars, Object.assign({}, process.env)); 166 | 167 | if (typeof this.opts.userDataDir === 'boolean') { 168 | if (!this.opts.userDataDir) { 169 | this.useDefaultProfile = true; 170 | this.userDataDir = undefined; 171 | } else { 172 | throw new InvalidUserDataDirectoryError(); 173 | } 174 | } else { 175 | this.useDefaultProfile = false; 176 | this.userDataDir = this.opts.userDataDir; 177 | } 178 | 179 | // Using startsWith because it could also be --remote-debugging-pipe=cbor 180 | this.useRemoteDebuggingPipe = 181 | this.chromeFlags.some(f => f.startsWith('--remote-debugging-pipe')); 182 | } 183 | 184 | private get flags() { 185 | const flags = this.ignoreDefaultFlags ? [] : DEFAULT_FLAGS.slice(); 186 | // When useRemoteDebuggingPipe is true, this.port defaults to 0. 187 | if (this.port) { 188 | flags.push(`--remote-debugging-port=${this.port}`); 189 | } 190 | 191 | if (!this.ignoreDefaultFlags && getPlatform() === 'linux') { 192 | flags.push('--disable-setuid-sandbox'); 193 | } 194 | 195 | if (!this.useDefaultProfile) { 196 | // Place Chrome profile in a custom location we'll rm -rf later 197 | // If in WSL, we need to use the Windows format 198 | flags.push(`--user-data-dir=${isWsl ? toWin32Path(this.userDataDir) : this.userDataDir}`); 199 | } 200 | 201 | if (process.env.HEADLESS) flags.push('--headless'); 202 | 203 | flags.push(...this.chromeFlags); 204 | flags.push(this.startingUrl); 205 | 206 | return flags; 207 | } 208 | 209 | static defaultFlags() { 210 | return DEFAULT_FLAGS.slice(); 211 | } 212 | 213 | /** Returns the highest priority chrome installation. */ 214 | static getFirstInstallation() { 215 | if (getPlatform() === 'darwin') return chromeFinder.darwinFast(); 216 | return chromeFinder[getPlatform() as SupportedPlatforms]()[0]; 217 | } 218 | 219 | /** Returns all available chrome installations in decreasing priority order. */ 220 | static getInstallations() { 221 | return chromeFinder[getPlatform() as SupportedPlatforms](); 222 | } 223 | 224 | // Wrapper function to enable easy testing. 225 | makeTmpDir() { 226 | return makeTmpDir(); 227 | } 228 | 229 | prepare() { 230 | const platform = getPlatform() as SupportedPlatforms; 231 | if (!_SUPPORTED_PLATFORMS.has(platform)) { 232 | throw new UnsupportedPlatformError(); 233 | } 234 | 235 | this.userDataDir = this.userDataDir || this.makeTmpDir(); 236 | this.outFile = this.fs.openSync(`${this.userDataDir}/chrome-out.log`, 'a'); 237 | this.errFile = this.fs.openSync(`${this.userDataDir}/chrome-err.log`, 'a'); 238 | 239 | this.setBrowserPrefs(); 240 | 241 | // fix for Node4 242 | // you can't pass a fd to fs.writeFileSync 243 | this.pidFile = `${this.userDataDir}/chrome.pid`; 244 | 245 | log.verbose('ChromeLauncher', `created ${this.userDataDir}`); 246 | 247 | this.tmpDirandPidFileReady = true; 248 | } 249 | 250 | private setBrowserPrefs() { 251 | // don't set prefs if not defined 252 | if (Object.keys(this.prefs).length === 0) { 253 | return; 254 | } 255 | 256 | const profileDir = `${this.userDataDir}/Default`; 257 | if (!this.fs.existsSync(profileDir)) { 258 | this.fs.mkdirSync(profileDir, {recursive: true}); 259 | } 260 | 261 | const preferenceFile = `${profileDir}/Preferences`; 262 | try { 263 | if (this.fs.existsSync(preferenceFile)) { 264 | // overwrite existing file 265 | const file = this.fs.readFileSync(preferenceFile, 'utf-8'); 266 | const content = JSON.parse(file); 267 | this.fs.writeFileSync(preferenceFile, JSON.stringify({...content, ...this.prefs}), 'utf-8'); 268 | } else { 269 | // create new Preference file 270 | this.fs.writeFileSync(preferenceFile, JSON.stringify({...this.prefs}), 'utf-8'); 271 | } 272 | } catch (err) { 273 | log.log('ChromeLauncher', `Failed to set browser prefs: ${err.message}`); 274 | } 275 | } 276 | 277 | async launch() { 278 | if (this.requestedPort !== 0) { 279 | this.port = this.requestedPort; 280 | 281 | // If an explict port is passed first look for an open connection... 282 | try { 283 | await this.isDebuggerReady(); 284 | log.log( 285 | 'ChromeLauncher', 286 | `Found existing Chrome already running using port ${this.port}, using that.`); 287 | return; 288 | } catch (err) { 289 | if (this.portStrictMode) { 290 | throw new Error(`found no Chrome at port ${this.requestedPort}`); 291 | } 292 | 293 | log.log( 294 | 'ChromeLauncher', 295 | `No debugging port found on port ${this.port}, launching a new Chrome.`); 296 | } 297 | } 298 | if (this.chromePath === undefined) { 299 | const installation = Launcher.getFirstInstallation(); 300 | if (!installation) { 301 | throw new ChromeNotInstalledError(); 302 | } 303 | 304 | this.chromePath = installation; 305 | } 306 | 307 | if (!this.tmpDirandPidFileReady) { 308 | this.prepare(); 309 | } 310 | 311 | this.pid = await this.spawnProcess(this.chromePath); 312 | return Promise.resolve(); 313 | } 314 | 315 | private async spawnProcess(execPath: string) { 316 | const spawnPromise = (async () => { 317 | if (this.chromeProcess) { 318 | log.log('ChromeLauncher', `Chrome already running with pid ${this.chromeProcess.pid}.`); 319 | return this.chromeProcess.pid; 320 | } 321 | 322 | 323 | // If a zero value port is set, it means the launcher 324 | // is responsible for generating the port number. 325 | // We do this here so that we can know the port before 326 | // we pass it into chrome. 327 | if (this.requestedPort === 0) { 328 | if (this.useRemoteDebuggingPipe) { 329 | // When useRemoteDebuggingPipe is true, this.port defaults to 0. 330 | this.port = 0; 331 | } else { 332 | this.port = await getRandomPort(); 333 | } 334 | } 335 | 336 | log.verbose( 337 | 'ChromeLauncher', `Launching with command:\n"${execPath}" ${this.flags.join(' ')}`); 338 | this.chromeProcess = this.spawn(execPath, this.flags, { 339 | // On non-windows platforms, `detached: true` makes child process a leader of a new 340 | // process group, making it possible to kill child process tree with `.kill(-pid)` command. 341 | // @see https://nodejs.org/api/child_process.html#child_process_options_detached 342 | detached: process.platform !== 'win32', 343 | stdio: this.useRemoteDebuggingPipe ? 344 | ['ignore', this.outFile, this.errFile, 'pipe', 'pipe'] : 345 | ['ignore', this.outFile, this.errFile], 346 | env: this.envVars 347 | }); 348 | 349 | if (this.chromeProcess.pid) { 350 | this.fs.writeFileSync(this.pidFile, this.chromeProcess.pid.toString()); 351 | } 352 | if (this.useRemoteDebuggingPipe) { 353 | this.remoteDebuggingPipes = { 354 | incoming: this.chromeProcess.stdio[4] as NodeJS.ReadableStream, 355 | outgoing: this.chromeProcess.stdio[3] as NodeJS.WritableStream, 356 | }; 357 | } 358 | 359 | log.verbose( 360 | 'ChromeLauncher', 361 | `Chrome running with pid ${this.chromeProcess.pid} on port ${this.port}.`); 362 | return this.chromeProcess.pid; 363 | })(); 364 | 365 | const pid = await spawnPromise; 366 | // When useRemoteDebuggingPipe is true, this.port defaults to 0. 367 | if (this.port !== 0) { 368 | await this.waitUntilReady(); 369 | } 370 | return pid; 371 | } 372 | 373 | private cleanup(client?: net.Socket) { 374 | if (client) { 375 | client.removeAllListeners(); 376 | client.end(); 377 | client.destroy(); 378 | client.unref(); 379 | } 380 | } 381 | 382 | // resolves if ready, rejects otherwise 383 | private isDebuggerReady(): Promise { 384 | return new Promise((resolve, reject) => { 385 | // Note: only meaningful when this.port is set. 386 | // When useRemoteDebuggingPipe is true, this.port defaults to 0. In that 387 | // case, we could consider ping-ponging over the pipe, but that may get 388 | // in the way of the library user, so we do not. 389 | const client = net.createConnection(this.port!, '127.0.0.1'); 390 | client.once('error', err => { 391 | this.cleanup(client); 392 | reject(err); 393 | }); 394 | client.once('connect', () => { 395 | this.cleanup(client); 396 | resolve(); 397 | }); 398 | }); 399 | } 400 | 401 | // resolves when debugger is ready, rejects after 10 polls 402 | waitUntilReady() { 403 | const launcher = this; 404 | 405 | return new Promise((resolve, reject) => { 406 | let retries = 0; 407 | let waitStatus = 'Waiting for browser.'; 408 | 409 | const poll = () => { 410 | if (retries === 0) { 411 | log.log('ChromeLauncher', waitStatus); 412 | } 413 | retries++; 414 | waitStatus += '..'; 415 | log.log('ChromeLauncher', waitStatus); 416 | 417 | launcher.isDebuggerReady() 418 | .then(() => { 419 | log.log('ChromeLauncher', waitStatus + `${log.greenify(log.tick)}`); 420 | resolve(); 421 | }) 422 | .catch(err => { 423 | if (retries > launcher.maxConnectionRetries) { 424 | log.error('ChromeLauncher', err.message); 425 | const stderr = 426 | this.fs.readFileSync(`${this.userDataDir}/chrome-err.log`, {encoding: 'utf-8'}); 427 | log.error( 428 | 'ChromeLauncher', `Logging contents of ${this.userDataDir}/chrome-err.log`); 429 | log.error('ChromeLauncher', stderr); 430 | return reject(err); 431 | } 432 | delay(launcher.connectionPollInterval).then(poll); 433 | }); 434 | }; 435 | poll(); 436 | }); 437 | } 438 | 439 | kill() { 440 | if (!this.chromeProcess) { 441 | return; 442 | } 443 | 444 | this.chromeProcess.on('close', () => { 445 | delete this.chromeProcess; 446 | this.destroyTmp(); 447 | }); 448 | 449 | log.log('ChromeLauncher', `Killing Chrome instance ${this.chromeProcess.pid}`); 450 | try { 451 | if (isWindows) { 452 | // https://github.com/GoogleChrome/chrome-launcher/issues/266 453 | const taskkillProc = spawnSync( 454 | `taskkill /pid ${this.chromeProcess.pid} /T /F`, {shell: true, encoding: 'utf-8'}); 455 | 456 | const {stderr} = taskkillProc; 457 | if (stderr) log.error('ChromeLauncher', `taskkill stderr`, stderr); 458 | } else { 459 | if (this.chromeProcess.pid) { 460 | process.kill(-this.chromeProcess.pid, 'SIGKILL'); 461 | } 462 | } 463 | } catch (err) { 464 | const message = `Chrome could not be killed ${err.message}`; 465 | log.warn('ChromeLauncher', message); 466 | } 467 | this.destroyTmp(); 468 | } 469 | 470 | destroyTmp() { 471 | if (this.outFile) { 472 | this.fs.closeSync(this.outFile); 473 | delete this.outFile; 474 | } 475 | 476 | // Only clean up the tmp dir if we created it. 477 | if (this.userDataDir === undefined || this.opts.userDataDir !== undefined) { 478 | return; 479 | } 480 | 481 | if (this.errFile) { 482 | this.fs.closeSync(this.errFile); 483 | delete this.errFile; 484 | } 485 | 486 | // backwards support for node v12 + v14.14+ 487 | // https://nodejs.org/api/deprecations.html#DEP0147 488 | const rmSync = this.fs.rmSync || this.fs.rmdirSync; 489 | rmSync(this.userDataDir, {recursive: true, force: true, maxRetries: 10}); 490 | } 491 | }; 492 | 493 | export default Launcher; 494 | export {Launcher, launch, killAll, getChromePath}; 495 | -------------------------------------------------------------------------------- /src/flags.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2017 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | /** 9 | * See the following `chrome-flags-for-tools.md` for exhaustive coverage of these and related flags 10 | * @url https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md 11 | */ 12 | 13 | export const DEFAULT_FLAGS: ReadonlyArray = [ 14 | '--disable-features=' + 15 | [ 16 | // Disable built-in Google Translate service 17 | 'Translate', 18 | // Disable the Chrome Optimization Guide background networking 19 | 'OptimizationHints', 20 | // Disable the Chrome Media Router (cast target discovery) background networking 21 | 'MediaRouter', 22 | /// Avoid the startup dialog for _Do you want the application “Chromium.app” to accept incoming network connections?_. This is a sub-component of the MediaRouter. 23 | 'DialMediaRouteProvider', 24 | // Disable the feature of: Calculate window occlusion on Windows will be used in the future to throttle and potentially unload foreground tabs in occluded windows. 25 | 'CalculateNativeWinOcclusion', 26 | // Disables the Discover feed on NTP 27 | 'InterestFeedContentSuggestions', 28 | // Don't update the CT lists 29 | 'CertificateTransparencyComponentUpdater', 30 | // Disables autofill server communication. This feature isn't disabled via other 'parent' flags. 31 | 'AutofillServerCommunication', 32 | // Disables "Enhanced ad privacy in Chrome" dialog (though as of 2024-03-20 it shouldn't show up if the profile has no stored country). 33 | 'PrivacySandboxSettings4', 34 | ].join(','), 35 | 36 | // Disable all chrome extensions 37 | '--disable-extensions', 38 | // Disable some extensions that aren't affected by --disable-extensions 39 | '--disable-component-extensions-with-background-pages', 40 | // Disable various background network services, including extension updating, 41 | // safe browsing service, upgrade detector, translate, UMA 42 | '--disable-background-networking', 43 | // Don't update the browser 'components' listed at chrome://components/ 44 | '--disable-component-update', 45 | // Disables client-side phishing detection. 46 | '--disable-client-side-phishing-detection', 47 | // Disable syncing to a Google account 48 | '--disable-sync', 49 | // Disable reporting to UMA, but allows for collection 50 | '--metrics-recording-only', 51 | // Disable installation of default apps on first run 52 | '--disable-default-apps', 53 | // Mute any audio 54 | '--mute-audio', 55 | // Disable the default browser check, do not prompt to set it as such 56 | '--no-default-browser-check', 57 | // Skip first run wizards 58 | '--no-first-run', 59 | // Disable backgrounding renders for occluded windows 60 | '--disable-backgrounding-occluded-windows', 61 | // Disable renderer process backgrounding 62 | '--disable-renderer-backgrounding', 63 | // Disable task throttling of timer tasks from background pages. 64 | '--disable-background-timer-throttling', 65 | // Disable the default throttling of IPC between renderer & browser processes. 66 | '--disable-ipc-flooding-protection', 67 | // Avoid potential instability of using Gnome Keyring or KDE wallet. crbug.com/571003 crbug.com/991424 68 | '--password-store=basic', 69 | // Use mock keychain on Mac to prevent blocking permissions dialogs 70 | '--use-mock-keychain', 71 | // Disable background tracing (aka slow reports & deep reports) to avoid 'Tracing already started' 72 | '--force-fieldtrials=*BackgroundTracing/default/', 73 | 74 | // Suppresses hang monitor dialogs in renderer processes. This flag may allow slow unload handlers on a page to prevent the tab from closing. 75 | '--disable-hang-monitor', 76 | // Reloading a page that came from a POST normally prompts the user. 77 | '--disable-prompt-on-repost', 78 | // Disables Domain Reliability Monitoring, which tracks whether the browser has difficulty contacting Google-owned sites and uploads reports to Google. 79 | '--disable-domain-reliability', 80 | // Disable the in-product Help (IPH) system. 81 | '--propagate-iph-for-testing', 82 | ]; 83 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './chrome-launcher.js'; 2 | -------------------------------------------------------------------------------- /src/random-port.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2016 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | import {createServer} from 'http'; 9 | import {AddressInfo} from 'net'; 10 | 11 | /** 12 | * Return a random, unused port. 13 | */ 14 | export function getRandomPort(): Promise { 15 | return new Promise((resolve, reject) => { 16 | const server = createServer(); 17 | server.listen(0); 18 | server.once('listening', () => { 19 | const {port} = server.address() as AddressInfo; 20 | server.close(() => resolve(port)); 21 | }); 22 | server.once('error', reject); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2017 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | import {join} from 'path'; 9 | import childProcess from 'child_process'; 10 | import {mkdirSync} from 'fs'; 11 | import isWsl from 'is-wsl'; 12 | 13 | export const enum LaunchErrorCodes { 14 | ERR_LAUNCHER_PATH_NOT_SET = 'ERR_LAUNCHER_PATH_NOT_SET', 15 | ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY = 'ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY', 16 | ERR_LAUNCHER_UNSUPPORTED_PLATFORM = 'ERR_LAUNCHER_UNSUPPORTED_PLATFORM', 17 | ERR_LAUNCHER_NOT_INSTALLED = 'ERR_LAUNCHER_NOT_INSTALLED', 18 | } 19 | 20 | export function defaults(val: T|undefined, def: T): T { 21 | return typeof val === 'undefined' ? def : val; 22 | } 23 | 24 | export async function delay(time: number) { 25 | return new Promise(resolve => setTimeout(resolve, time)); 26 | } 27 | 28 | export class LauncherError extends Error { 29 | constructor(public message: string = 'Unexpected error', public code?: string) { 30 | super(); 31 | this.stack = new Error().stack; 32 | return this; 33 | } 34 | } 35 | 36 | export class ChromePathNotSetError extends LauncherError { 37 | message = 38 | 'The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.'; 39 | code = LaunchErrorCodes.ERR_LAUNCHER_PATH_NOT_SET; 40 | } 41 | 42 | export class InvalidUserDataDirectoryError extends LauncherError { 43 | message = 'userDataDir must be false or a path.'; 44 | code = LaunchErrorCodes.ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY; 45 | } 46 | 47 | export class UnsupportedPlatformError extends LauncherError { 48 | message = `Platform ${getPlatform()} is not supported.`; 49 | code = LaunchErrorCodes.ERR_LAUNCHER_UNSUPPORTED_PLATFORM; 50 | } 51 | 52 | export class ChromeNotInstalledError extends LauncherError { 53 | message = 'No Chrome installations found.'; 54 | code = LaunchErrorCodes.ERR_LAUNCHER_NOT_INSTALLED; 55 | } 56 | 57 | export function getPlatform() { 58 | return isWsl ? 'wsl' : process.platform; 59 | } 60 | 61 | export function makeTmpDir() { 62 | switch (getPlatform()) { 63 | case 'darwin': 64 | case 'linux': 65 | return makeUnixTmpDir(); 66 | case 'wsl': 67 | // We populate the user's Windows temp dir so the folder is correctly created later 68 | process.env.TEMP = getWSLLocalAppDataPath(`${process.env.PATH}`); 69 | case 'win32': 70 | return makeWin32TmpDir(); 71 | default: 72 | throw new UnsupportedPlatformError(); 73 | } 74 | } 75 | 76 | function toWinDirFormat(dir: string = ''): string { 77 | const results = /\/mnt\/([a-z])\//.exec(dir); 78 | 79 | if (!results) { 80 | return dir; 81 | } 82 | 83 | const driveLetter = results[1]; 84 | return dir.replace(`/mnt/${driveLetter}/`, `${driveLetter.toUpperCase()}:\\`) 85 | .replace(/\//g, '\\'); 86 | } 87 | 88 | export function toWin32Path(dir: string = ''): string { 89 | if (/[a-z]:\\/iu.test(dir)) { 90 | return dir; 91 | } 92 | 93 | try { 94 | return childProcess.execFileSync('wslpath', ['-w', dir]).toString().trim(); 95 | } catch { 96 | return toWinDirFormat(dir); 97 | } 98 | } 99 | 100 | export function toWSLPath(dir: string, fallback: string): string { 101 | try { 102 | return childProcess.execFileSync('wslpath', ['-u', dir]).toString().trim(); 103 | } catch { 104 | return fallback; 105 | } 106 | } 107 | 108 | function getLocalAppDataPath(path: string): string { 109 | const userRegExp = /\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//; 110 | const results = userRegExp.exec(path) || []; 111 | 112 | return `/mnt/${results[1]}/Users/${results[2]}/AppData/Local`; 113 | } 114 | 115 | export function getWSLLocalAppDataPath(path: string): string { 116 | const userRegExp = /\/([a-z])\/Users\/([^\/:]+)\/AppData\//; 117 | const results = userRegExp.exec(path) || []; 118 | 119 | return toWSLPath( 120 | `${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(path)); 121 | } 122 | 123 | function makeUnixTmpDir() { 124 | return childProcess.execSync('mktemp -d -t lighthouse.XXXXXXX').toString().trim(); 125 | } 126 | 127 | function makeWin32TmpDir() { 128 | const winTmpPath = process.env.TEMP || process.env.TMP || 129 | (process.env.SystemRoot || process.env.windir) + '\\temp'; 130 | const randomNumber = Math.floor(Math.random() * 9e7 + 1e7); 131 | const tmpdir = join(winTmpPath, 'lighthouse.' + randomNumber); 132 | 133 | mkdirSync(tmpdir, {recursive: true}); 134 | return tmpdir; 135 | } 136 | 137 | export {childProcess as _childProcessForTesting}; 138 | -------------------------------------------------------------------------------- /test/check-formatting.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | check_formatting () 4 | { 5 | diff -u <(cat $1) <(./node_modules/.bin/clang-format -style=file $1) &>/dev/null 6 | if [ $? -eq 1 ] 7 | then 8 | echo "Error: formatting is required for *.ts files:" 9 | echo " cd chrome-launcher" 10 | echo " yarn format" 11 | exit 1 12 | fi 13 | } 14 | 15 | check_formatting "`find src -type f -name '*.ts'`" 16 | -------------------------------------------------------------------------------- /test/chrome-launcher-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2016 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 'use strict'; 7 | 8 | import {Launcher, launch, killAll, Options, getChromePath} from '../src/chrome-launcher.js'; 9 | import {DEFAULT_FLAGS} from '../src/flags.js'; 10 | 11 | import sinon from 'sinon'; 12 | import * as assert from 'assert'; 13 | import fs from 'fs'; 14 | 15 | import log from 'lighthouse-logger'; 16 | 17 | const {spy, stub} = sinon; 18 | 19 | const fsMock = { 20 | openSync: () => {}, 21 | closeSync: () => {}, 22 | writeFileSync: () => {}, 23 | rmdirSync: () => {}, 24 | rmSync: () => {}, 25 | }; 26 | 27 | const launchChromeWithOpts = async (opts: Options = {}) => { 28 | const spawnStub = stub().returns({pid: 'some_pid', stdio: []}); 29 | 30 | const chromeInstance = 31 | new Launcher(opts, {fs: fsMock as any, spawn: spawnStub as any}); 32 | stub(chromeInstance, 'waitUntilReady').returns(Promise.resolve()); 33 | 34 | chromeInstance.prepare(); 35 | 36 | try { 37 | await chromeInstance.launch(); 38 | return Promise.resolve(spawnStub); 39 | } catch (err) { 40 | return Promise.reject(err); 41 | } 42 | }; 43 | 44 | describe('Launcher', () => { 45 | beforeEach(() => { 46 | log.setLevel('error'); 47 | }); 48 | 49 | afterEach(() => { 50 | log.setLevel(''); 51 | }); 52 | 53 | it('sets default launching flags', async () => { 54 | const spawnStub = await launchChromeWithOpts({userDataDir: 'some_path'}); 55 | const chromeFlags = spawnStub.getCall(0).args[1] as string[]; 56 | assert.ok(chromeFlags.find(f => f.startsWith('--remote-debugging-port'))) 57 | assert.ok(chromeFlags.find(f => f.startsWith('--disable-background-networking'))) 58 | assert.strictEqual(chromeFlags[chromeFlags.length - 1], 'about:blank'); 59 | }); 60 | 61 | it('accepts and uses a custom path', async () => { 62 | const fs = {...fsMock, rmdirSync: spy(), rmSync: spy()}; 63 | const chromeInstance = 64 | new Launcher({userDataDir: 'some_path'}, {fs: fs as any}); 65 | 66 | chromeInstance.prepare(); 67 | 68 | chromeInstance.destroyTmp(); 69 | assert.strictEqual(fs.rmdirSync.callCount, 0); 70 | assert.strictEqual(fs.rmSync.callCount, 0); 71 | }); 72 | 73 | it('allows to overwrite browser prefs', async () => { 74 | const existStub = stub().returns(true) 75 | const readFileStub = stub().returns(JSON.stringify({ some: 'prefs' })) 76 | const writeFileStub = stub() 77 | const mkdirStub = stub() 78 | const fs = {...fsMock, rmdir: spy(), readFileSync: readFileStub, writeFileSync: writeFileStub, existsSync: existStub, mkdirSync: mkdirStub }; 79 | const chromeInstance = 80 | new Launcher({prefs: {'download.default_directory': '/some/dir'}}, {fs: fs as any}); 81 | 82 | chromeInstance.prepare(); 83 | assert.equal( 84 | writeFileStub.getCall(0).args[1], 85 | '{"some":"prefs","download.default_directory":"/some/dir"}' 86 | ) 87 | }); 88 | 89 | it('allows to set browser prefs', async () => { 90 | const existStub = stub().returns(false) 91 | const readFileStub = stub().returns(Buffer.from(JSON.stringify({ some: 'prefs' }))) 92 | const writeFileStub = stub() 93 | const mkdirStub = stub() 94 | const fs = {...fsMock, rmdir: spy(), readFileSync: readFileStub, writeFileSync: writeFileStub, existsSync: existStub, mkdirSync: mkdirStub }; 95 | const chromeInstance = 96 | new Launcher({prefs: {'download.default_directory': '/some/dir'}}, {fs: fs as any}); 97 | 98 | chromeInstance.prepare(); 99 | assert.equal(readFileStub.getCalls().length, 0) 100 | assert.equal( 101 | writeFileStub.getCall(0).args[1], 102 | '{"download.default_directory":"/some/dir"}' 103 | ) 104 | }); 105 | 106 | it('cleans up the tmp dir after closing (mocked)', async () => { 107 | const rmMock = stub().callsFake((_path, _options) => {}); 108 | const fs = {...fsMock, rmdirSync: rmMock, rmSync: rmMock}; 109 | 110 | const chromeInstance = new Launcher({}, {fs: fs as any}); 111 | 112 | chromeInstance.prepare(); 113 | chromeInstance.destroyTmp(); 114 | assert.strictEqual(rmMock.callCount, 1); 115 | }); 116 | 117 | 118 | it('cleans up the tmp dir after closing (real)', async () => { 119 | const rmSpy = spy(fs, 'rmSync' in fs ? 'rmSync' : 'rmdirSync'); 120 | const fsFake = {...fsMock, rmdirSync: rmSpy, rmSync: rmSpy}; 121 | 122 | const chromeInstance = new Launcher({}, {fs: fsFake as any}); 123 | 124 | await chromeInstance.launch(); 125 | assert.ok(chromeInstance.userDataDir); 126 | assert.ok(fs.existsSync(chromeInstance.userDataDir)); 127 | 128 | chromeInstance.kill(); 129 | 130 | // tmpdir is gone 131 | const [path] = fsFake.rmSync.getCall(0).args; 132 | assert.strictEqual(chromeInstance.userDataDir, path); 133 | assert.equal(fs.existsSync(path), false, `userdatadir still exists: ${path}`); 134 | }).timeout(30 * 1000); 135 | 136 | it('does not delete created directory when custom path passed', () => { 137 | const chromeInstance = new Launcher({userDataDir: 'some_path'}, {fs: fsMock as any}); 138 | 139 | chromeInstance.prepare(); 140 | assert.strictEqual(chromeInstance.userDataDir, 'some_path'); 141 | }); 142 | 143 | it('defaults to genering a tmp dir when no data dir is passed', () => { 144 | const chromeInstance = new Launcher({}, {fs: fsMock as any}); 145 | const originalMakeTmp = chromeInstance.makeTmpDir; 146 | chromeInstance.makeTmpDir = () => 'tmp_dir' 147 | chromeInstance.prepare() 148 | assert.strictEqual(chromeInstance.userDataDir, 'tmp_dir'); 149 | 150 | // Restore the original fn. 151 | chromeInstance.makeTmpDir = originalMakeTmp; 152 | }); 153 | 154 | it('doesn\'t fail when killed twice', async () => { 155 | const chromeInstance = new Launcher(); 156 | await chromeInstance.launch(); 157 | chromeInstance.kill(); 158 | chromeInstance.kill(); 159 | }).timeout(30 * 1000); 160 | 161 | it('doesn\'t fail when killing all instances', async () => { 162 | await launch(); 163 | await launch(); 164 | const errors = killAll(); 165 | assert.strictEqual(errors.length, 0); 166 | }); 167 | 168 | it('doesn\'t launch multiple chrome processes', async () => { 169 | const chromeInstance = new Launcher(); 170 | await chromeInstance.launch(); 171 | let pid = chromeInstance.pid!; 172 | await chromeInstance.launch(); 173 | assert.strictEqual(pid, chromeInstance.pid); 174 | chromeInstance.kill(); 175 | }); 176 | 177 | it('gets all default flags', async () => { 178 | const flags = Launcher.defaultFlags(); 179 | assert.ok(flags.length); 180 | assert.deepStrictEqual(flags, DEFAULT_FLAGS); 181 | }); 182 | 183 | it('does not allow mutating default flags', async () => { 184 | const flags = Launcher.defaultFlags(); 185 | flags.push('--new-flag'); 186 | const currentDefaultFlags = Launcher.defaultFlags().slice(); 187 | assert.notDeepStrictEqual(flags, currentDefaultFlags); 188 | }); 189 | 190 | it('does not mutate default flags when launching', async () => { 191 | const originalDefaultFlags = Launcher.defaultFlags().slice(); 192 | await launchChromeWithOpts(); 193 | const currentDefaultFlags = Launcher.defaultFlags().slice(); 194 | assert.deepStrictEqual(originalDefaultFlags, currentDefaultFlags); 195 | }); 196 | 197 | it('removes all default flags', async () => { 198 | const spawnStub = await launchChromeWithOpts({ignoreDefaultFlags: true}); 199 | const chromeFlags = spawnStub.getCall(0).args[1] as string[]; 200 | assert.ok(!chromeFlags.includes('--disable-extensions')); 201 | }); 202 | 203 | it('searches for available installations', async () => { 204 | const installations = Launcher.getInstallations(); 205 | assert.ok(Array.isArray(installations)); 206 | assert.ok(installations.length >= 1); 207 | }).timeout(30_000); 208 | 209 | it('removes --user-data-dir if userDataDir is false', async () => { 210 | const spawnStub = await launchChromeWithOpts(); 211 | const chromeFlags = spawnStub.getCall(0).args[1] as string[]; 212 | assert.ok(!chromeFlags.includes('--user-data-dir')); 213 | }); 214 | 215 | it('passes no env vars when none are passed', async () => { 216 | const spawnStub = await launchChromeWithOpts(); 217 | const spawnOptions = spawnStub.getCall(0).args[2] as {env: {}}; 218 | assert.deepStrictEqual(spawnOptions.env, Object.assign({}, process.env)); 219 | }); 220 | 221 | it('passes env vars when passed', async () => { 222 | const envVars = {'hello': 'world'}; 223 | const spawnStub = await launchChromeWithOpts({envVars}); 224 | const spawnOptions = spawnStub.getCall(0).args[2] as {env: {}}; 225 | assert.deepStrictEqual(spawnOptions.env, envVars); 226 | }); 227 | 228 | it('ensure specific flags are present when passed and defaults are ignored', async () => { 229 | const spawnStub = await launchChromeWithOpts({ 230 | ignoreDefaultFlags: true, 231 | chromeFlags: ['--disable-extensions', '--mute-audio', '--no-first-run'] 232 | }); 233 | const chromeFlags = spawnStub.getCall(0).args[1] as string[]; 234 | assert.ok(chromeFlags.includes('--mute-audio')); 235 | assert.ok(chromeFlags.includes('--disable-extensions')); 236 | 237 | // Make sure that default flags are not present 238 | assert.ok(!chromeFlags.includes('--disable-background-networking')); 239 | assert.ok(!chromeFlags.includes('--disable-default-app')); 240 | }); 241 | 242 | it('throws an error when chromePath is empty', (done) => { 243 | const chromeInstance = new Launcher({chromePath: ''}); 244 | chromeInstance.launch().catch(() => done()); 245 | }); 246 | 247 | describe('remote-debugging-pipe flag', () => { 248 | // These tests perform some basic tests on the expected effects of passing 249 | // the --remote-debugging-pipe flag. There is a real end-to-end example in 250 | // load-extension-test.ts. 251 | it('remote-debugging-pipe flag adds pipes expected by Chrome', async () => { 252 | const spawnStub = await launchChromeWithOpts({chromeFlags: ['--remote-debugging-pipe']}); 253 | const stdioAndPipes = spawnStub.getCall(0).args[2].stdio as string[]; 254 | assert.equal(stdioAndPipes.length, 5, 'Passed pipes to Chrome'); 255 | assert.equal(stdioAndPipes[3], 'pipe', 'Fourth pipe is pipe'); 256 | assert.equal(stdioAndPipes[4], 'pipe', 'Fifth pipe is pipe'); 257 | }); 258 | 259 | it('without remote-debugging-pipe flag, no pipes', async () => { 260 | const spawnStub = await launchChromeWithOpts({}); 261 | const stdioAndPipes = spawnStub.getCall(0).args[2].stdio as string[]; 262 | assert.equal(stdioAndPipes.length, 3, 'Only standard stdio pipes'); 263 | }); 264 | 265 | it('remote-debugging-pipe flag without remote-debugging-port', async () => { 266 | const spawnStub = await launchChromeWithOpts({chromeFlags: ['--remote-debugging-pipe']}); 267 | const chromeFlags = spawnStub.getCall(0).args[1] as string[]; 268 | assert.notEqual(chromeFlags.indexOf('--remote-debugging-pipe'), -1); 269 | assert.ok( 270 | !chromeFlags.find(f => f.startsWith('--remote-debugging-port')), 271 | '--remote-debugging-port should be unset'); 272 | }); 273 | 274 | it('remote-debugging-pipe flag with value is also accepted', async () => { 275 | // Chrome's source code indicates that it may support formats other than 276 | // JSON, as an explicit value. Here is an example of what it could look 277 | // like. Since chrome-launcher does not interpret the data in the pipes, 278 | // we can support arbitrary types. 279 | const spawnStub = await launchChromeWithOpts({chromeFlags: ['--remote-debugging-pipe=cbor']}); 280 | const stdioAndPipes = spawnStub.getCall(0).args[2].stdio as string[]; 281 | assert.equal(stdioAndPipes.length, 5); 282 | }); 283 | }); 284 | 285 | describe('getChromePath', async () => { 286 | it('returns the same path as a full Launcher launch', async () => { 287 | const spawnStub = await launchChromeWithOpts(); 288 | const launchedPath = spawnStub.getCall(0).args[0] as string; 289 | 290 | const chromePath = getChromePath(); 291 | assert.strictEqual(chromePath, launchedPath); 292 | }); 293 | }); 294 | }); 295 | -------------------------------------------------------------------------------- /test/chrome_extension_fixture/background.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | chrome.runtime.onInstalled.addListener(() => { 4 | injectContentScriptIfNeeded(); 5 | }); 6 | 7 | async function injectContentScriptIfNeeded() { 8 | // If the web page loaded before the extension did, then we have to schedule 9 | // execution from here. 10 | const tabs = await chrome.tabs.query({ url: "*://*/start_extension_test" }); 11 | console.log(`BG: Found ${tabs.length} tabs with start_extension_test`); 12 | for (const tab of tabs) { 13 | chrome.scripting.executeScript({ 14 | target: { tabId: tab.id }, 15 | files: ["contentscript.js"], 16 | }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/chrome_extension_fixture/contentscript.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | if (!window.firstRunOfExtension) { 4 | window.firstRunOfExtension = true; 5 | notifyTestServer(); 6 | } 7 | 8 | async function notifyTestServer() { 9 | try { 10 | let res = await fetch(new URL('/hello_from_extension', location.origin)); 11 | console.log(`Notified server, status: ${res.status}`); 12 | } catch (e) { 13 | console.error(`Unexpected error: ${e}`); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/chrome_extension_fixture/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Extension calls back to test server", 3 | "version": "1", 4 | "manifest_version": 3, 5 | "background": { 6 | "scripts": ["background.js"], 7 | "service_worker": "background.js" 8 | }, 9 | "content_scripts": [{ 10 | "js": ["contentscript.js"], 11 | "matches": ["*://*/start_extension_test"] 12 | }], 13 | "permissions": ["tabs", "scripting"], 14 | "host_permissions": ["*://*/*"], 15 | "description": "Extension calls back to test server; key in manifest fixes extension ID to: gpehbnajinmdnomnoadgbmkjoohjfjco", 16 | "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4lw1K+Rjtxei6dDA+DIBrGM4kDVR2TWISibAaF7LbDONI1SMS7NN/TkkKqIjVy6xHgBWnNvOahqkT4ltou4bkQpdLP102JKq/4b2FDX+u9pJozxCQqEY7eExvEIduFYcuswQ6QuFFJmiStyKLYqcZKdRuLD6yBNbG+p2mr11PrXzSBzu+9o98yysXNhHphogv02Kev7GTbme58FUHyb8fI8nPgi3KzzzzJAPgJkIpHRRBtkDSelQ0+9XjZPOxxPW0n4yHXDD/tIA0VpZJUGiDwRRZD9bzuxyMf/midlUA5jbGHdcdC5tgDH4PiBQp2AeowRXd1ww+kVwLvcaVhnqewIDAQAB" 17 | } 18 | -------------------------------------------------------------------------------- /test/launch-signature-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright 2017 Google Inc. All Rights Reserved. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 5 | */ 6 | 7 | 'use strict'; 8 | 9 | import {launch} from '../src/index.js'; 10 | import * as assert from 'assert'; 11 | 12 | import log from 'lighthouse-logger'; 13 | 14 | describe('Launcher', () => { 15 | 16 | beforeEach(() => { 17 | log.setLevel('error'); 18 | }); 19 | 20 | afterEach(() => { 21 | log.setLevel(''); 22 | }); 23 | 24 | it('exposes expected interface when launched', async () => { 25 | const chrome = await launch(); 26 | assert.notStrictEqual(chrome.process, undefined); 27 | assert.notStrictEqual(chrome.pid, undefined); 28 | assert.notStrictEqual(chrome.port, undefined); 29 | assert.notStrictEqual(chrome.kill, undefined); 30 | chrome.kill(); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /test/load-extension-test.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @license Copyright 2016 Google Inc. All Rights Reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 5 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 6 | */ 7 | 'use strict'; 8 | 9 | import * as ChromeLauncher from '../src/chrome-launcher.js'; 10 | import * as assert from 'assert'; 11 | 12 | import log from 'lighthouse-logger'; 13 | 14 | import {createServer} from 'http'; 15 | import {AddressInfo} from 'net'; 16 | import {fileURLToPath} from 'url'; 17 | 18 | // Awaited is in TypeScript 4.5, but the project uses typescript@^4.1.2 19 | type Awaited = T extends Promise? U : T 20 | 21 | /** 22 | * Create test server listening at localhost to detect extension execution 23 | * via a request to /hello_from_extension. 24 | */ 25 | async function startTestServer() { 26 | let resolveHelloFromExtension: Function; 27 | const promiseHelloFromExtension = new Promise(resolve => { 28 | resolveHelloFromExtension = resolve; 29 | }); 30 | const server = createServer((req, res) => { 31 | if (req.url === '/start_extension_test') { 32 | res.end('Start page so extension can discover the URL at runtime'); 33 | return; 34 | } 35 | if (req.url === '/hello_from_extension') { 36 | res.end(); // Don't care about response. 37 | resolveHelloFromExtension(); 38 | return; 39 | } 40 | // favicon.ico, etc. 41 | res.writeHead(404); 42 | res.end(); 43 | }); 44 | const port = await new Promise((resolve, reject) => { 45 | server.listen(0, '127.0.0.1'); 46 | server.once('listening', () => { 47 | resolve((server.address() as AddressInfo).port); 48 | }); 49 | 50 | server.once('error', reject); 51 | }); 52 | return { 53 | promiseHelloFromExtension, 54 | startUrl: `http://127.0.0.1:${port}/start_extension_test`, 55 | close: () => new Promise(resolve => server.close(() => resolve(undefined))), 56 | }; 57 | } 58 | 59 | function getFilePath(fixtureName: string) { 60 | return fileURLToPath(import.meta.url.replace('load-extension-test.ts', fixtureName)); 61 | } 62 | 63 | describe('Load extension', () => { 64 | let server: Awaited>; 65 | 66 | beforeEach(async () => { 67 | log.setLevel('error'); 68 | }); 69 | 70 | afterEach(async () => { 71 | log.setLevel(''); 72 | await server?.close(); 73 | }); 74 | 75 | // Note: --load-extension in chromeFlags used to be the primary method of 76 | // loading extensions, but this is removed from official stable Chrome builds 77 | // starting from Chrome 137. This shows the officially supported way to load 78 | // extensions, with --remote-debugging-pipe. 79 | // See: "Removing the `--load-extension` flag in branded Chrome builds" 80 | // https://groups.google.com/a/chromium.org/g/chromium-extensions/c/aEHdhDZ-V0E/m/UWP4-k32AgAJ 81 | it('loadExtension via remote-debugging-pipe', async () => { 82 | server = await startTestServer(); 83 | 84 | const chromeFlags = 85 | ChromeLauncher.Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions'); 86 | chromeFlags.push('--remote-debugging-pipe', '--enable-unsafe-extension-debugging'); 87 | const chromeInstance = await ChromeLauncher.launch({ 88 | ignoreDefaultFlags: true, // Keep --disable-extensions out of flags 89 | chromeFlags, 90 | startingUrl: server.startUrl, 91 | }); 92 | assert.equal(chromeInstance.port, 0, 'No --remote-debugging-port'); 93 | 94 | const remoteDebuggingPipes = chromeInstance.remoteDebuggingPipes!; 95 | 96 | let firstResponsePromise = new Promise((resolve, reject) => { 97 | remoteDebuggingPipes.incoming.on('error', error => reject(error)); 98 | remoteDebuggingPipes.incoming.on('close', () => { 99 | // If resolve() has not been called yet, consider it failed. 100 | // Note that the pipe closes if the process exits early. 101 | reject(new Error('Pipe closed before a response was received')); 102 | }); 103 | // When the first data listener is added, the stream starts flowing. 104 | // Always add a listener, even if you don't use it; otherwise the pipe 105 | // will be clogged with data and Chrome may fail to write eventually. 106 | let pendingMessages = ''; 107 | remoteDebuggingPipes.incoming.on('data', chunk => { 108 | pendingMessages += chunk; 109 | let end = pendingMessages.indexOf('\x00'); 110 | while (end !== -1) { 111 | const wholeMessage = pendingMessages.slice(0, end); 112 | pendingMessages = pendingMessages.slice(end + 1); // +1 = skip \x00. 113 | end = pendingMessages.indexOf('\x00'); 114 | 115 | // Handle response. In this specific test, we expect only one 116 | // response, so let's resolve immediately. 117 | resolve(JSON.parse(wholeMessage)); 118 | } 119 | }); 120 | }); 121 | const request = { 122 | id: 1337, // NOTE: should be a unique integer, e.g. a random value. 123 | method: 'Extensions.loadUnpacked', 124 | params: {path: getFilePath('chrome_extension_fixture')}, 125 | }; 126 | remoteDebuggingPipes.outgoing.write(JSON.stringify(request) + '\x00'); 127 | const expectedResponse = { 128 | id: 1337, 129 | result: {id: 'gpehbnajinmdnomnoadgbmkjoohjfjco'}, 130 | }; 131 | const response = await firstResponsePromise; 132 | assert.deepStrictEqual(response, expectedResponse); 133 | 134 | await server.promiseHelloFromExtension; 135 | assert.ok(true, 'Extension executed code and notified our test server.'); 136 | chromeInstance.kill(); 137 | }); 138 | }); 139 | -------------------------------------------------------------------------------- /test/random-port-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Google Inc. All Rights Reserved. 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 | * http://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 | 'use strict'; 17 | 18 | import * as assert from 'assert'; 19 | import {getRandomPort} from '../src/random-port.js'; 20 | 21 | describe('Random port generation', () => { 22 | it('generates a valid random port number', async () => { 23 | const port = await getRandomPort(); 24 | // Verify generated port number is valid integer. 25 | assert.ok(Number.isInteger(port) && port > 0 && port <= 0xFFFF); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /test/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euxo pipefail 4 | 5 | export TS_NODE_PROJECT="test/tsconfig.json" 6 | mocha --loader=ts-node/esm --reporter=dot test/**/*-test.ts --timeout=10000 7 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "ts-node": { 4 | "files": true, 5 | }, 6 | "include": [ 7 | "*-test.ts", 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/utils-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All Rights Reserved. 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 | * http://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 | 'use strict'; 17 | 18 | import * as assert from 'assert'; 19 | import { toWin32Path, toWSLPath, getWSLLocalAppDataPath, _childProcessForTesting } from '../src/utils.js'; 20 | import sinon from 'sinon'; 21 | 22 | const execFileSyncStub = sinon.stub(_childProcessForTesting, 'execFileSync').callThrough(); 23 | 24 | const asBuffer = (str: string): Buffer => Buffer.from(str, 'utf-8'); 25 | 26 | describe('toWin32Path', () => { 27 | beforeEach(() => execFileSyncStub.reset()); 28 | 29 | it('calls toWin32Path -w', () => { 30 | execFileSyncStub.returns(asBuffer('')); 31 | 32 | toWin32Path(''); 33 | 34 | assert.ok(execFileSyncStub.calledWith('wslpath', ['-w', ''])); 35 | }) 36 | 37 | describe('when the path is already in Windows format', () => { 38 | it('returns early', () => { 39 | execFileSyncStub.returns(asBuffer('')); 40 | 41 | assert.strictEqual(toWin32Path('D:\\'), 'D:\\'); 42 | assert.strictEqual(toWin32Path('C:\\'), 'C:\\'); 43 | 44 | assert.ok(execFileSyncStub.notCalled); 45 | }); 46 | }) 47 | 48 | describe('when wslpath is not available', () => { 49 | beforeEach(() => execFileSyncStub.throws(new Error('oh noes!'))); 50 | 51 | it('falls back to the toWinDirFormat method', () => { 52 | const wsl = '/mnt/c/Users/user1/AppData/'; 53 | const windows = 'C:\\Users\\user1\\AppData\\'; 54 | 55 | assert.strictEqual(toWin32Path(wsl), windows); 56 | }); 57 | 58 | it('supports the drive letter not being C', () => { 59 | const wsl = '/mnt/d/Users/user1/AppData'; 60 | const windows = 'D:\\Users\\user1\\AppData'; 61 | 62 | assert.strictEqual(toWin32Path(wsl), windows); 63 | }) 64 | }); 65 | }) 66 | 67 | describe('toWSLPath', () => { 68 | beforeEach(() => execFileSyncStub.reset()); 69 | 70 | it('calls wslpath -u', () => { 71 | execFileSyncStub.returns(asBuffer('')); 72 | 73 | toWSLPath('', ''); 74 | 75 | assert.ok(execFileSyncStub.calledWith('wslpath', ['-u', ''])); 76 | }) 77 | 78 | it('trims off the trailing newline', () => { 79 | execFileSyncStub.returns(asBuffer('the-path\n')); 80 | 81 | assert.strictEqual(toWSLPath('', ''), 'the-path'); 82 | }) 83 | 84 | describe('when wslpath is not available', () => { 85 | beforeEach(() => execFileSyncStub.throws(new Error('oh noes!'))); 86 | 87 | it('uses the fallback path', () => { 88 | assert.strictEqual( 89 | toWSLPath('C:/Program Files', '/mnt/c/Program Files'), 90 | '/mnt/c/Program Files' 91 | ); 92 | }) 93 | }) 94 | }) 95 | 96 | describe('getWSLLocalAppDataPath', () => { 97 | beforeEach(() => execFileSyncStub.reset()); 98 | 99 | it('transforms it to a Linux path using wslpath', () => { 100 | execFileSyncStub.returns(asBuffer('/c/folder/')); 101 | 102 | const path = '/mnt/c/Users/user1/.bin:/mnt/c/Users/user1:/mnt/c/Users/user1/AppData/'; 103 | 104 | assert.strictEqual(getWSLLocalAppDataPath(path), '/c/folder/'); 105 | assert.ok(execFileSyncStub.calledWith('wslpath', ['-u', 'c:\\Users\\user1\\AppData\\Local'])); 106 | }); 107 | 108 | describe('when wslpath is not available', () => { 109 | beforeEach(() => execFileSyncStub.throws(new Error('oh noes!'))); 110 | 111 | it('falls back to the getLocalAppDataPath method', () => { 112 | const path = '/mnt/c/Users/user1/.bin:/mnt/c/Users/user1:/mnt/c/Users/user1/AppData/'; 113 | const appDataPath = '/mnt/c/Users/user1/AppData/Local'; 114 | 115 | assert.strictEqual(getWSLLocalAppDataPath(path), appDataPath); 116 | }); 117 | }); 118 | }); 119 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "moduleResolution": "node", 5 | "outDir": "dist", 6 | "target": "es2019", 7 | "declaration": true, 8 | "noImplicitAny": true, 9 | "inlineSourceMap": true, 10 | "noEmitOnError": false, 11 | "strictNullChecks": true, 12 | "noImplicitReturns": true, 13 | "noUnusedLocals": true, 14 | "noUnusedParameters": true, 15 | "allowSyntheticDefaultImports": true, 16 | }, 17 | "exclude": [ 18 | "node_modules" 19 | ], 20 | "include": [ 21 | "src", 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@cspotcode/source-map-support@^0.8.0": 6 | version "0.8.1" 7 | resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" 8 | integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== 9 | dependencies: 10 | "@jridgewell/trace-mapping" "0.3.9" 11 | 12 | "@jridgewell/resolve-uri@^3.0.3": 13 | version "3.1.1" 14 | resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" 15 | integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== 16 | 17 | "@jridgewell/sourcemap-codec@^1.4.10": 18 | version "1.4.15" 19 | resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" 20 | integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== 21 | 22 | "@jridgewell/trace-mapping@0.3.9": 23 | version "0.3.9" 24 | resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" 25 | integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== 26 | dependencies: 27 | "@jridgewell/resolve-uri" "^3.0.3" 28 | "@jridgewell/sourcemap-codec" "^1.4.10" 29 | 30 | "@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.1": 31 | version "1.8.6" 32 | resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" 33 | integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== 34 | dependencies: 35 | type-detect "4.0.8" 36 | 37 | "@sinonjs/fake-timers@^6.0.0", "@sinonjs/fake-timers@^6.0.1": 38 | version "6.0.1" 39 | resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz#293674fccb3262ac782c7aadfdeca86b10c75c40" 40 | integrity sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA== 41 | dependencies: 42 | "@sinonjs/commons" "^1.7.0" 43 | 44 | "@sinonjs/samsam@^5.3.1": 45 | version "5.3.1" 46 | resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-5.3.1.tgz#375a45fe6ed4e92fca2fb920e007c48232a6507f" 47 | integrity sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg== 48 | dependencies: 49 | "@sinonjs/commons" "^1.6.0" 50 | lodash.get "^4.4.2" 51 | type-detect "^4.0.8" 52 | 53 | "@sinonjs/text-encoding@^0.7.1": 54 | version "0.7.1" 55 | resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5" 56 | integrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ== 57 | 58 | "@tsconfig/node10@^1.0.7": 59 | version "1.0.9" 60 | resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" 61 | integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== 62 | 63 | "@tsconfig/node12@^1.0.7": 64 | version "1.0.11" 65 | resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" 66 | integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== 67 | 68 | "@tsconfig/node14@^1.0.0": 69 | version "1.0.3" 70 | resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" 71 | integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== 72 | 73 | "@tsconfig/node16@^1.0.2": 74 | version "1.0.4" 75 | resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" 76 | integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== 77 | 78 | "@types/mocha@^8.0.4": 79 | version "8.0.4" 80 | resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.0.4.tgz#b840c2dce46bacf286e237bfb59a29e843399148" 81 | integrity sha512-M4BwiTJjHmLq6kjON7ZoI2JMlBvpY3BYSdiP6s/qCT3jb1s9/DeJF0JELpAxiVSIxXDzfNKe+r7yedMIoLbknQ== 82 | 83 | "@types/node@*": 84 | version "14.14.10" 85 | resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.10.tgz#5958a82e41863cfc71f2307b3748e3491ba03785" 86 | integrity sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ== 87 | 88 | "@types/sinon@^9.0.1": 89 | version "9.0.9" 90 | resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-9.0.9.tgz#115843b491583f924080f684b6d0d7438344f73c" 91 | integrity sha512-z/y8maYOQyYLyqaOB+dYQ6i0pxKLOsfwCmHmn4T7jS/SDHicIslr37oE3Dg8SCqKrKeBy6Lemu7do2yy+unLrw== 92 | dependencies: 93 | "@types/sinonjs__fake-timers" "*" 94 | 95 | "@types/sinonjs__fake-timers@*": 96 | version "6.0.2" 97 | resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.2.tgz#3a84cf5ec3249439015e14049bd3161419bf9eae" 98 | integrity sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg== 99 | 100 | acorn-walk@^8.1.1: 101 | version "8.2.0" 102 | resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" 103 | integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== 104 | 105 | acorn@^8.4.1: 106 | version "8.8.2" 107 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" 108 | integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== 109 | 110 | ansi-colors@4.1.1: 111 | version "4.1.1" 112 | resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" 113 | integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== 114 | 115 | ansi-regex@^5.0.1: 116 | version "5.0.1" 117 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" 118 | integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== 119 | 120 | ansi-styles@^4.0.0, ansi-styles@^4.1.0: 121 | version "4.3.0" 122 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" 123 | integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== 124 | dependencies: 125 | color-convert "^2.0.1" 126 | 127 | anymatch@~3.1.2: 128 | version "3.1.3" 129 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" 130 | integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== 131 | dependencies: 132 | normalize-path "^3.0.0" 133 | picomatch "^2.0.4" 134 | 135 | arg@^4.1.0: 136 | version "4.1.3" 137 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" 138 | integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== 139 | 140 | argparse@^2.0.1: 141 | version "2.0.1" 142 | resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" 143 | integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== 144 | 145 | async@^1.5.2: 146 | version "1.5.2" 147 | resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" 148 | integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= 149 | 150 | balanced-match@^1.0.0: 151 | version "1.0.0" 152 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" 153 | integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= 154 | 155 | binary-extensions@^2.0.0: 156 | version "2.1.0" 157 | resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" 158 | integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== 159 | 160 | brace-expansion@^1.1.7: 161 | version "1.1.11" 162 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" 163 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== 164 | dependencies: 165 | balanced-match "^1.0.0" 166 | concat-map "0.0.1" 167 | 168 | brace-expansion@^2.0.1: 169 | version "2.0.1" 170 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" 171 | integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== 172 | dependencies: 173 | balanced-match "^1.0.0" 174 | 175 | braces@~3.0.2: 176 | version "3.0.3" 177 | resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" 178 | integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== 179 | dependencies: 180 | fill-range "^7.1.1" 181 | 182 | browser-stdout@1.3.1: 183 | version "1.3.1" 184 | resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" 185 | integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== 186 | 187 | camelcase@^6.0.0: 188 | version "6.2.0" 189 | resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" 190 | integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== 191 | 192 | chalk@^4.1.0: 193 | version "4.1.2" 194 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" 195 | integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== 196 | dependencies: 197 | ansi-styles "^4.1.0" 198 | supports-color "^7.1.0" 199 | 200 | chokidar@3.5.3: 201 | version "3.5.3" 202 | resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" 203 | integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== 204 | dependencies: 205 | anymatch "~3.1.2" 206 | braces "~3.0.2" 207 | glob-parent "~5.1.2" 208 | is-binary-path "~2.1.0" 209 | is-glob "~4.0.1" 210 | normalize-path "~3.0.0" 211 | readdirp "~3.6.0" 212 | optionalDependencies: 213 | fsevents "~2.3.2" 214 | 215 | clang-format@^1.0.50: 216 | version "1.4.0" 217 | resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.4.0.tgz#1ee2f10637eb5bb0bd7d0b82c949af68e848367e" 218 | integrity sha512-NrdyUnHJOGvMa60vbWk7GJTvOdhibj3uK5C0FlwdNG4301OUvqEJTFce9I9x8qw2odBbIVrJ+9xbsFS3a4FbDA== 219 | dependencies: 220 | async "^1.5.2" 221 | glob "^7.0.0" 222 | resolve "^1.1.6" 223 | 224 | cliui@^7.0.2: 225 | version "7.0.4" 226 | resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" 227 | integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== 228 | dependencies: 229 | string-width "^4.2.0" 230 | strip-ansi "^6.0.0" 231 | wrap-ansi "^7.0.0" 232 | 233 | color-convert@^2.0.1: 234 | version "2.0.1" 235 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" 236 | integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== 237 | dependencies: 238 | color-name "~1.1.4" 239 | 240 | color-name@~1.1.4: 241 | version "1.1.4" 242 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" 243 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== 244 | 245 | concat-map@0.0.1: 246 | version "0.0.1" 247 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 248 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= 249 | 250 | create-require@^1.1.0: 251 | version "1.1.1" 252 | resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" 253 | integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== 254 | 255 | debug@4.3.4: 256 | version "4.3.4" 257 | resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" 258 | integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== 259 | dependencies: 260 | ms "2.1.2" 261 | 262 | debug@^2.6.9: 263 | version "2.6.9" 264 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" 265 | integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== 266 | dependencies: 267 | ms "2.0.0" 268 | 269 | decamelize@^4.0.0: 270 | version "4.0.0" 271 | resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" 272 | integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== 273 | 274 | diff@5.0.0: 275 | version "5.0.0" 276 | resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" 277 | integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== 278 | 279 | diff@^4.0.1, diff@^4.0.2: 280 | version "4.0.2" 281 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" 282 | integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== 283 | 284 | emoji-regex@^8.0.0: 285 | version "8.0.0" 286 | resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" 287 | integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== 288 | 289 | escalade@^3.1.1: 290 | version "3.1.1" 291 | resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" 292 | integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== 293 | 294 | escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: 295 | version "4.0.0" 296 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" 297 | integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== 298 | 299 | fill-range@^7.1.1: 300 | version "7.1.1" 301 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" 302 | integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== 303 | dependencies: 304 | to-regex-range "^5.0.1" 305 | 306 | find-up@5.0.0: 307 | version "5.0.0" 308 | resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" 309 | integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== 310 | dependencies: 311 | locate-path "^6.0.0" 312 | path-exists "^4.0.0" 313 | 314 | flat@^5.0.2: 315 | version "5.0.2" 316 | resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" 317 | integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== 318 | 319 | fs.realpath@^1.0.0: 320 | version "1.0.0" 321 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 322 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= 323 | 324 | fsevents@~2.3.2: 325 | version "2.3.2" 326 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 327 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 328 | 329 | function-bind@^1.1.1: 330 | version "1.1.1" 331 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" 332 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== 333 | 334 | get-caller-file@^2.0.5: 335 | version "2.0.5" 336 | resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" 337 | integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== 338 | 339 | glob-parent@~5.1.2: 340 | version "5.1.2" 341 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" 342 | integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== 343 | dependencies: 344 | is-glob "^4.0.1" 345 | 346 | glob@7.2.0: 347 | version "7.2.0" 348 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" 349 | integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== 350 | dependencies: 351 | fs.realpath "^1.0.0" 352 | inflight "^1.0.4" 353 | inherits "2" 354 | minimatch "^3.0.4" 355 | once "^1.3.0" 356 | path-is-absolute "^1.0.0" 357 | 358 | glob@^7.0.0: 359 | version "7.1.6" 360 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" 361 | integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== 362 | dependencies: 363 | fs.realpath "^1.0.0" 364 | inflight "^1.0.4" 365 | inherits "2" 366 | minimatch "^3.0.4" 367 | once "^1.3.0" 368 | path-is-absolute "^1.0.0" 369 | 370 | has-flag@^4.0.0: 371 | version "4.0.0" 372 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" 373 | integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== 374 | 375 | has@^1.0.3: 376 | version "1.0.3" 377 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" 378 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== 379 | dependencies: 380 | function-bind "^1.1.1" 381 | 382 | he@1.2.0: 383 | version "1.2.0" 384 | resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" 385 | integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== 386 | 387 | inflight@^1.0.4: 388 | version "1.0.6" 389 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 390 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= 391 | dependencies: 392 | once "^1.3.0" 393 | wrappy "1" 394 | 395 | inherits@2: 396 | version "2.0.4" 397 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 398 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 399 | 400 | is-binary-path@~2.1.0: 401 | version "2.1.0" 402 | resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" 403 | integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== 404 | dependencies: 405 | binary-extensions "^2.0.0" 406 | 407 | is-core-module@^2.1.0: 408 | version "2.2.0" 409 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" 410 | integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== 411 | dependencies: 412 | has "^1.0.3" 413 | 414 | is-docker@^2.0.0: 415 | version "2.1.1" 416 | resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.1.1.tgz#4125a88e44e450d384e09047ede71adc2d144156" 417 | integrity sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw== 418 | 419 | is-extglob@^2.1.1: 420 | version "2.1.1" 421 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" 422 | integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= 423 | 424 | is-fullwidth-code-point@^3.0.0: 425 | version "3.0.0" 426 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" 427 | integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== 428 | 429 | is-glob@^4.0.1, is-glob@~4.0.1: 430 | version "4.0.1" 431 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" 432 | integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== 433 | dependencies: 434 | is-extglob "^2.1.1" 435 | 436 | is-number@^7.0.0: 437 | version "7.0.0" 438 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" 439 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== 440 | 441 | is-plain-obj@^2.1.0: 442 | version "2.1.0" 443 | resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" 444 | integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== 445 | 446 | is-unicode-supported@^0.1.0: 447 | version "0.1.0" 448 | resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" 449 | integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== 450 | 451 | is-wsl@^2.2.0: 452 | version "2.2.0" 453 | resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" 454 | integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== 455 | dependencies: 456 | is-docker "^2.0.0" 457 | 458 | isarray@0.0.1: 459 | version "0.0.1" 460 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" 461 | integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= 462 | 463 | js-yaml@4.1.0: 464 | version "4.1.0" 465 | resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" 466 | integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== 467 | dependencies: 468 | argparse "^2.0.1" 469 | 470 | just-extend@^4.0.2: 471 | version "4.1.1" 472 | resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.1.1.tgz#158f1fdb01f128c411dc8b286a7b4837b3545282" 473 | integrity sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA== 474 | 475 | lighthouse-logger@^2.0.1: 476 | version "2.0.1" 477 | resolved "https://registry.yarnpkg.com/lighthouse-logger/-/lighthouse-logger-2.0.1.tgz#48895f639b61cca89346bb6f47f7403a3895fa02" 478 | integrity sha512-ioBrW3s2i97noEmnXxmUq7cjIcVRjT5HBpAYy8zE11CxU9HqlWHHeRxfeN1tn8F7OEMVPIC9x1f8t3Z7US9ehQ== 479 | dependencies: 480 | debug "^2.6.9" 481 | marky "^1.2.2" 482 | 483 | locate-path@^6.0.0: 484 | version "6.0.0" 485 | resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" 486 | integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== 487 | dependencies: 488 | p-locate "^5.0.0" 489 | 490 | lodash.get@^4.4.2: 491 | version "4.4.2" 492 | resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" 493 | integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= 494 | 495 | log-symbols@4.1.0: 496 | version "4.1.0" 497 | resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" 498 | integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== 499 | dependencies: 500 | chalk "^4.1.0" 501 | is-unicode-supported "^0.1.0" 502 | 503 | make-error@^1.1.1: 504 | version "1.3.6" 505 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" 506 | integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== 507 | 508 | marky@^1.2.2: 509 | version "1.2.5" 510 | resolved "https://registry.yarnpkg.com/marky/-/marky-1.2.5.tgz#55796b688cbd72390d2d399eaaf1832c9413e3c0" 511 | integrity sha512-q9JtQJKjpsVxCRVgQ+WapguSbKC3SQ5HEzFGPAJMStgh3QjCawp00UKv3MTTAArTmGmmPUvllHZoNbZ3gs0I+Q== 512 | 513 | minimatch@5.0.1: 514 | version "5.0.1" 515 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" 516 | integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== 517 | dependencies: 518 | brace-expansion "^2.0.1" 519 | 520 | minimatch@^3.0.4: 521 | version "3.1.2" 522 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" 523 | integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== 524 | dependencies: 525 | brace-expansion "^1.1.7" 526 | 527 | mocha@^10.2.0: 528 | version "10.2.0" 529 | resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" 530 | integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== 531 | dependencies: 532 | ansi-colors "4.1.1" 533 | browser-stdout "1.3.1" 534 | chokidar "3.5.3" 535 | debug "4.3.4" 536 | diff "5.0.0" 537 | escape-string-regexp "4.0.0" 538 | find-up "5.0.0" 539 | glob "7.2.0" 540 | he "1.2.0" 541 | js-yaml "4.1.0" 542 | log-symbols "4.1.0" 543 | minimatch "5.0.1" 544 | ms "2.1.3" 545 | nanoid "3.3.3" 546 | serialize-javascript "6.0.0" 547 | strip-json-comments "3.1.1" 548 | supports-color "8.1.1" 549 | workerpool "6.2.1" 550 | yargs "16.2.0" 551 | yargs-parser "20.2.4" 552 | yargs-unparser "2.0.0" 553 | 554 | ms@2.0.0: 555 | version "2.0.0" 556 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" 557 | integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= 558 | 559 | ms@2.1.2: 560 | version "2.1.2" 561 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" 562 | integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== 563 | 564 | ms@2.1.3: 565 | version "2.1.3" 566 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" 567 | integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== 568 | 569 | nanoid@3.3.3: 570 | version "3.3.3" 571 | resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" 572 | integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== 573 | 574 | nise@^4.0.4: 575 | version "4.1.0" 576 | resolved "https://registry.yarnpkg.com/nise/-/nise-4.1.0.tgz#8fb75a26e90b99202fa1e63f448f58efbcdedaf6" 577 | integrity sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA== 578 | dependencies: 579 | "@sinonjs/commons" "^1.7.0" 580 | "@sinonjs/fake-timers" "^6.0.0" 581 | "@sinonjs/text-encoding" "^0.7.1" 582 | just-extend "^4.0.2" 583 | path-to-regexp "^1.7.0" 584 | 585 | normalize-path@^3.0.0, normalize-path@~3.0.0: 586 | version "3.0.0" 587 | resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" 588 | integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== 589 | 590 | once@^1.3.0: 591 | version "1.4.0" 592 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 593 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 594 | dependencies: 595 | wrappy "1" 596 | 597 | p-limit@^3.0.2: 598 | version "3.1.0" 599 | resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" 600 | integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== 601 | dependencies: 602 | yocto-queue "^0.1.0" 603 | 604 | p-locate@^5.0.0: 605 | version "5.0.0" 606 | resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" 607 | integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== 608 | dependencies: 609 | p-limit "^3.0.2" 610 | 611 | path-exists@^4.0.0: 612 | version "4.0.0" 613 | resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" 614 | integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== 615 | 616 | path-is-absolute@^1.0.0: 617 | version "1.0.1" 618 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 619 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= 620 | 621 | path-parse@^1.0.6: 622 | version "1.0.7" 623 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" 624 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== 625 | 626 | path-to-regexp@^1.7.0: 627 | version "1.9.0" 628 | resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.9.0.tgz#5dc0753acbf8521ca2e0f137b4578b917b10cf24" 629 | integrity sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g== 630 | dependencies: 631 | isarray "0.0.1" 632 | 633 | picomatch@^2.0.4, picomatch@^2.2.1: 634 | version "2.2.2" 635 | resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" 636 | integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== 637 | 638 | randombytes@^2.1.0: 639 | version "2.1.0" 640 | resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" 641 | integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== 642 | dependencies: 643 | safe-buffer "^5.1.0" 644 | 645 | readdirp@~3.6.0: 646 | version "3.6.0" 647 | resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" 648 | integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== 649 | dependencies: 650 | picomatch "^2.2.1" 651 | 652 | require-directory@^2.1.1: 653 | version "2.1.1" 654 | resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" 655 | integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= 656 | 657 | resolve@^1.1.6: 658 | version "1.19.0" 659 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" 660 | integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== 661 | dependencies: 662 | is-core-module "^2.1.0" 663 | path-parse "^1.0.6" 664 | 665 | safe-buffer@^5.1.0: 666 | version "5.2.1" 667 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 668 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 669 | 670 | serialize-javascript@6.0.0: 671 | version "6.0.0" 672 | resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" 673 | integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== 674 | dependencies: 675 | randombytes "^2.1.0" 676 | 677 | sinon@^9.0.1: 678 | version "9.2.4" 679 | resolved "https://registry.yarnpkg.com/sinon/-/sinon-9.2.4.tgz#e55af4d3b174a4443a8762fa8421c2976683752b" 680 | integrity sha512-zljcULZQsJxVra28qIAL6ow1Z9tpattkCTEJR4RBP3TGc00FcttsP5pK284Nas5WjMZU5Yzy3kAIp3B3KRf5Yg== 681 | dependencies: 682 | "@sinonjs/commons" "^1.8.1" 683 | "@sinonjs/fake-timers" "^6.0.1" 684 | "@sinonjs/samsam" "^5.3.1" 685 | diff "^4.0.2" 686 | nise "^4.0.4" 687 | supports-color "^7.1.0" 688 | 689 | string-width@^4.1.0, string-width@^4.2.0: 690 | version "4.2.3" 691 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" 692 | integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== 693 | dependencies: 694 | emoji-regex "^8.0.0" 695 | is-fullwidth-code-point "^3.0.0" 696 | strip-ansi "^6.0.1" 697 | 698 | strip-ansi@^6.0.0, strip-ansi@^6.0.1: 699 | version "6.0.1" 700 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" 701 | integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== 702 | dependencies: 703 | ansi-regex "^5.0.1" 704 | 705 | strip-json-comments@3.1.1: 706 | version "3.1.1" 707 | resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" 708 | integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== 709 | 710 | supports-color@8.1.1: 711 | version "8.1.1" 712 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" 713 | integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== 714 | dependencies: 715 | has-flag "^4.0.0" 716 | 717 | supports-color@^7.1.0: 718 | version "7.2.0" 719 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" 720 | integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== 721 | dependencies: 722 | has-flag "^4.0.0" 723 | 724 | to-regex-range@^5.0.1: 725 | version "5.0.1" 726 | resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" 727 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== 728 | dependencies: 729 | is-number "^7.0.0" 730 | 731 | ts-node@^10.9.1: 732 | version "10.9.1" 733 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" 734 | integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== 735 | dependencies: 736 | "@cspotcode/source-map-support" "^0.8.0" 737 | "@tsconfig/node10" "^1.0.7" 738 | "@tsconfig/node12" "^1.0.7" 739 | "@tsconfig/node14" "^1.0.0" 740 | "@tsconfig/node16" "^1.0.2" 741 | acorn "^8.4.1" 742 | acorn-walk "^8.1.1" 743 | arg "^4.1.0" 744 | create-require "^1.1.0" 745 | diff "^4.0.1" 746 | make-error "^1.1.1" 747 | v8-compile-cache-lib "^3.0.1" 748 | yn "3.1.1" 749 | 750 | type-detect@4.0.8, type-detect@^4.0.8: 751 | version "4.0.8" 752 | resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" 753 | integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== 754 | 755 | typescript@^4.1.2: 756 | version "4.1.2" 757 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" 758 | integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== 759 | 760 | v8-compile-cache-lib@^3.0.1: 761 | version "3.0.1" 762 | resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" 763 | integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== 764 | 765 | workerpool@6.2.1: 766 | version "6.2.1" 767 | resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" 768 | integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== 769 | 770 | wrap-ansi@^7.0.0: 771 | version "7.0.0" 772 | resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" 773 | integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== 774 | dependencies: 775 | ansi-styles "^4.0.0" 776 | string-width "^4.1.0" 777 | strip-ansi "^6.0.0" 778 | 779 | wrappy@1: 780 | version "1.0.2" 781 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 782 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 783 | 784 | y18n@^5.0.5: 785 | version "5.0.8" 786 | resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" 787 | integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== 788 | 789 | yargs-parser@20.2.4: 790 | version "20.2.4" 791 | resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" 792 | integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== 793 | 794 | yargs-parser@^20.2.2: 795 | version "20.2.9" 796 | resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" 797 | integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== 798 | 799 | yargs-unparser@2.0.0: 800 | version "2.0.0" 801 | resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" 802 | integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== 803 | dependencies: 804 | camelcase "^6.0.0" 805 | decamelize "^4.0.0" 806 | flat "^5.0.2" 807 | is-plain-obj "^2.1.0" 808 | 809 | yargs@16.2.0: 810 | version "16.2.0" 811 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" 812 | integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== 813 | dependencies: 814 | cliui "^7.0.2" 815 | escalade "^3.1.1" 816 | get-caller-file "^2.0.5" 817 | require-directory "^2.1.1" 818 | string-width "^4.2.0" 819 | y18n "^5.0.5" 820 | yargs-parser "^20.2.2" 821 | 822 | yn@3.1.1: 823 | version "3.1.1" 824 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 825 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 826 | 827 | yocto-queue@^0.1.0: 828 | version "0.1.0" 829 | resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" 830 | integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== 831 | --------------------------------------------------------------------------------