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

2.2K
Visualizações
TypeError: Jest: a transform must export a `process` function

Recently upgrading my app to Angular 11. Jest has been set up as the default testing framework. Running npm test results in the following error:

● Test suite failed to run

    TypeError: Jest: a transform must export a `process` function.

      20 | @Component({
      21 |     selector: 'app-bx-input-textbox',
    > 22 |     template: require('./bx-input-textbox.component.html'),
         |               ^
      23 |     styles: [String(require('./bx-input-textbox.component.scss'))],
      24 |     providers: [
      25 |         {

      at ScriptTransformer._getTransformer (node_modules/@jest/transform/build/ScriptTransformer.js:357:15)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:419:28)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:523:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
      at src/app/core/components/bx-input-textbox/bx-input-textbox.component.ts:22:15
      at Object.<anonymous> (src/app/core/components/bx-input-textbox/bx-input-textbox.component.ts:38:1)

// jest.config.js

module.exports = {
  testEnvironment: "jsdom",
  transform: {
    ".+\\.(css|styl|less|sass|scss)$": "<rootDir>/node_modules/jest-css-modules-transform",
    "\\.(ts|js)$": ['ts-jest']
  },
  setupFilesAfterEnv: ['./jest.setup.js'],
  globals: {    
    "ts-jest": {
      tsConfig: {
        // allow js in typescript
        allowJs: true,
      },
    },
  },
  // If you need to test a specifc file just include it here
  //testMatch: ['**/repository.jobs.spec.ts'],
  testMatch: []
};

Package versions "@angular-builders/jest": "12.1.0", "@types/jest": "24.9.1", "ts-jest": "26.0.0", "jest": "24.9.0",

I have tried different configurations with the jest.config.js file but not able to resolve this error. Any pointers to resolve this issue would be helpful.

over 4 years ago · Santiago Trujillo
5 Respostas
Responde à pergunta

0

your ts-jest version must match the jest version.

over 4 years ago · Santiago Trujillo Relatório

0

You may also need to upgrade jest-cli, along with jest & ts-jest.

over 4 years ago · Santiago Trujillo Relatório

0

Wiping node modules and .jest folder finally got rid of this.

rm -rf ./node_modules && rm -rf .jest && yarn
over 4 years ago · Santiago Trujillo Relatório

0

Upgraded jest and ts-jest to v27 to fix this issue

over 4 years ago · Santiago Trujillo Relatório

0

Met the same issue with "ts-jest": "^27.0.5" and fixed by revert to "ts-jest": "^26.4.2"

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