Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit f49e9dc

Browse files
Merge pull request #7 from cypress-io/issue-5-dirty-cache-take-2
Actually ensure browserify cache is clean
2 parents 2b2df9f + 6ac0c31 commit f49e9dc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ const defaultOptions = {
3535
],
3636
],
3737
plugin: [],
38-
cache: {},
39-
packageCache: {},
4038
},
4139
watchifyOptions: {
4240
// ignore watching the following or the user's system can get bogged down
@@ -92,7 +90,11 @@ const preprocessor = (options = {}) => {
9290
log(`output: ${outputPath}`)
9391

9492
// allow user to override default options
95-
const browserifyOptions = Object.assign({}, defaultOptions.browserifyOptions, options.browserifyOptions)
93+
const browserifyOptions = Object.assign({}, defaultOptions.browserifyOptions, options.browserifyOptions, {
94+
// these must always be new objects or 'update' events will not fire
95+
cache: {},
96+
packageCache: {},
97+
})
9698
const watchifyOptions = Object.assign({}, defaultOptions.watchifyOptions, options.watchifyOptions)
9799

98100
// we need to override and control entries

test/index_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ describe('browserify preprocessor', function () {
126126
const run = preprocessor(this.options)
127127
return run(this.file)
128128
.then(() => {
129-
browserify.lastCall.args[0].cache = { foo: 'bar' }
130-
browserify.lastCall.args[0].packageCache = { foo: 'bar' }
129+
browserify.lastCall.args[0].cache.foo = 'bar'
130+
browserify.lastCall.args[0].packageCache.foo = 'bar'
131131
this.file.on.withArgs('close').yield()
132132

133133
return run(this.file)

0 commit comments

Comments
 (0)