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

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

Open
1 of 3 tasks
ledenis opened this issue Sep 11, 2023 · 0 comments

Comments

@ledenis
Copy link

ledenis commented Sep 11, 2023

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

  • Linux
  • Mac
  • Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant