Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tput: No value for $TERM and no -T specified #15679

Open
nicholaschiang opened this issue Mar 27, 2021 · 10 comments
Open

tput: No value for $TERM and no -T specified #15679

nicholaschiang opened this issue Mar 27, 2021 · 10 comments
Labels
E2E Issue related to end-to-end testing existing workaround Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.

Comments

@nicholaschiang
Copy link

Current behavior

When running Cypress in CI environments, $TERM is unset and thus we always get the following error/warning:

tput: No value for $TERM and no -T specified

Desired behavior

There should be no warning message. I've looked at this StackOverflow answer and it seems like it should be fixed here in Cypress:

You can either manually assign a TERM value to the cron job (likely dumb or something similar to that) or (and this is likely the better solution) you can find out what is calling tput and remove that call.

You should skip the tput call when running in CI environments where TERM isn't specified.

Test code to reproduce

See this GitHub action run or all of these issues that also show the same warning message (related especially to #5571 which mentions this same warning message).

You should be able to reproduce just by running cypress run in a CI environment.

Versions

Cypress: 6.8.0
Browser: N/A
CI: GitHub Actions (but also appears in Jenkins and CircleCI)

@jennifer-shehane
Copy link
Member

$TERM is not always unset in every CI environment and can also be manually set.

Cypress is not calling tput anywhere from our codebase, so I'm not exactly sure where it's coming from when running Cypress exactly.

Is there a functional problem with this message? If you just want to not see it anymore, you could set your TERM to a value and the message will no longer show for you.

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Mar 30, 2021
@jennifer-shehane
Copy link
Member

We would also be open to a PR if someone tracks this down and can test/remove it.

@dreamalligator
Copy link

It happens for me in Circle-CI. Example from someone else reporting, https://discuss.circleci.com/t/getting-error-tput-no-value-for-term/27310.

@louzena-inshur
Copy link

Hi, was this solved? We're getting the same error in CI and unable to run our Cypress tests

@cypress-bot cypress-bot bot added stage: backlog and removed stage: awaiting response Potential fix was proposed; awaiting response labels Apr 29, 2022
@lucaswerkmeister
Copy link

Cypress is not calling tput anywhere from our codebase, so I'm not exactly sure where it's coming from when running Cypress exactly.

I tried to find out where it’s coming from, but it’s not really clear. I wrapped the cypress call in a shell script that sets up a fake tput binary in the path which prints a pstree starting from the surrounding shell, and this is what I got:

bash---npm run test-on-+-sh---node-+-npm run test:cy-+-sh---node-+-sh---node-+-esbuild---4*[{esbuild}]
                       |           |                 |           |           `-10*[{node}]
                       |           |                 |           |-sh---node-+-Cypress-+-Cypress---Cypress---6*[{Cypress}]
                       |           |                 |           |           |         |-Cypress
                       |           |                 |           |           |         |-Cypress---6*[{Cypress}]
                       |           |                 |           |           |         |-node---134*[{node}]
                       |           |                 |           |           |         |-pstree
                       |           |                 |           |           |         `-159*[{Cypress}]
                       |           |                 |           |           |-Xvfb
                       |           |                 |           |           `-10*[{node}]
                       |           |                 |           `-10*[{node}]
                       |           |                 `-10*[{npm run test:cy}]
                       |           `-10*[{node}]
                       `-10*[{npm run test-on}]

The pstree in the 7th line is the fake tput, so it seems to be called directly from a Cypress process. I guess it must be somewhere in Electron or Chromium? (Though an Electron codesearch and a Chromium codesearch didn’t turn up much either.)

guergana added a commit to wmde/new-lexeme-special-page that referenced this issue May 12, 2022
Add cypress-axe cypress-axe as our main CI accesibility testing tool.

Adding instructions on how to run the tests will be tackled on T302321

tput: No value for $TERM and no -T specified warning showing in CI is a known bug and still an open issue in cypress.
cypress-io/cypress#15679

Bug: T307910

Co-authored-by: Lucas Werkmeister <[email protected]>
@jlherren
Copy link

This also affects GitLab. It can easily be solved by manually setting the TERM variable. Refer to the documentation of the runner for details about that (GitHub or GitLab).

Setting TERM to linux works reasonably well on GitLab and silences that error.

Opinion: Since many of these runners do understand terminal escape sequences, they probably should advertise so by setting the TERM variable accordingly. As such, it is rather an issue with these runners and not something Cypress should attempt to fix.

@nagash77 nagash77 added existing workaround E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels May 12, 2023
@bf4
Copy link

bf4 commented Feb 8, 2024

putting this in my script works fine

if [ "${TERM:-}" = "" ]; then
  echo "Setting TERM to dumb" # makes tput happy
  TERM="dumb"
fi

@gsouf
Copy link

gsouf commented Jul 25, 2024

Started to happen randomly when running component testings in gh actions for the first time after years

@MikeMcC399
Copy link
Contributor

@gsouf

Started to happen randomly when running component testings in gh actions for the first time after years

Are you using the Cypress JavaScript Action https://github.com/cypress-io/github-action to run Cypress component testing?

@gsouf
Copy link

gsouf commented Jul 25, 2024

@MikeMcC399 no I was not aware of the existence of this action. We are simply using the cypress cli within a run step

cypress run -c video=false --config-file ./cypress.config.js --component --browser electron

I also would like to notice that setting the env variable TERM to any value as mentioned about will not fix.
Setting the value of TERM to foo will lead to the following error:

tput: unknown terminal "foo"

I will try the cypress action whenever I get a chance and reach back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing existing workaround Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
Projects
None yet
Development

No branches or pull requests

10 participants