@@ -46,7 +46,7 @@ describe('browserify preprocessor', function () {
4646 sandbox . stub ( fs , 'ensureDirAsync' ) . resolves ( )
4747
4848 this . options = { }
49- this . config = {
49+ this . file = {
5050 filePath : 'path/to/file.js' ,
5151 outputPath : 'output/output.js' ,
5252 shouldWatch : false ,
@@ -55,7 +55,7 @@ describe('browserify preprocessor', function () {
5555 }
5656
5757 this . run = ( ) => {
58- return preprocessor ( this . options ) ( this . config )
58+ return preprocessor ( this . options ) ( this . file )
5959 }
6060 } )
6161
@@ -72,7 +72,7 @@ describe('browserify preprocessor', function () {
7272
7373 describe ( 'preprocessor function' , function ( ) {
7474 afterEach ( function ( ) {
75- this . config . on . withArgs ( 'close' ) . yield ( ) // resets the cached bundles
75+ this . file . on . withArgs ( 'close' ) . yield ( ) // resets the cached bundles
7676 } )
7777
7878 describe ( 'when it finishes cleanly' , function ( ) {
@@ -91,9 +91,9 @@ describe('browserify preprocessor', function () {
9191 browserify . returns ( this . bundlerApi )
9292
9393 const run = preprocessor ( this . options )
94- return run ( this . config )
94+ return run ( this . file )
9595 . then ( ( ) => {
96- return run ( this . config )
96+ return run ( this . file )
9797 } )
9898 . then ( ( ) => {
9999 expect ( browserify ) . to . be . calledOnce
@@ -102,7 +102,7 @@ describe('browserify preprocessor', function () {
102102
103103 it ( 'specifies the entry file' , function ( ) {
104104 return this . run ( ) . then ( ( ) => {
105- expect ( browserify . lastCall . args [ 0 ] . entries [ 0 ] ) . to . equal ( this . config . filePath )
105+ expect ( browserify . lastCall . args [ 0 ] . entries [ 0 ] ) . to . equal ( this . file . filePath )
106106 } )
107107 } )
108108
@@ -120,14 +120,14 @@ describe('browserify preprocessor', function () {
120120 } )
121121
122122 it ( 'watches when shouldWatch is true' , function ( ) {
123- this . config . shouldWatch = true
123+ this . file . shouldWatch = true
124124 return this . run ( ) . then ( ( ) => {
125125 expect ( this . bundlerApi . plugin ) . to . be . calledWith ( watchify )
126126 } )
127127 } )
128128
129129 it ( 'use default watchifyOptions if not provided' , function ( ) {
130- this . config . shouldWatch = true
130+ this . file . shouldWatch = true
131131 return this . run ( ) . then ( ( ) => {
132132 expect ( this . bundlerApi . plugin ) . to . be . calledWith ( watchify , {
133133 ignoreWatch : [
@@ -143,7 +143,7 @@ describe('browserify preprocessor', function () {
143143 } )
144144
145145 it ( 'includes watchifyOptions if provided' , function ( ) {
146- this . config . shouldWatch = true
146+ this . file . shouldWatch = true
147147 this . options . watchifyOptions = { ignoreWatch : [ 'node_modules' ] }
148148 return this . run ( ) . then ( ( ) => {
149149 expect ( this . bundlerApi . plugin ) . to . be . calledWith ( watchify , {
@@ -181,7 +181,7 @@ describe('browserify preprocessor', function () {
181181
182182 it ( 'creates write stream to output path' , function ( ) {
183183 return this . run ( ) . then ( ( ) => {
184- expect ( fs . createWriteStream ) . to . be . calledWith ( this . config . outputPath )
184+ expect ( fs . createWriteStream ) . to . be . calledWith ( this . file . outputPath )
185185 } )
186186 } )
187187
@@ -193,7 +193,7 @@ describe('browserify preprocessor', function () {
193193
194194 it ( 'resolves with the output path' , function ( ) {
195195 return this . run ( ) . then ( ( outputPath ) => {
196- expect ( outputPath ) . to . equal ( this . config . outputPath )
196+ expect ( outputPath ) . to . equal ( this . file . outputPath )
197197 } )
198198 } )
199199
@@ -207,21 +207,21 @@ describe('browserify preprocessor', function () {
207207 it ( 'emits `rerun` when there is an update' , function ( ) {
208208 this . bundlerApi . on . withArgs ( 'update' ) . yields ( )
209209 return this . run ( ) . then ( ( ) => {
210- expect ( this . config . emit ) . to . be . calledWith ( 'rerun' )
210+ expect ( this . file . emit ) . to . be . calledWith ( 'rerun' )
211211 } )
212212 } )
213213
214214 it ( 'closes bundler when shouldWatch is true and `close` is emitted' , function ( ) {
215- this . config . shouldWatch = true
215+ this . file . shouldWatch = true
216216 return this . run ( ) . then ( ( ) => {
217- this . config . on . withArgs ( 'close' ) . yield ( )
217+ this . file . on . withArgs ( 'close' ) . yield ( )
218218 expect ( this . bundlerApi . close ) . to . be . called
219219 } )
220220 } )
221221
222222 it ( 'does not close bundler when shouldWatch is false and `close` is emitted' , function ( ) {
223223 return this . run ( ) . then ( ( ) => {
224- this . config . on . withArgs ( 'close' ) . yield ( )
224+ this . file . on . withArgs ( 'close' ) . yield ( )
225225 expect ( this . bundlerApi . close ) . not . to . be . called
226226 } )
227227 } )
@@ -260,7 +260,7 @@ describe('browserify preprocessor', function () {
260260 process . on ( 'unhandledRejection' , handler )
261261 this . createWriteStreamApi . on . withArgs ( 'finish' ) . onFirstCall ( ) . yields ( )
262262
263- this . config . emit = ( ) => {
263+ this . file . emit = ( ) => {
264264 setTimeout ( ( ) => {
265265 expect ( handler ) . not . to . be . called
266266 process . removeListener ( 'unhandledRejection' , handler )
@@ -277,11 +277,11 @@ describe('browserify preprocessor', function () {
277277 it ( 'rejects subsequent request after and update bundle errors' , function ( ) {
278278 this . createWriteStreamApi . on . withArgs ( 'finish' ) . onFirstCall ( ) . yields ( )
279279 const run = preprocessor ( this . options )
280- return run ( this . config )
280+ return run ( this . file )
281281 . then ( ( ) => {
282282 streamApi . on . withArgs ( 'error' ) . yieldsAsync ( new Error ( 'bundle error' ) ) . returns ( { pipe ( ) { } } )
283283 this . bundlerApi . on . withArgs ( 'update' ) . yield ( )
284- return run ( this . config )
284+ return run ( this . file )
285285 } )
286286 . then ( ( ) => {
287287 throw new Error ( 'should not resolve' )
0 commit comments