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

Add tests #88

Closed
wants to merge 1 commit into from
Closed

Conversation

MarcelRobitaille
Copy link
Collaborator

There have been a few changes recently that broke other use cases. For example:

This PR adds tests for CommandHandler.ts and VariableResolver.ts, the two files that I think are the most likely to be broken by new features.

These tests aren't perfect. For example, they always use useFirstResult so that the picker does not have to be mocked. This is only a starting place that will hopefully catch the biggest future breakages.

The vscode module is mocked for these tests (I looked into vscode-test, but I could not for the life of me get it to work). In my opinion, we should test this extension, not VSCode. As long as there is a good way to get mock data, then we will have good and isolated tests.

There is a mock/spy src/mocks/vscode.ts. It's job is to record the results of vscode api calls (spy) and to give them back later during test execution (mock). The test data is obtained by setting up the spy, running the extension in the debugger, running some tasks, and saving the printed data.

Fixes #62

@MarcelRobitaille MarcelRobitaille force-pushed the tests branch 3 times, most recently from fdff96f to 609d564 Compare March 30, 2024 14:21
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

Successfully merging this pull request may close these issues.

Add tests
1 participant