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

280
Visualizações
ReferenceError: ko is not defined when running unit test in Jest

I am new to Jest and Stackoverflow posting. I have been trying to add unit test cases for knockoutJS application but getting ReferenceError: ko is not defined error when running the test. Any help would be appreciated.

below is the package.json file.

    {
  "name": "jstesting",
  "version": "1.0.0",
  "description": "",
  "main": "eVIPs.js",
  "type": "module",
  "scripts": {
    "test": "jest"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/preset-react": "^7.17.12",
    "jest": "^28.1.0",
    "jest-html-reporters": "^3.0.8",
    "typescript": "^2.9.2"
  },
  
  "dependencies": {
    "@babel/preset-env": "^7.18.2",
    "@babel/preset-typescript": "^7.17.12",
    "babel-jest": "^28.1.0",
    "jquery": "^3.6.0",
    "knockout": "^3.5.1"
  },
  "jest": {
    "reporters": [
      "default",
      [
        "jest-html-reporters",
        {
          "publicPath": "./html-report",
          "filename": "report.html",
          "openReport": false
        }
      ]
    ],
    "collectCoverage": true
  }
}

and this is the test file.

    import testLogin from '../loginPage';
import homeJS, { HomeViewModel } from '../Home';
about 4 years ago · Juan Pablo Isaza
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