Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsconfig.editor.json breaks tests development (Cannot find name 'describe') #10314

Closed
Lonli-Lokli opened this issue May 16, 2022 · 6 comments · Fixed by #10316
Closed

tsconfig.editor.json breaks tests development (Cannot find name 'describe') #10314

Lonli-Lokli opened this issue May 16, 2022 · 6 comments · Fixed by #10316
Assignees
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug

Comments

@Lonli-Lokli
Copy link

Current Behavior

Create angular app with latst (14.1) Nx
Open app.component.spec.ts

TS2593: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try npm i --save-dev @types/jest or npm i --save-dev @types/mocha and then add 'jest' or 'mocha' to the types field in your tsconfig.

image

Expected Behavior

No error in webstorm or vscode

Steps to Reproduce

npx create-nx-workspace@latest with angular preset

Failure Logs

The reason for this error in tests is new tsconfig.editor.json which do not respect jest types

{
  "extends": "./tsconfig.json",
  "include": ["**/*.ts"],
  "compilerOptions": {
    "types": []
  }
}

Environment

>  NX   Report complete - copy this into the issue template

  Node : 14.18.2
  OS   : win32 x64
  npm  : 6.14.15
  
  nx : 14.1.5
  @nrwl/angular : 14.1.5
  @nrwl/cypress : 14.1.5
  @nrwl/detox : Not Found
  @nrwl/devkit : 14.1.5
  @nrwl/eslint-plugin-nx : 14.1.5
  @nrwl/express : Not Found
  @nrwl/jest : 14.1.5
  @nrwl/js : Not Found
  @nrwl/linter : 14.1.5
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/nx-cloud : Not Found
  @nrwl/nx-plugin : Not Found
  @nrwl/react : Not Found
  @nrwl/react-native : Not Found
  @nrwl/schematics : Not Found
  @nrwl/storybook : 14.1.5
  @nrwl/web : Not Found
  @nrwl/workspace : 14.1.5
  typescript : 4.6.4
  rxjs : 7.4.0
  ---------------------------------------
  Community plugins:

@leosvelperez
Copy link
Member

@Lonli-Lokli thanks for reporting this!

A fix was merged and should be released soon so new apps/workspaces won't have the issue. Please make sure to amend your existing tsconfig.editor.json with the types you need.

@e-oz
Copy link

e-oz commented May 19, 2022

For already generated tsconfig.editor.json files, this might help:
In "compilerOptions", set "types": ["jest", "node"]

@cnpallares
Copy link

Hey guys, a question regarding this topic...

What is tsconfig.editor.json for?

Thanks in advance :)

@kwiniarski97
Copy link

kwiniarski97 commented Sep 15, 2022

@cnpallares I found a description here: #3810
Thanks to that

New files and files that aren't referenced by source files have a tsconfig.editor.json for the type checker in the IDE.

@cnpallares
Copy link

@kwiniarski97 thank you!

I will take a look.

🙌🏽

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants