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

Array of tests #20

Open
brianfiszman opened this issue Sep 10, 2024 · 2 comments
Open

Array of tests #20

brianfiszman opened this issue Sep 10, 2024 · 2 comments

Comments

@brianfiszman
Copy link

Hi! I'm trying to handle "Data Driven Tests", this is achieved by creating an array of test cases and iterate them for running them individually.

This is an example of that done using Jest and neotest-jest adapter.
image

I want to achieve the same result using mocha but I'm not being able to and my current job is forcing me to use Mocha. Could you add this feature?
image
image

Its also throwing me False Negatives.

Mocha's version is 10.7.3
Neovim Version
image

@MisanthropicBit
Copy link
Collaborator

Hi. Thanks for submitting an issue and providing some info on your setup.This was also raised in #16.

I coincidentally implemented parametric tests (as I know this feature by) for another neotest adapter which required me to study the neotest-jest implementation so I now have some knowledge about how it works.

Usually, adapters will invoke the test runner (mocha in this case) to list all tests, including parametric tests so implementing this feature hinges on what data is output by the --dry-run option.

I'm currently on vacation and won't have access to a computer for a while but I'll have a go at this when I return. If you're up for it, you are welcome to submit a PR 🙂

@MisanthropicBit
Copy link
Collaborator

@brianfiszman I'm back from vacation now and have played a bit around with the --dry-run option but it seems that it doesn't work as intended. Running either of the two commands on a small test repo just executes the tests as normal without listing them. It doesn't matter if I select the json reporter.

> node_modules/.bin/mocha a.test.js
> npx mocha -- --dry-run a.test.js

It's been a while since I've used mocha. As you're using it at work perhaps you know how to make the command-line flag work?

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

No branches or pull requests

2 participants