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

option to specify cache directory #684

Closed
borisovg opened this issue Oct 3, 2017 · 8 comments
Closed

option to specify cache directory #684

borisovg opened this issue Oct 3, 2017 · 8 comments

Comments

@borisovg
Copy link

borisovg commented Oct 3, 2017

I am running nyc from within my ROOT/tests/ directory (which has a separate private package.json file that pulls in all test related libraries and I use --cwd ../ option when running tests.

After tests are finished there is ROOT/node_modules/.cache/nyc directory created (i.e. outside of ROOT/tests) which is annoying for apps that don't depend on anything and also apps that commit dependency code to git for various annoying operational reasons.

Please make the cache directory location configurable, similar to --temp-directory.

@bcoe
Copy link
Member

bcoe commented Oct 4, 2017

@borisovg I believe you already should be able to configure the cache directory using --cache-dir, although it's not advertised in the options output.

Assuming this works for you, I'd happily take a pull request that documents it.

@borisovg
Copy link
Author

borisovg commented Oct 4, 2017

@bcoe I've just tried that option and now the cache directory is not being created at all, but tests run without issue.

Here's the command I that I am running:

./node_modules/.bin/nyc \
        --all \
        --cwd ../ \
        --exclude tests/** \
        --reporter=html \
        --reporter=text \
        --cache-dir ./tests/.nyc_cache \
        --temp-directory ./tests/.nyc_output \
        node_modules/.bin/mocha *.spec.js

Edit:

Actually, it does get created as ./tests/tests/.nyc_cache which is inconsistent behaviour with the --temp-directory option (but I prefer the former out of the two).

@borisovg
Copy link
Author

borisovg commented Oct 4, 2017

And really the cleanest solution would be to by default create those directories relative to the current working directory (as opposed to the --cwd) as is already done for the coverage directory.

In my case it would mean they would be created within somewhere within ./tests and I could drop the options entirely.

@bastianwegge
Copy link

Or you could use the .nycrc file and include

{
  "report-dir": ".tmp/istanbul",
  "temp-directory": ".tmp/.nyc_output"
}

for example.

@madarche
Copy link

madarche commented Oct 1, 2018

I confirm that the --cache-dir cli option works. But the .nycrc doesn't support a corresponding cache-dir property.

@stale stale bot added the wontfix label Jan 5, 2019
@JaKXz
Copy link
Member

JaKXz commented Jan 23, 2019

Has this been addressed by #968?

@stale
Copy link

stale bot commented Mar 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 24, 2019
@borisovg
Copy link
Author

--cache-dirdoes the job

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

No branches or pull requests

5 participants