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

Commit

Permalink
Merge pull request #7 from cypress-io/issue-5-dirty-cache-take-2
Browse files Browse the repository at this point in the history
Actually ensure browserify cache is clean
  • Loading branch information
chrisbreiding authored Dec 6, 2017
2 parents 2b2df9f + 6ac0c31 commit f49e9dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const defaultOptions = {
],
],
plugin: [],
cache: {},
packageCache: {},
},
watchifyOptions: {
// ignore watching the following or the user's system can get bogged down
Expand Down Expand Up @@ -92,7 +90,11 @@ const preprocessor = (options = {}) => {
log(`output: ${outputPath}`)

// allow user to override default options
const browserifyOptions = Object.assign({}, defaultOptions.browserifyOptions, options.browserifyOptions)
const browserifyOptions = Object.assign({}, defaultOptions.browserifyOptions, options.browserifyOptions, {
// these must always be new objects or 'update' events will not fire
cache: {},
packageCache: {},
})
const watchifyOptions = Object.assign({}, defaultOptions.watchifyOptions, options.watchifyOptions)

// we need to override and control entries
Expand Down
4 changes: 2 additions & 2 deletions test/index_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ describe('browserify preprocessor', function () {
const run = preprocessor(this.options)
return run(this.file)
.then(() => {
browserify.lastCall.args[0].cache = { foo: 'bar' }
browserify.lastCall.args[0].packageCache = { foo: 'bar' }
browserify.lastCall.args[0].cache.foo = 'bar'
browserify.lastCall.args[0].packageCache.foo = 'bar'
this.file.on.withArgs('close').yield()

return run(this.file)
Expand Down

0 comments on commit f49e9dc

Please sign in to comment.