With this change, running npm run tests will succeed.
It looks like the tests have not been run for a long time and the implementation has drifted, making the tests harder to run.
There are lots of small changes here:
Change the launch.json to remove --inspect-brk=9229, which was preventing the tests from running.
Add some exclusions to settings.json so that some unnecessary folders are removed from the file open dialog.
Fix up the mock objects so that the tests correctly reflect the current implementation.
Add await and async to setState in indexStore.ts so that the function correctly waits for the post message to complete. (Note this is the only change to non-test code in this PR.)
Change the test assertions so that they test the right things.
A few comments here on future work:
These tests all use stubs for the vscode API. This isn't ideal since it's complicated and we really should be testing the vscode API directly. Future work should be to run the unit tests from inside of a workbench so we don't need to stub out the vscode API.
We should be running the tests on each PR. I'll fix this in a followup PR.
To validate this PR, please run npm run tests locally and ensure the tests pass for you.
With this change, running
npm run tests
will succeed.It looks like the tests have not been run for a long time and the implementation has drifted, making the tests harder to run.
There are lots of small changes here:
launch.json
to remove--inspect-brk=9229
, which was preventing the tests from running.settings.json
so that some unnecessary folders are removed from the file open dialog.await
andasync
tosetState
in indexStore.ts so that the function correctly waits for the post message to complete. (Note this is the only change to non-test code in this PR.)A few comments here on future work:
To validate this PR, please run
npm run tests
locally and ensure the tests pass for you.