Skip to content

yarn run has changed behaviour, and generates a yarn-error.log file for exit code 1 #5457

@vdh

Description

@vdh

Recently, yarn run has changed behaviour and has started outputting an error message and generating a yarn-error.log file when a non-zero exit code occurs. Previously it would just exit with code 1. This was useful for running tests or linters, where an exit code of 1 is as expected outcome, and helps to automatically stop a build system when tests/linting fails.

Do you want to request a feature or report a bug?
Report a bug.

What is the current behavior?
Running scripts from package.json that return exit code 1 will output an error message and generate a yarn-error.log file, e.g.:

error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c eslint --ext js,jsx --max-warnings 0 .
Directory: /Users/tim/Documents/foo
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/tim/Documents/foo/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.
Run a script that exits with code 1, e.g. ESLint:

{
  "scripts": {
    "lint": "eslint --ext js,jsx --max-warnings 0 ."
  }
}

What is the expected behavior?
Previously, yarn run would just exit with code 1.

  1. I can't find the release information or documentation about this change in behaviour. Does anyone know what version introduced this change?
  2. Is there a way to flag that exit code 1 for a script is an expected outcome?

Please mention your node.js, yarn and operating system version.
node 9.6.1, yarn 1.5.1, macOS 10.13.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions