(extension: string, cliPath: string, extensionsDir: string, args: string[] = [])
| 105 | |
| 106 | // Make sure renderers is there too as we'll use it for widget tests |
| 107 | async function installExtension(extension: string, cliPath: string, extensionsDir: string, args: string[] = []) { |
| 108 | args = ['--install-extension', extension, ...args, '--extensions-dir', extensionsDir, '--disable-telemetry']; |
| 109 | const output = |
| 110 | process.platform === 'win32' |
| 111 | ? spawnSync(cliPath, args, { |
| 112 | encoding: 'utf-8', |
| 113 | stdio: 'inherit', |
| 114 | shell: true // Without this, node 20 would fail to install the extensions on Windows. See https://github.com/nodejs/node/issues/52554 |
| 115 | }) |
| 116 | : spawnSync(cliPath, args, { |
| 117 | encoding: 'utf-8', |
| 118 | stdio: 'inherit' |
| 119 | }); |
| 120 | |
| 121 | if (output.error) { |
| 122 | throw output.error; |
| 123 | } |
| 124 | if (output.stderr) { |
| 125 | console.error(`Error installing ${extension} Extension to ${extensionsDir}`); |
| 126 | console.error(output.stderr); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | async function createSettings(): Promise<string> { |
| 131 | // User data dir can be overridden with an environment variable. |
no test coverage detected