testkube icon indicating copy to clipboard operation
testkube copied to clipboard

Confusing error in Cypress tests - tput terminal type not set

Open vLia opened this issue 3 years ago • 2 comments

Describe the bug tput: No value for $TERM and no -T specified error line shows up in Cypress tests

To Reproduce Steps to reproduce the behavior:

  1. Run Cypress test using the instructions from the Getting started guide.

Expected behavior Cypress output is clean

Version / Cluster

  • Which testkube version? v1.3.44
  • What Kubernetes cluster? (e.g. GKE, EKS, Openshift etc, local KinD, local Minikube) EKS
  • What Kubernetes version? V1.22 Note: also shows on Testkube demo environment

Screenshots


[STARTED] Task without title.
[TITLE]  Verified Cypress!       /root/.cache/Cypress/8.3.0/Cypress
[SUCCESS]  Verified Cypress!       /root/.cache/Cypress/8.3.0/Cypress

Opening Cypress...

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

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    8.3.0                                                                              │
  │ Browser:    Electron 91 (headless)                                                             │
  │ Specs:      1 found (simple-test.js)                                                           │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  simple-test.js                                                                  (1 of 1)
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating

  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        1                                                                                │
  │ Passing:      0                                                                                │
  │ Failing:      1                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  1                                                                                │
  │ Video:        true                                                                             │
  │ Duration:     14 seconds                                                                       │
  │ Spec Ran:     simple-test.js                                                                   │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


  (Screenshots)

  -  /tmp/git-sparse-checkout2283720888/repo/examples/cypress/screenshots/simple-test     (1280x720)
     .js/The Home Page -- successfully loads (failed).png                                           


  (Video)

  -  Started processing:  Compressing to 32 CRF                                                     
  -  Finished processing: /tmp/git-sparse-checkout2283720888/repo/examples/cypress/vi    (3 seconds)
                          deos/simple-test.js.mp4                                                   


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

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✖  simple-test.js                           00:14        1        -        1        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✖  1 of 1 failed (100%)                     00:14        1        -        1        -        -
 

Additional context Reported by user on Discord

vLia avatar Jul 28 '22 23:07 vLia

I think it's all about setting terminal config in Dockerfile - xterm should be a safe default edit: I checked how official Cypress images are built - it's exactly that: https://github.com/cypress-io/cypress-docker-images/blob/af8b5d2e1dfc1d7a5fa1fc24555a21fddb7fe1db/browsers/node16.14.2-slim-chrome103-ff102/Dockerfile#L78 (ENV TERM=xterm)

tkonieczny avatar Aug 22 '22 20:08 tkonieczny

Something in the script is calling the tput binary. tput attempts to inspect the $TERM variable to determine the current terminal so it can produce the correct control sequences. There isn't a terminal when cron is running so you get that error from tput.

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.

https://stackoverflow.com/questions/29979966/tput-no-value-for-term-and-no-t-specified-error-logged-by-cron-process

exu avatar Aug 23 '22 08:08 exu