这是indexloc提供的服务,不要输入任何密码
Skip to content

Build output cached on CI plays back without color on machines where color is allowed #897

@thebanjomatic

Description

@thebanjomatic

What version of Turborepo are you using?

1.1.6

What package manager are you using / does the bug impact?

Yarn v2/v3

What operating system are you using?

Windows

Describe the Bug

It looks like currently the console output log contains the entire line that gets printed to the console including the package_name:task: prefix. Generally this is ok, but the behavior is a bit weird when you cache a build on CI or in an environment where color is disabled, and then play it back in an environment where color is allowed since you will get a mix of colored / and uncolored lines in the resulting output depending on which packages were hits/misses.

Expected Behavior

I was kind of surprised that turbo doesn't just cache the raw program output, and then add the prefix back in when playing it back. This would allow the decision of whether or not to use color output to be made at the time it is being displayed instead of committing to the value at the time the build was run.

Separate from that, a different approach might be a --color/--no-color flag, or checking the FORCE_COLOR environment variable to allow you to enable color output in github actions. This way the output will be cached with color when running on CI instead of just plain text. (Note: github.com/fatih/color does use the NO_COLOR environment variable, but it doesn't check the value, so NO_COLOR=0 is not the equivalent to force-enabling colors, and instead color.NoColor = false must be set programmatically.

To Reproduce

This can be reproduced with local builds by using the NO_COLOR environment variable to disable colors for one build run, and then play it back.

declare -x NO_COLOR=1
yarn turbo run build --force

unset NO_COLOR
yarn turbo run build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions