Skip to content

Add integration tests of QueryDiscovery#2447

Merged
robertbrignull merged 4 commits intomainfrom
robertbrignull/QueryDiscovery-tests
May 25, 2023
Merged

Add integration tests of QueryDiscovery#2447
robertbrignull merged 4 commits intomainfrom
robertbrignull/QueryDiscovery-tests

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

This PR introduces integration tests of the QueryDiscovery class.

Includes one fix for something I discovered while writing the tests. If a workspace folder doesn't include any query files, we probably don't want to create a FileTreeDirectory for it. This does raise some questions about what the panel will look like when there's no queries at all, but I think we can solve that and do it separately after this PR.

I've made the tests work with the code is it is now, but honestly after this PR I'm considering removing some of the vscode abstractions. So that basically means reverting #2437 and #2431 because they arguably make the code more confusing and testing harder.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team May 25, 2023 09:10
@robertbrignull robertbrignull requested a review from a team as a code owner May 25, 2023 09:10

onWatcherDidChangeEvent.fire(workspace.workspaceFolders![0].uri);

// Wait for refresh to finish
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fully happy with this. It appears to work, but I'd like to avoid sleeps like this because they can be a source of flakiness.

I was thinking if we could modify the Discovery class so you can await the completion of the current refresh. It might be a little fiddly, but it could make these tests and QLTestDiscovery tests more robust.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open an internal issue for this because I want to address it and not forget about it, but also don't want to delay this PR. I do want to continue working on these tests for the next few days and make them better.

Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small comment, but LGTM!

I've made the tests work with the code is it is now, but honestly after this PR I'm considering removing some of the vscode abstractions. So that basically means reverting #2437 and #2431 because they arguably make the code more confusing and testing harder.

Thanks for thinking about this! I don't have a strong opinion on it either way 😅

…es-panel/query-discovery.test.ts

Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
@robertbrignull
Copy link
Copy Markdown
Contributor Author

Thanks for thinking about this! I don't have a strong opinion on it either way 😅

I do want to continue working on these tests and make them better and the production code clearer too. So I just want to reassure I don't plan to leave tech debt here if at all possible. 👷🏼

@robertbrignull robertbrignull enabled auto-merge May 25, 2023 14:42
@robertbrignull robertbrignull merged commit a27b0a4 into main May 25, 2023
@robertbrignull robertbrignull deleted the robertbrignull/QueryDiscovery-tests branch May 25, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants