Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

256
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda