Closed sebastiantf closed 3 years ago
The problem is that the extension trusts Mocha to find the right file for a test, but in your setup Mocha thinks the tests are located in root/test/index.ts
. Try adding "mochaExplorer.multiFileSuites": true
to your VSCode settings.
Awesome! It works fine now. Thanks!
I am using the Mocha Test Explorer
I have the following folder structure for my mocha tests:
root/test/index.ts:
The Mocha Test Explorer lists all the individual test in this test folder structure very correctly. And I could run each test individually via the UI too.
The problem is when a test fails. When I double click on the failed test to take me to the line in the particular test thats failing, it only takes me to the
describe
line in theroot/test/index.ts
which the failed test is part of.i.e, If a test inside
ClassUnitTest
failed, Mocha Test Explorer UI takes me just to thedescribe('Class', ClassUnitTest);
line inroot/test/index.ts
But the stacktrace that I get on the Test Explorer Output console in VSCode reports the correct line number