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

Expanding the functionality of the test task #1116

Closed
alcuadrado opened this issue Dec 18, 2020 · 7 comments
Closed

Expanding the functionality of the test task #1116

alcuadrado opened this issue Dec 18, 2020 · 7 comments
Labels
type:feature Feature request

Comments

@alcuadrado
Copy link
Member

This are frequently requested features that we should implement:

  • Accept directories, not just files, as arguments
  • add a --bail option that makes mocha stop in the first failure
  • add a --grep option to filter tests

The last to ones are actually mocha arguments, but as our task system is more generic than mocha (e.g. a plugin could use jest instead), we should not communicate them as being mocha arguments. Maybe we should use different names.

@alcuadrado alcuadrado added the type:feature Feature request label Dec 18, 2020
@nventuro
Copy link
Contributor

Mocha 8 (a drop-in replacement for 7 for the the most part) also supports parallel tests - it'd be great if we had this and each test file got their own Hardhat node.

@sisco0
Copy link
Contributor

sisco0 commented Dec 23, 2020

Running a command such as

find . -maxdepth 3 -type d \( -name "node_modules" \) -prune -false -o -name "test" | xargs -i{} sh -c "( cd {}/../; npx mocha --bail --grep \"The filter phrase that you want\" --recursive \"test/**/*.ts\" )"

Could do the trick, but I am not sure if ./scripts/run-tests.js should be modified by using yargs package or not.

@fvictorio
Copy link
Member

@sisco0 that script is for running our internal tests. This issue is about changing how the test task works.

@sisco0
Copy link
Contributor

sisco0 commented Dec 28, 2020

I understand @fvictorio , I am not sure if sisco0@5459840 is the expected behavior, but I am testing it with --grep.

@cameel
Copy link

cameel commented Mar 1, 2022

Just came here to request this feature (--grep specifically) and I see that #2359 implemented it a week ago. Nice!

Would be great though if --invert was also available. Same with --exclude, though not having that one is easier to work around with find.

@sisco0
Copy link
Contributor

sisco0 commented Mar 1, 2022

Current issue could be closed as mentioned by @cameel . Great work team.

@alcuadrado
Copy link
Member Author

Can you create issues for the flags/arguments that you think are worth adding?

I'm closing this issue as it's too generic to be useuful.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:feature Feature request
Projects
None yet
Development

No branches or pull requests

5 participants