MCPcopy
hub / github.com/vercel/next.js / updatePassingTests

Function updatePassingTests

test/update-bundler-manifest.js:161–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159}
160
161async function updatePassingTests() {
162 const results = await fetchTestResults()
163
164 logCommand('Processing results...')
165
166 const passing = { __proto__: null }
167 for (const result of results.result) {
168 const runtimeError = result.data.numRuntimeErrorTestSuites > 0
169 for (const testResult of result.data.testResults) {
170 const filepath = stripWorkingPath(testResult.name)
171
172 const fileResults = (passing[filepath] ??= {
173 passed: [],
174 failed: [],
175 pending: [],
176 flakey: [],
177 runtimeError,
178 })
179 const skips = SKIPPED_TEST_SUITES[filepath] ?? []
180
181 const skippedPassingNames = []
182
183 let initializationFailed = false
184 for (const testCase of testResult.assertionResults) {
185 let { fullName, status } = testCase
186
187 if (
188 status === 'failed' &&
189 INITIALIZING_TEST_CASES.some((name) => fullName.includes(name))
190 ) {
191 initializationFailed = true
192 } else if (initializationFailed) {
193 status = 'failed'
194 }
195 if (shouldSkip(fullName, skips)) {
196 if (status === 'passed') skippedPassingNames.push(fullName)
197 status = 'flakey'
198 }
199
200 // treat test-level todo as same as pending
201 if (status === 'todo') {
202 status = 'pending'
203 }
204
205 const statusArray = fileResults[status]
206 if (!statusArray) {
207 throw new Error(`unexpected status "${status}"`)
208 }
209 statusArray.push(fullName)
210 }
211
212 if (skippedPassingNames.length > 0) {
213 console.log(
214 `${bold().yellow(filepath)} has ${
215 skippedPassingNames.length
216 } passing tests that are marked as skipped:\n${skippedPassingNames
217 .map((name) => ` - ${name}`)
218 .join('\n')}\n`

Callers 1

Calls 15

fetchTestResultsFunction · 0.85
stripWorkingPathFunction · 0.85
shouldSkipFunction · 0.85
someMethod · 0.80
includesMethod · 0.80
reduceMethod · 0.80
logCommandFunction · 0.70
formatFunction · 0.70
pushMethod · 0.65
keysMethod · 0.65
writeFileMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected