* @returns {Promise<TestResultManifest>}
()
| 124 | * @returns {Promise<TestResultManifest>} |
| 125 | */ |
| 126 | async function fetchTestResults() { |
| 127 | const artifact = await fetchLatestTestArtifact() |
| 128 | |
| 129 | const subprocess = exec('Downloading artifact archive', 'gh', [ |
| 130 | 'api', |
| 131 | `/repos/vercel/next.js/actions/artifacts/${artifact.id}/zip`, |
| 132 | ]) |
| 133 | |
| 134 | const filePath = path.join( |
| 135 | os.tmpdir(), |
| 136 | `next-test-results.${Math.floor(Math.random() * 100000).toString(16)}.zip` |
| 137 | ) |
| 138 | |
| 139 | let file |
| 140 | try { |
| 141 | file = await fs.open(filePath, 'w') |
| 142 | |
| 143 | subprocess.stdout.pipe(file.createWriteStream()) |
| 144 | |
| 145 | await subprocess |
| 146 | } finally { |
| 147 | await file.close() |
| 148 | } |
| 149 | |
| 150 | const { stdout } = await exec('Extracting test results manifest', 'unzip', [ |
| 151 | '-pj', |
| 152 | filePath, |
| 153 | 'nextjs-test-results.json', |
| 154 | ]) |
| 155 | |
| 156 | await fs.unlink(filePath) |
| 157 | |
| 158 | return JSON.parse(stdout) |
| 159 | } |
| 160 | |
| 161 | async function updatePassingTests() { |
| 162 | const results = await fetchTestResults() |
no test coverage detected