hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

vscode-test sample linked from readme is not working #190

Closed ssbarnea closed 2 years ago

ssbarnea commented 2 years ago

Please also allow me to thank you for all the time you invested into making extensions testing easier with mocha and integrating it with vscode.

I followed the README.md section about vscode-test and loaded the sample project from https://github.com/hbenl/vscode-extension-samples/tree/test-explorer-integration/helloworld-test-sample and I was still unable to see the list of loaded tests.

With "testExplorer.useNativeTesting": false, I was able to get the error below:

And with "testExplorer.useNativeTesting": true, I was only able to get the tests listed inside Test View panel on Explorer, but unable to client on them in any way, it was just a dead tree. In fact I do not even know where these values are coming from because I do not see them inside the sample tests:

My guess is that is coming from another extension and is unrelated to the adapter.

One the other hand, this vscode-mocha-test-adapter repository seems to load fine in test explorer but that one does not make any use of the options mentioned at https://github.com/hbenl/vscode-mocha-test-adapter#running-vs-code-extension-tests-using-vscode-test and in particular -- so is not of much use for exemplifying use of vscode-test with text explorer.

So far I am still looking for an example for combining mocha with vscode-test that can be used even with mocha command line, where npx mocha --dry-run would just work. Apparently this repository is the only one that seems to match that, but without using vscode-test. Are there others that could be used as a better sample model (less complex)?

hbenl commented 2 years ago

I finally figured out why this wasn't working and fixed it in version 2.13.3 of this extension. I've also updated the example increasing the timeout for connecting to the mocha worker, please update it and try again. Note that you may still see a timeout the first time you try: vscode-test may download a newer version of VS Code to use for the tests and that download takes a while - just wait until the download has finished (a new VS Code window will open afterwards) and then try again.

hbenl commented 2 years ago

So far I am still looking for an example for combining mocha with vscode-test that can be used even with mocha command line, where npx mocha --dry-run would just work.

I don't think this is possible because of how vscode-test works: you need to let it call mocha instead of calling it yourself.