(parentSpan: Span)
| 186 | } |
| 187 | |
| 188 | public async setup(parentSpan: Span) { |
| 189 | super.setup(parentSpan) |
| 190 | await super.createTestDir({ parentSpan, skipInstall: true }) |
| 191 | |
| 192 | const existingDeployUrl = process.env.NEXT_TEST_DEPLOY_URL?.trim() |
| 193 | const customDeployScriptPath = |
| 194 | process.env.NEXT_TEST_DEPLOY_SCRIPT_PATH?.trim() |
| 195 | const customLogsScriptPath = |
| 196 | process.env.NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH?.trim() |
| 197 | |
| 198 | // Check if using an existing deployment URL (takes priority) |
| 199 | if (existingDeployUrl) { |
| 200 | try { |
| 201 | this._url = new URL(existingDeployUrl).toString() |
| 202 | } catch (err) { |
| 203 | throw new Error( |
| 204 | `Invalid NEXT_TEST_DEPLOY_URL value: ${existingDeployUrl}`, |
| 205 | { cause: err } |
| 206 | ) |
| 207 | } |
| 208 | require('console').log(`Using existing deployment URL: ${this._url}`) |
| 209 | |
| 210 | this._parsedUrl = new URL(this._url) |
| 211 | |
| 212 | // Configure proxy address if needed |
| 213 | await this.configureProxyAddress() |
| 214 | |
| 215 | // Use custom logs script if provided, otherwise use Vercel CLI |
| 216 | if (customLogsScriptPath) { |
| 217 | this._cliOutput = await this.fetchBuildLogsUsingCustomScript() |
| 218 | } else { |
| 219 | // Use vercel inspect to get logs for existing deployment |
| 220 | const buildLogs = await execa( |
| 221 | 'vercel', |
| 222 | ['inspect', '--logs', this._url], |
| 223 | { |
| 224 | env: process.env, |
| 225 | reject: false, |
| 226 | } |
| 227 | ) |
| 228 | if (buildLogs.exitCode !== 0) { |
| 229 | throw new Error( |
| 230 | `Failed to get build output logs: ${buildLogs.stderr}` |
| 231 | ) |
| 232 | } |
| 233 | this._cliOutput = buildLogs.stdout + buildLogs.stderr |
| 234 | } |
| 235 | |
| 236 | this.parseIdsFromCliOuput() |
| 237 | return |
| 238 | } |
| 239 | |
| 240 | // Check if using custom deploy script |
| 241 | if (customDeployScriptPath) { |
| 242 | if (!customLogsScriptPath) { |
| 243 | throw new Error( |
| 244 | 'NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH is required when using NEXT_TEST_DEPLOY_SCRIPT_PATH' |
| 245 | ) |
nothing calls this directly
no test coverage detected