"Too long with no output" on job that completes

we have a project that is failing ci because our “test” step is timing out, even though the task completes successfully.

the image is circleci/openjdk:15-jdk-buster, which we then install node on (our project is js but one of our build tools requires java), then run a test script, which calls lerna, which calls all of the test scripts in the sub-packages that have tests, which are all based on jest (although some use a wrapper script like the nest cli or react-scripts).

when I rerun the job with ssh, login and run the same task, the same command runs and exits normally in a few seconds. this only seems to happen during ci.

I managed to isolate which specific test suite was hanging and also determined that it needed the --runInBand flag to run correctly. still don’t know why this only happens in ci.

CI executes in a non-interactive non-login shell, which is very different from a login shell. Depending on the specific tools that you are using, this can sometimes lead to the situation that you described above.

Have you tried no_output_timeout ? https://circleci.com/docs/2.0/configuration-reference/

- run:
    name: Step Name
    command: sleep 15m & echo "I'm still alive"
    no_output_timeout: 20m