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

207
Vistas
Accessing enviroment variable in testcafe

I am having trouble accessing environment variable that I have set permanently in windows using setx. I have set a path to the download folder that I would access in my test code.

C:\Users\XXXX>echo %DOWNLOADS%
    C:/Users/XXXX/Downloads/

In my test code -

import { Selector, fixture } from 'testcafe';
fixture`Auto Test`
  .page`http://XXXXXX/index.html`.beforeEach(async (browser) => {
  let directory;
  if (browser.browser.os.name === 'Windows') {
        directory = env.DOWNLOADS;

I see following error -
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

What am I missing here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you can acess the environment variable like

process.env.DEV_MODE

DEV_MODE is my environment variable

sample code

  if (process.env.DEV_MODE) {
    baseUrl = 'http://localhost:5000';
  } else {
    baseUrl = config.API.BaseUrl;
  }
about 4 years ago · Juan Pablo Isaza Denunciar
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