mocha-sidebar icon indicating copy to clipboard operation
mocha-sidebar copied to clipboard

[Typescript] "Run test at cursor" command fails with "Mocha is only available for JavaScript files."

Open ledenis opened this issue 1 year ago • 0 comments

Description

In a typescript project, Run test at cursor command fails with this notification message: "Mocha is only available for JavaScript files."

Steps to Reproduce

  1. Open a .spec.ts file
  2. Place cursor on a test
  3. Run the command with: Ctrl+Shift+P > "Mocha: Run test at cursor"

Expected Results

No error message and the test should run.

Actual Results

The notification message "Mocha is only available for JavaScript files." is shown and the test is not run.

Note: If I manually change the "Language Mode" to "JavaScript", it works, even if the file still contains typescript code!

Settings file

  "mocha.files.glob": "**/*.spec.ts",
  "mocha.options": {
    "config": "packages/services/my-api/.mocharc.unit.js"
  },
  "mocha.env": {
    "NODE_ENV": "test"
  },
  "mocha.requires": ["ts-node/register"],

Versions

  • VScode: v1.82.0
  • Mocha SideBar: v0.22.2
  • Node Version: v18.15.0

OS version

  • [X] Linux
  • [ ] Mac
  • [ ] Windows

ledenis avatar Sep 11 '23 11:09 ledenis