Skip to content

Add integration test setup; check for legacy/new scope duplicates #1428

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

Conversation

pokey
Copy link
Member

@pokey pokey commented Apr 15, 2023

This PR adds a test to ensure that we don't try to define the same scope type both using our legacy node matchers and the new query scope handlers

I have mixed feelings about the way I made this work, but I wasn't sure how else to do it. The test needs to be defined in the engine, because otherwise we'd need to expose lots of stuff to cursorless-vscode-e2e, but it needs a full tree-sitter instance, so can't be run as a unit test. This file is the compromise I came up with 🤷‍♂️. We should maybe revise once we have tree-sitter integrated with this repo

I don't like that this code gets rolled up into our production bundle, but probably ok for this one-off. If we find this file growing, we should revisit

It's also possible that once we get rid of our ide singleton, we can relax the restriction that our test harness doesn't import from cursorless-engine. That would enable us to just import what we need from the engine directly in the test harness to run this test 🤔

Checklist

@pokey pokey force-pushed the bases/pokey/add-support-for-domain-leading-trailing-interior branch from f083bea to aab6502 Compare April 16, 2023 11:36
@pokey pokey force-pushed the pokey/add-integration-test-setup-check-for-legacynew-scope-duplicates branch 2 times, most recently from 8bc2544 to b0e6e8e Compare April 16, 2023 11:46
@@ -68,5 +69,7 @@ export function createCursorlessEngine(
hatTokenMap,
snippets,
injectIde,
runIntegrationTests: () =>
runIntegrationTests(treeSitter, languageDefinitions),
Copy link
Member

Choose a reason for hiding this comment

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

If we instead expose treeSitter and languageDefinitions, then we could avoid runIntegrationTests ending up in the prod bundle, right?

Copy link
Member Author

@pokey pokey Apr 16, 2023

Choose a reason for hiding this comment

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

No I don't think that would help. The issue is that the test needs to be defined inside cursorless engine; see PR description for more detail. Also notice that treeSitter actually comes from the caller, so exposing it wouldn't actually do anything

We'd need to expose everything imported in the file that defines the integration tests

But maybe I've misunderstood your proposal?

@pokey pokey force-pushed the pokey/add-integration-test-setup-check-for-legacynew-scope-duplicates branch from b0e6e8e to dfe7e46 Compare April 17, 2023 15:03
@pokey pokey force-pushed the bases/pokey/add-support-for-domain-leading-trailing-interior branch from c0aeedf to 631aa40 Compare April 17, 2023 15:03
@pokey pokey force-pushed the pokey/add-integration-test-setup-check-for-legacynew-scope-duplicates branch 2 times, most recently from 7b8c289 to a5b756c Compare April 19, 2023 11:12
@pokey pokey force-pushed the pokey/add-integration-test-setup-check-for-legacynew-scope-duplicates branch from a5b756c to c4191dd Compare April 19, 2023 12:17
@pokey pokey changed the base branch from bases/pokey/add-support-for-domain-leading-trailing-interior to main April 19, 2023 12:18
@pokey pokey marked this pull request as ready for review June 16, 2023 10:40
@pokey pokey requested a review from AndreasArvidsson June 16, 2023 10:40
@AndreasArvidsson AndreasArvidsson added this pull request to the merge queue Jun 17, 2023
Merged via the queue into main with commit b24f061 Jun 17, 2023
@AndreasArvidsson AndreasArvidsson deleted the pokey/add-integration-test-setup-check-for-legacynew-scope-duplicates branch June 17, 2023 10:08
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.

3 participants