-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Cache key doesn't take --source-map
into account
#552
Comments
@tomdale are you picturing that we'd perhaps bake the nyc config into the hash generated for the cache? This might be the simplest approach is that it might place quite a bit of cruft in the cache directory if you're fiddling with your settings; Would it be worth enumerating a few flags that have the most noticeable effect on the cache, start simple? |
@bcoe That sounds like a great approach. I think we do something similar in the Ember build system: feed the serialized config POJO into the hashing function. If that's a tractable option here, it seems better than trying to whitelist config options on a case-by-case basis. Better err on the side of too much cache invalidation than too little. 😄 |
Just observed a similar problem with As an aside it might be worthwhile using |
@novemberborn I'd be tempted to start by just extending our existing hashing function with @tomdale's suggestion; this logic was already pulled into its own internal module so this will be nice and simple
tldr; I'd like to at least perform an audit of nyc's dependencies before I pull in too many more (I'm pretty sure there are some libraries from early on in the project that might be vestigial at this point). And I think that implementing a slightly better caching function for nyc should be pretty simple without needing to add any dependencies. |
I think this is straightforward to accomplish with Node's built-in crypto.createHash('md5')
.update(JSON.stringify(options), 'utf8')
.digest('hex'); |
Expected Behavior
nyc
's cache would be invalidated when different flags are passed.Observed Behavior
Toggling source maps off and on doesn't have an effect; the result from whatever option was used the first time the command was run is used.
Bonus Points! Code (or Repository) that Reproduces Issue
Forensic Information
Operating System: OS X 10.11.6
Environment Information: https://gist.github.com/tomdale/f572f3f94cdbe808eb0d9abfb64880e9
The text was updated successfully, but these errors were encountered: