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

Uniquely identify tests #13

Merged
merged 4 commits into from
Feb 19, 2024
Merged

Conversation

MisanthropicBit
Copy link
Collaborator

@MisanthropicBit MisanthropicBit commented Jan 13, 2024

With the current implementation, running the test in either suite 1 or suite 2 will run the other test as well because the pattern that is constructed and passed to mocha doesn't account for the suite name.

describe('top-level suite', () => {
  describe('suite 1', () => {
    it('tests a test', async () => {
      console.log("first test")
    })
  })
  describe('suite 2', () => {
    it('tests a test', async () => {
      console.log("second test")
    })
  })
})

These changes follow the code in neotest-jest with some modification. Hopefully the code and test are straight-forward.

Failing test is related to neotest's treesitter module.

@MisanthropicBit MisanthropicBit marked this pull request as ready for review January 28, 2024 14:09
@adrigzr
Copy link
Owner

adrigzr commented Jan 29, 2024

Hi @MisanthropicBit, thanks for your PR! Could you take a look at the failing jobs? 🙏

@MisanthropicBit
Copy link
Collaborator Author

I had some time to look at the issue which stems from this neotest PR which changes the failing line. It is listed as a breaking change that requires at least neovim 0.9.0 (as seen from the release notes) which is why the test fails with 0.7.0.

Options would be:

  • To conditionally install an earlier version of neotest for the test on 0.7.0.
  • Remove the 0.7.0 test from the workflow if you wish for it to run against the latest neotest version.

This isn't technically a blocker for this PR since it has nothing to do with my changes, just that neotest got updated meanwhile, but we might as well fix it now 🙂

@MisanthropicBit
Copy link
Collaborator Author

MisanthropicBit commented Feb 11, 2024

I've removed the 0.7.0 test from the workflow and added a note about requiring at least neotest 4.0.0.

Now the tests against nightly fail, likely because something happened with treesitter upstream. I've verified that the query works with :TSPlaygroundToggle (on 0.9.0) so I'll try to see what changed (if this is intentional) or if it's a bug in nightly when I have some more time.

@MisanthropicBit
Copy link
Collaborator Author

@adrigzr So I think I figured out the issue:

  • Two weeks ago, the javascript tree-sitter parser updated the function keyword so it didn't collide with the function (parser) literal with v0.20.2.
  • This change was then included in nightly nvim-treesitter two weeks ago as well causing the tests here to fail.

I've updated the discover_positions function to use function_expression instead which solves the issue but this is an issue for users that don't have nvim-treesitter >= 0.9.2 so perhaps the query should be conditional on the nvim-treesitter version?

@adrigzr
Copy link
Owner

adrigzr commented Feb 19, 2024

Hello @MisanthropicBit, the change looks good to me. I'm merging it with the main branch. Thanks a lot!

@adrigzr adrigzr merged commit 6ccc781 into adrigzr:main Feb 19, 2024
2 checks passed
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.

2 participants