Skip to content

'Nx Console' vscode extension - incorrect assertion type priority for unit tests (Jest / Cypress) #2259

Open
@andrew-ni

Description

@andrew-ni

Current Behavior

When writing Jest unit tests in *.spec.ts files (Angular), there are red squiggly lines underneath all of my assertions, and intellisense does not show the correct options, because Chai assertion types are taking priority over the Jasmine assertion types. When I run these tests, they pass as expected, but this makes it very annoying to develop. For now I have to disable the extension to write unit tests.

Nx Console extension enabled - this shows incorrect intellisense
nxconsole-enabled-error
nxconsole-enabled-no-intellisense

Nx Console extension disabled - this shows the correct intellisense
nxconsole-disabled-expected

Expected Behavior

When writing Jest unit tests in *.spec.ts files (Angular), the intellisense should be correct. When Nx Console extension is disabled, the intellisense works fine.

Steps to Reproduce

We have an NX Angular monorepo that uses jest, cypress, and playwright for testing. This issue occurs in all *.spec.ts files

    "@angular/core": "^17.3.12",
    "@nx/cypress": "19.4.1",
    "@nx/jest": "19.4.1",
    "@nx/playwright": "19.4.1",
    "@types/jasmine": "~5.1.4",
    "@types/jest": "^29.5.12",

Failure Logs / Images / Videos

VsCode 'Problems' tab has the error messages:

Property 'toEqual' does not exist on type 'Assertion'. Did you mean 'equal'?
'equal' is declared here. (node_modules/cypress/types/chai/index.d.ts > Chai > Assertion > equal

Environment

extension: nrwl.angular-console

nx report:

Node   : 18.16.0
OS     : darwin-arm64
yarn   : 4.4.1

nx (global)        : 19.6.5
nx                 : 19.4.1
@nx/js             : 19.4.1
@nx/jest           : 19.4.1
@nx/linter         : 19.4.1
@nx/eslint         : 19.4.1
@nx/workspace      : 19.4.1
@nx/angular        : 19.4.1
@nx/cypress        : 19.4.1
@nx/devkit         : 19.4.1
@nx/eslint-plugin  : 19.4.1
@nx/playwright     : 19.4.1
@nrwl/tao          : 19.4.1
@nx/web            : 19.4.1
@nx/webpack        : 19.4.1
typescript         : 5.4.5
---------------------------------------
Community plugins:
@ngneat/transloco    : 6.0.4
@ngxs/storage-plugin : 18.0.0
@ngxs/store          : 18.0.0
ng-mocks             : 14.13.1
---------------------------------------
Local workspace plugins:
         @cci/plugin-generator

VSCode info:

Version: 1.93.1 (Universal)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions