Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
Next.js's loadEnvConfig fails to load environment variables in Cypress' support file

I need some of the environment variables from my Next.js project in my Cypress tests and it seems that the proper way to do that is to use loadEnvConfig from @next/env.

Cypress enables a way to run code before each test via its support file.

This is what my support file looks like:

import { loadEnvConfig } from '@next/env'
import './commands'

loadEnvConfig('/path/to/my/project')

When I run Next in dev mode and then Cypress I get the following errors in the console:

index.js:1 Failed to load env from .env.production.local TypeError: t.statSync is not a function
    at loadEnvConfig (index.js:1)
    at Object../cypress/support/index.js (index.js:4)
    at __webpack_require__ (bootstrap:19)
    at Object.0 (tests?p=cypress/support/index.js:682)
    at __webpack_require__ (bootstrap:19)
    at eval (bootstrap:83)
    at eval (bootstrap:83)
    at eval (<anonymous>)

There are three more similar ones, for .env.local, .env.production, and .env.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda