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

166
Visualizações
Why does `require` work locally but not in CI?

I am trying to use jest.axe in my very basic react app (created by create-react-app). Locally, this passes just fine with yarn test

const {axe, toHaveNoViolations} = require('jest-axe')
expect.extend(toHaveNoViolations)
... 
const {container} = render(<App/>)
const results = await axe(container)
expect(results).toHaveNoViolations()

However, in my github actions pipeline I get the following error

    Cannot find module 'jest-axe' from 'src/App.test.tsx'

  3 | import App from './App';
  4 |
> 5 | const {axe, toHaveNoViolations} = require('jest-axe')
       

Actions File

name: Run Unit Tests
on: [push]
jobs:
  Run-Unit-Tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Run tests
        id: run-tests
        run: CI=true yarn test

My yarn.lock file has jest.axe.

I tried import { axe, toHaveNoViolations } from "jest-axe"; in my test file but then it fails locally :/

about 4 years ago · Santiago Trujillo
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