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

259
Vistas
How can I stop the function execution in my test?

How can I test this case?

I have a variable in the setup:

setup() {
      const address = `${process.env.VAR_ENV}`
  onMounted(async () => {
        const stop = await isContinuing(address)

The function await isContinuing(address) is executing when the test is run. How can I make the function not run when the test is ran?

My test's undefined wrap variable

beforeEach(() => {
  wrapper = shallowMount(App, {
  })
})

describe('Dashboard', () => {
  it('test to verify if initial section.', () => {
    const expected = 0
    expect(wrapper.findComponent({ ref: 'section' }).element.value).toBe(
      expected
    )
  })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Jest (and I assume most test frameworks) sets NODE_ENV enviromental variable to test. So you can use a simple if statement to not execute something in tests:

if(process.env.NODE_ENV !== 'test') {
  const stop = await isContinuing(address)
}
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