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

🚀 Feature: Add an option to run all tests, including skipped ones #5223

Closed
2 of 3 tasks
JavaScriptBach opened this issue Oct 10, 2024 · 4 comments
Closed
2 of 3 tasks
Labels
status: in triage a maintainer should (re-)triage (review) this issue type: feature enhancement proposal

Comments

@JavaScriptBach
Copy link

Feature Request Checklist

Overview

It would be nice to have an option that could make Mocha run all tests, even skipped ones.

At my company, we skip flaky tests in our CI build to avoid blocking developers, but we'd like to set up a "quarantined" tests build that runs all tests. This allows us to check when flaky tests are no longer flaky and can be safely introduced back into the blocking tests pool.

Suggested Solution

mocha --includeSkipped

Alternatives

Sed all my test files before running Mocha, which isn't particularly sound.

Additional Info

No response

@JavaScriptBach JavaScriptBach added status: in triage a maintainer should (re-)triage (review) this issue type: feature enhancement proposal labels Oct 10, 2024
@JoshuaKGoldberg
Copy link
Member

Hmm, but how would Mocha / a project's testing infrastructure know which tests are skipped for flakiness vs. other reasons?

This feels to me like a project-specific preference that would be better solved in project-land. For example, you could write your own function that calls it or it.skip depending on some process.env.RUN_FLAKY_TESTS:

function myIt(title, callback) {
  if (process.env.RUN_FLAKY_TESTS) {
    it(title, callback);
  } else {
    it.skip(title, callback);
  }
}

Am I missing some nuance to the request?

@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author waiting on response from OP - more information needed and removed status: in triage a maintainer should (re-)triage (review) this issue labels Oct 11, 2024
@JavaScriptBach
Copy link
Author

Mocha doesn't need to know why a test is skipped. Under this model, the user asked for all tests to be run, so interpreting the results becomes the user's problem.

Your workaround is fair; it just feels weird that Mocha supports marking a test as skipped, but doesn't support other ways of interacting with it. If I wanted a test to never run, the logical thing to do would be to delete the test entirely.

@JoshuaKGoldberg JoshuaKGoldberg added status: in triage a maintainer should (re-)triage (review) this issue and removed status: waiting for author waiting on response from OP - more information needed labels Oct 11, 2024
@JoshuaKGoldberg
Copy link
Member

If I wanted a test to never run, the logical thing to do would be to delete the test entirely.

Not necessarily. Folks sometimes try to keep skipped tests around to make sure they stay valid for static analysis such as linting or type-checking. A test might be skipped for a time-sensitive reason such as an external service not being ready yet or dropping support for something at a known time.

Anyway, per #5027, we're not looking to add a lot of new features. I'm going to go ahead and close this as a pretty specific use case. Thanks for filing + discussing! 🤎

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
@JavaScriptBach
Copy link
Author

JavaScriptBach commented Oct 29, 2024

OK, fair enough. Thanks for considering it, and thanks for taking up the maintenance of this project. I feel like it is in good hands after seeing the work you've done in typescript-eslint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in triage a maintainer should (re-)triage (review) this issue type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

2 participants