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

.mockignore is not working like .gitignore #75

Open
natenho opened this issue Mar 28, 2021 · 0 comments
Open

.mockignore is not working like .gitignore #75

natenho opened this issue Mar 28, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@natenho
Copy link
Owner

natenho commented Mar 28, 2021

Describe the bug
When using .mockignore to prevent some mock JSON files from being loaded by Mockaco, .mockignore from parent folders are not considered.
According to .gitignore documentation,

[...] Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):[...]

  • Patterns read from a .gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file.

To Reproduce

  1. Create a .mockignore in the mock root path like:
**/*.json
  1. Create a sub-folder named "Foo" and include any mock inside it:
{  
  "response": {
    "body": "This mock should not be returned!"
  }
}
  1. Run mockaco
mockaco --urls="http://localhost:5000"
  1. Access the url
$ curl http://localhost:5000
"This mock should not be returned!"

Expected behavior
The parent folder .mockignore should be respected, and the mock should not be returned.
If there is any .mockignore, it's setting should override parent rules just like .gitignore.

@natenho natenho added the bug Something isn't working label Mar 28, 2021
@natenho natenho self-assigned this Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant