@cypress/github-action 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +69 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74623,6 +74623,7 @@ const cliParser = __nccwpck_require__(8604)()
|
|
|
74623
74623
|
const findYarnWorkspaceRoot = __nccwpck_require__(6748)
|
|
74624
74624
|
const debug = __nccwpck_require__(8237)('@cypress/github-action')
|
|
74625
74625
|
const { ping } = __nccwpck_require__(9390)
|
|
74626
|
+
const { SUMMARY_ENV_VAR } = __nccwpck_require__(1327)
|
|
74626
74627
|
|
|
74627
74628
|
/**
|
|
74628
74629
|
* Parses input command, finds the tool and
|
|
@@ -74705,6 +74706,7 @@ const yarnFilename = path.join(
|
|
|
74705
74706
|
findYarnWorkspaceRoot(workingDirectory) || workingDirectory,
|
|
74706
74707
|
'yarn.lock'
|
|
74707
74708
|
)
|
|
74709
|
+
const pnpmLockFilename = path.join(workingDirectory, 'pnpm-lock.yaml')
|
|
74708
74710
|
const packageLockFilename = path.join(
|
|
74709
74711
|
workingDirectory,
|
|
74710
74712
|
'package-lock.json'
|
|
@@ -74712,8 +74714,14 @@ const packageLockFilename = path.join(
|
|
|
74712
74714
|
|
|
74713
74715
|
const useYarn = () => fs.existsSync(yarnFilename)
|
|
74714
74716
|
|
|
74717
|
+
const usePnpm = () => fs.existsSync(pnpmLockFilename)
|
|
74718
|
+
|
|
74715
74719
|
const lockHash = () => {
|
|
74716
|
-
const lockFilename = useYarn()
|
|
74720
|
+
const lockFilename = useYarn()
|
|
74721
|
+
? yarnFilename
|
|
74722
|
+
: usePnpm()
|
|
74723
|
+
? pnpmLockFilename
|
|
74724
|
+
: packageLockFilename
|
|
74717
74725
|
const fileHash = hasha.fromFileSync(lockFilename)
|
|
74718
74726
|
debug(`Hash from file ${lockFilename} is ${fileHash}`)
|
|
74719
74727
|
return fileHash
|
|
@@ -74728,6 +74736,8 @@ const getNpmCache = () => {
|
|
|
74728
74736
|
if (!key) {
|
|
74729
74737
|
if (useYarn()) {
|
|
74730
74738
|
key = `yarn-${platformAndArch}-${hash}`
|
|
74739
|
+
} else if (usePnpm()) {
|
|
74740
|
+
key = `pnpm-${platformAndArch}-${hash}`
|
|
74731
74741
|
} else {
|
|
74732
74742
|
key = `npm-${platformAndArch}-${hash}`
|
|
74733
74743
|
}
|
|
@@ -74737,6 +74747,8 @@ const getNpmCache = () => {
|
|
|
74737
74747
|
|
|
74738
74748
|
if (useYarn()) {
|
|
74739
74749
|
o.inputPath = path.join(homeDirectory, '.cache', 'yarn')
|
|
74750
|
+
} else if (usePnpm()) {
|
|
74751
|
+
o.inputPath = NPM_CACHE_FOLDER
|
|
74740
74752
|
} else {
|
|
74741
74753
|
o.inputPath = NPM_CACHE_FOLDER
|
|
74742
74754
|
}
|
|
@@ -74841,9 +74853,18 @@ const install = () => {
|
|
|
74841
74853
|
cypressCommandOptions
|
|
74842
74854
|
)
|
|
74843
74855
|
})
|
|
74856
|
+
} else if (usePnpm()) {
|
|
74857
|
+
debug('installing NPM dependencies using pnpm')
|
|
74858
|
+
return io.which('pnpm', true).then((pnpmPath) => {
|
|
74859
|
+
debug(`pnpm at "${pnpmPath}"`)
|
|
74860
|
+
return exec.exec(
|
|
74861
|
+
quote(pnpmPath),
|
|
74862
|
+
['install', '--frozen-lockfile'],
|
|
74863
|
+
cypressCommandOptions
|
|
74864
|
+
)
|
|
74865
|
+
})
|
|
74844
74866
|
} else {
|
|
74845
74867
|
debug('installing NPM dependencies')
|
|
74846
|
-
|
|
74847
74868
|
return io.which('npm', true).then((npmPath) => {
|
|
74848
74869
|
debug(`npm at "${npmPath}"`)
|
|
74849
74870
|
return exec.exec(quote(npmPath), ['ci'], cypressCommandOptions)
|
|
@@ -75355,9 +75376,55 @@ const runTests = async () => {
|
|
|
75355
75376
|
process.chdir(workingDirectory)
|
|
75356
75377
|
return cypress
|
|
75357
75378
|
.run(cypressOptions)
|
|
75379
|
+
.then(generateSummary)
|
|
75358
75380
|
.then(onTestsFinished, onTestsError)
|
|
75359
75381
|
}
|
|
75360
75382
|
|
|
75383
|
+
// Summary is not available for GitHub Enterprise at the moment
|
|
75384
|
+
const isSummaryEnabled = () => {
|
|
75385
|
+
return process.env[SUMMARY_ENV_VAR] !== undefined
|
|
75386
|
+
}
|
|
75387
|
+
|
|
75388
|
+
const generateSummary = async (testResults) => {
|
|
75389
|
+
if (!isSummaryEnabled()) {
|
|
75390
|
+
return testResults
|
|
75391
|
+
}
|
|
75392
|
+
|
|
75393
|
+
const headers = [
|
|
75394
|
+
{ data: 'Result', header: true },
|
|
75395
|
+
{ data: 'Passed :white_check_mark:', header: true },
|
|
75396
|
+
{ data: 'Failed :x:', header: true },
|
|
75397
|
+
{ data: 'Pending :hand:', header: true },
|
|
75398
|
+
{ data: 'Skipped :leftwards_arrow_with_hook:', header: true },
|
|
75399
|
+
{ data: 'Duration :clock8:', header: true }
|
|
75400
|
+
]
|
|
75401
|
+
|
|
75402
|
+
const status =
|
|
75403
|
+
testResults.totalFailed === 0
|
|
75404
|
+
? 'Passing :white_check_mark:'
|
|
75405
|
+
: 'Failing :red_circle:'
|
|
75406
|
+
|
|
75407
|
+
const summaryRows = [
|
|
75408
|
+
status,
|
|
75409
|
+
`${testResults.totalPassed}`,
|
|
75410
|
+
`${testResults.totalFailed}`,
|
|
75411
|
+
`${testResults.totalPending}`,
|
|
75412
|
+
`${testResults.totalSkipped}`,
|
|
75413
|
+
`${testResults.totalDuration / 1000}s` || ''
|
|
75414
|
+
]
|
|
75415
|
+
|
|
75416
|
+
await core.summary
|
|
75417
|
+
.addHeading('Cypress Results', 2)
|
|
75418
|
+
.addTable([headers, summaryRows])
|
|
75419
|
+
.addLink(
|
|
75420
|
+
testResults.runUrl ? 'View Run in Dashboard' : '',
|
|
75421
|
+
testResults.runUrl || ''
|
|
75422
|
+
)
|
|
75423
|
+
.write()
|
|
75424
|
+
|
|
75425
|
+
return testResults
|
|
75426
|
+
}
|
|
75427
|
+
|
|
75361
75428
|
const installMaybe = () => {
|
|
75362
75429
|
const installParameter = getInputBool('install', true)
|
|
75363
75430
|
if (!installParameter) {
|