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

add .mochaignore #2036

Closed
TrejGun opened this issue Jan 3, 2016 · 11 comments
Closed

add .mochaignore #2036

TrejGun opened this issue Jan 3, 2016 · 11 comments
Labels
status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior

Comments

@TrejGun
Copy link

TrejGun commented Jan 3, 2016

Please add .mochaignore file same as .gitignore
to ignore some files

yes i know there is .skip for tests but it would be good to ignore dirs or files with utils and configs

@boneskull boneskull added the type: feature enhancement proposal label Jan 3, 2016
@boneskull
Copy link
Contributor

absolutely a good idea, but probably won't get implemented before #1969 unless there's a PR.

@boneskull boneskull added the next label Jan 7, 2016
@megagon
Copy link

megagon commented Mar 27, 2016

I want to make PR for this, do you have any wishes about how it should looks like?
my suggestion is to make by default something like mocha.ignore with something like this:
var skiplist = {folders:[], files: [], suites:[], tests:[]};
How is it sound?

@ScottFreeCode
Copy link
Contributor

ScottFreeCode commented Apr 17, 2016

A couple thoughts/questions (EDIT: I can answer these since I'm more familiar than I was back when I asked...):

  1. Should test files ignored this way be loaded but marked entirely as pending? That would cause problems for the use cases discussed in Option exclude certain files by pattern when testing recursively #1577. (Such a feature might be an interesting option to add to title-based filtering, but that's another matter.)
  2. Can/should something equivalent to this work in the in-browser testing mode? For a page that can be opened manually to run tests, test files have to be included explicitly anyway, so there's no need for an option to exclude some; for automatic browser testing, e.g. with Karma, typically the browser testing harness is in control of both including and excluding files.

@boneskull boneskull added future needs to wait and removed next labels May 22, 2016
@boneskull boneskull added status: accepting prs Mocha can use your help with this one! and removed future needs to wait labels Nov 3, 2016
@boneskull
Copy link
Contributor

since #1969 is still basically nowhere, a PR for this would be helpful.

@gndelia
Copy link

gndelia commented Mar 23, 2019

Is the idea to allow a configuration as megagon suggested?

Something like

{folders:[], files: [], suites:[], tests:[]};

?

  • folders: Ignores a complete folder and its subdirectories from running tests
  • files: Ignore specific files (by name ? by path?)
  • suites: to ignore describe tests by name
  • test: to ignore specific it tests by name

Should they show as pending, or as they do not exists?

@boneskull
Copy link
Contributor

As of v6, this is implemented as the excludes config value. A .mochajs.json which includes the following should exhibit the requested behavior:

{
  "excludes": [
    "some-glob/**",
    "some-other-glob/*.derp"
  ]
}

I think that we could alias the excludes option to ignore.

@boneskull
Copy link
Contributor

Would prefer we don't support .mochaignore, simply because it's functionality that's now duplicated in a config file.

FWIW, ESLint is moving in the direction of dropping its "ignore" file.

@plroebuck
Copy link
Contributor

Pre-Mocha-6, this might have been attractive, but now it's just an extra file to process with no benefit not already available.

Close as "wontfix" IMO.

@gndelia
Copy link

gndelia commented Apr 12, 2019

Cool, I did not know the exclude option was already implemented. Then I agree, this should be closed

@boneskull
Copy link
Contributor

I'm cool with an ignore alias. I can probably knock that out.

@boneskull boneskull added status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior and removed type: feature enhancement proposal status: accepting prs Mocha can use your help with this one! labels Apr 12, 2019
@boneskull
Copy link
Contributor

Closing this because we already support this behavior in .mocharc.* config files as of v6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior
Projects
None yet
Development

No branches or pull requests

6 participants