MCPcopy
hub / github.com/vuejs/core / runTestsIfNeeded

Function runTestsIfNeeded

scripts/release.js:281–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279}
280
281async function runTestsIfNeeded() {
282 if (!skipTests) {
283 step('Checking CI status for HEAD...')
284 let isCIPassed = await getCIResult()
285 skipTests ||= isCIPassed
286
287 if (isCIPassed) {
288 if (!skipPrompts) {
289 /** @type {{ yes: boolean }} */
290 const { yes: promptSkipTests } = await prompt({
291 type: 'confirm',
292 name: 'yes',
293 message: `CI for this commit passed. Skip local tests?`,
294 })
295 skipTests = promptSkipTests
296 } else {
297 skipTests = true
298 }
299 } else if (skipPrompts) {
300 throw new Error(
301 'CI for the latest commit has not passed yet. ' +
302 'Only run the release workflow after the CI has passed.',
303 )
304 }
305 }
306
307 if (!skipTests) {
308 step('\nRunning tests...')
309 if (!isDryRun) {
310 await run('pnpm', ['run', 'test', '--run'])
311 } else {
312 console.log(`Skipped (dry run)`)
313 }
314 } else {
315 step('Tests skipped.')
316 }
317}
318
319async function getCIResult() {
320 try {

Callers 1

mainFunction · 0.85

Calls 3

stepFunction · 0.85
getCIResultFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected