flush-cache
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,4 +5,6 @@ 'use strict' | ||
for (const item of Object.keys(require.cache)) { | ||
delete require.cache[item] | ||
if (!item.includes('deasync')) { | ||
delete require.cache[item] | ||
} | ||
} | ||
} |
{ | ||
"name": "flush-cache", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Flushes the internal node cache, useful (and recommended) when testing apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,2 +9,16 @@ # flush-cache | ||
## usage | ||
### install | ||
We'll install and save flush-cache so we can use it locally for our tests: | ||
``` | ||
npm i flush-cache --save-dev | ||
``` | ||
or, if you use [yarn](https://yarnpkg.com/): | ||
``` | ||
yarn add flush-cache --dev | ||
``` | ||
### common | ||
@@ -19,3 +33,3 @@ | ||
app.js | ||
test.js | ||
```js | ||
@@ -32,2 +46,5 @@ const flush = require('flush-cache') | ||
flush-cache deletes every require cache object, so when you require modules | ||
recursively, their cache gets flushed too. | ||
## examples | ||
@@ -75,1 +92,9 @@ ### mocha | ||
``` | ||
## gotchas | ||
Most modules expect the `require` command to always be cached, so some modules | ||
may break. If you detect modules which break this module, create an issue or a | ||
PR. | ||
Current require caches which are ignored: | ||
- deasync |
39090
29
97