question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When I have diagnostics: false jest still prints out type errors

See original GitHub issue

🐛 Bug Report

seems to me like diagnostics: false should ensure that we only transpile without doing any type checking

To Reproduce

Steps to reproduce the behavior: run any code with a type error with

  globals: {
    'ts-jest': {
      diagnostics: false
    }
  }

in your jest.config.js

this is for my test: image

Expected behavior

no type errors are checked

Link to repo (highly encouraged)

Debug log:

# content of ts-jest.log :

envinfo

System:
    OS: ubuntu 21.04
    Node version: 16

Npm packages:
    jest: 27
    ts-jest: 27
    typescript: 4.4.2
    babel(optional):

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
slinkardbrandoncommented, Sep 16, 2021

I have the same issue on Mac (Big Sur: 11.5.2), I cleared cache and still received these errors.

  "typescript": "4.4.3",
  "ts-jest": "27.0.5"

Neither isolatedModules: true or diagnostics: false in my tsconfig work for disabling type checking on *.jsx files.

// jest.config.js
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'jsdom',
  moduleFileExtensions: ['ts', 'js', 'tsx', 'jsx'],
  transform: {
    '^.+\\.(j|t)sx?$': 'ts-jest',
  },
  globals: {
    'ts-jest': { tsconfig: './test.tsconfig.json' },
 },
  moduleDirectories: [ 'node_modules', '<rootDir>../../node_modules' ]
};

My tsconfig (test.tsconfig.json)

{
  "include": ["src"],
  "compilerOptions": {
    "allowJs": true,
    "checkJs": false,
    "noEmit": true,
    "jsx": "react",
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "es6",
    "lib": ["es6", "dom"],
    "baseUrl": "src",
    "strict": false,
    "skipLibCheck": true,
    "declaration": false
  }
}

**Edit: ** it was my fault, ignore me.

My problem was that there were legitimate JavaScript type errors occurring and I assumed it was typescript type checking errors. Sorry about the confusion.

1reaction
capajcommented, Aug 28, 2021

interesting. It only happened once, after that it seems to work correctly. Might be a cache issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable type checking? · Issue #822 · kulshekhar/ts-jest - GitHub
Diagnostics false just prevents typescript errors to stop compilation but it still print errors. IsolatedModules hide some errors not all. The ...
Read more >
Diagnostics option | ts-jest - Huafu
The diagnostics option allows to configure error reporting. It can both be enabled/disabled entirely or limited to a specific type of errors and/or...
Read more >
Configuring Jest
Jest will run .mjs and .js files with nearest package.json 's type field set to module as ECMAScript Modules.
Read more >
Getting error in unit test from new vue 3 project generated by CLI
cypress. When I run npm run test:unit I get the below error TypeScript diagnostics (customize using `[jest- ...
Read more >
Diagnosing Diagnosis Errors: Lessons from a Multi ... - NCBI
A recurring issue is the sorting-out of relationships among errors in the diagnostic process, delay and misdiagnosis, and adverse patient outcomes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found