Skip to content

cleanEnv error not logged properly with Jest in Github Actions #229

@Floriferous

Description

@Floriferous

When I try to run tests with jest, I see the following error in my test suite. It works locally with the same env vars for some reason.

I don't have a way to see what the error is. Is there maybe a more basic logger that I can use out of the box in tests?

> jest --config src/test/unit/jest.config.ts --ci --forceExit

  ●  process.exit called with "1"

       6 | dotenv.config({ path: dotEnvPath });
       7 |
    >  8 | export const env = cleanEnv(process.env, {
         |                            ^
       9 |   ENV_1: num(),
      10 |   ENV_2: bool({ default: false }),
      11 |   ENV_3: str(),

      at defaultReporter (node_modules/envalid/src/reporter.ts:81:13)
      at getSanitizedEnv (node_modules/envalid/src/core.ts:104:3)
      at cleanEnv (node_modules/envalid/src/envalid.ts:18:34)
      at Object.<anonymous> (src/utils/env.ts:8:[28](https://github.com/org/repo/actions/runs/14227168459/job/39869333489?pr=223#step:13:29))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions