Skip to content

feat: user-friendly error if lock file missing#848

Merged
AtofStryker merged 1 commit into
cypress-io:masterfrom
MikeMcC399:feat/catch-missing-lockfile
Mar 28, 2023
Merged

feat: user-friendly error if lock file missing#848
AtofStryker merged 1 commit into
cypress-io:masterfrom
MikeMcC399:feat/catch-missing-lockfile

Conversation

@MikeMcC399

@MikeMcC399 MikeMcC399 commented Mar 23, 2023

Copy link
Copy Markdown
Collaborator

This PR catches the error condition of a missing package manager lock file and displays a user-friendly error message.

The action requires a lock file from npm, pnpm or yarn in order to install dependencies and store the cache.


BEFORE

The action fails showing an error message similar to the following:

@cypress/github-action trying to restore cached NPM modules
node:internal/fs/utils:345
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/runner/work/github-action/github-action/examples/yarn-classic/package-lock.json'

This error message only mentions package-lock.json (npm). It does not mention lock file names from pnpm or yarn, which are also supported.


AFTER

An error message is shown in the action logs summary and action logs details similar to the following. This makes the error condition clearer and provides the hints necessary to remediate the error.

"Action failed. Missing package manager lockfile. Expecting one of package-lock.json (npm), pnpm-lock.yaml (pnpm) or yarn.lock (yarn) in working-directory /home/runner/work/github-action/github-action/examples/yarn-classic"

Summary

yarn-no-lock-summary

Detail

yarn-no-lock-detail

@MikeMcC399 MikeMcC399 marked this pull request as ready for review March 23, 2023 12:16
Comment thread index.js
@lmiller1990 lmiller1990 self-requested a review March 26, 2023 22:59
@lmiller1990

Copy link
Copy Markdown
Contributor

@AtofStryker can I get a quick 👀 , thanks!

@MikeMcC399 MikeMcC399 force-pushed the feat/catch-missing-lockfile branch from 1a0a6cd to d13e488 Compare March 28, 2023 08:09
Comment thread dist/index.js
@AtofStryker AtofStryker merged commit 91a7479 into cypress-io:master Mar 28, 2023
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 5.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants