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

getSnapshot with filter also adds .ejs files in the snap file #183

Closed
sam0410 opened this issue May 19, 2023 · 5 comments
Closed

getSnapshot with filter also adds .ejs files in the snap file #183

sam0410 opened this issue May 19, 2023 · 5 comments
Labels

Comments

@sam0410
Copy link

sam0410 commented May 19, 2023

I did :

result.getSnapshot(file => {
          return !(file.path.endsWith('TestData.java'))

This added .ejs file in the generator.spec.mjs.snap file.

Although it got fixed by

result.getSnapshot(file => {
          return !(file.path.endsWith('TestData.java') || file.path.endsWith('.ejs'))

I don't think .ejs files or infact no template files should be included in the first place.

@sam0410
Copy link
Author

sam0410 commented May 19, 2023

The culprit is in this line : https://github.com/mshima/mem-fs-editor/blob/master/src/actions/dump.ts#L24

When we pass a non-null non-string filter, it does not use the defaultDumpFilter

Will make the change.

@mshima
Copy link
Member

mshima commented May 19, 2023

Providing a function filter will override default filter that removes untouched files. You can:

  • filter by yourself.
  • use pattern like result.getSnapshot('**/*.java');

@sam0410
Copy link
Author

sam0410 commented May 19, 2023

Shouldn't the line that you mentioned (i.e., line 24) entail filter ? (filter && defaultDumpFilter) : defaultDumpFilter.

No filter should contain non template files.

@mshima
Copy link
Member

mshima commented May 19, 2023

I would say that the most important filter is to filter by the test result's cwd.
EJS files will probably outside the result cwd.
Dumping all files may be interesting for files written outside apis.
But converting the filter parameter to an object and adding flags should be ok.

@github-actions
Copy link
Contributor

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants