@@ -39,8 +39,8 @@ describe("plugin registration", () => {
3939 updateNodePath ( NODE_PATH ) ;
4040 } ) ;
4141
42- it ( "only loads default plugins referenced within configuration" , ( ) => {
43- let res = pluginsByBucket ( {
42+ it ( "only loads default plugins referenced within configuration" , async ( ) => {
43+ let res = await pluginsByBucket ( {
4444 js : [ { foo : "lorem" } ]
4545 } ) ;
4646 assertDeep ( normalizeAll ( res ) , {
@@ -53,7 +53,7 @@ describe("plugin registration", () => {
5353 markup : [ ]
5454 } ) ;
5555
56- res = pluginsByBucket ( {
56+ res = await pluginsByBucket ( {
5757 sass : [ { bar : "ipsum" } ]
5858 } ) ;
5959 assertDeep ( normalizeAll ( res ) , {
@@ -66,7 +66,7 @@ describe("plugin registration", () => {
6666 markup : [ ]
6767 } ) ;
6868
69- res = pluginsByBucket ( {
69+ res = await pluginsByBucket ( {
7070 js : [ { foo : "lorem" } ] ,
7171 sass : [ { bar : "ipsum" } ]
7272 } ) ;
@@ -84,8 +84,8 @@ describe("plugin registration", () => {
8484 } ) ;
8585 } ) ;
8686
87- it ( "allows overriding default plugins" , ( ) => {
88- let res = pluginsByBucket ( {
87+ it ( "allows overriding default plugins" , async ( ) => {
88+ let res = await pluginsByBucket ( {
8989 js : [ { foo : "bar" } ] ,
9090 plugins : [ {
9191 key : "js" ,
@@ -120,20 +120,20 @@ describe("plugin resolution", () => {
120120 updateNodePath ( NODE_PATH ) ;
121121 } ) ;
122122
123- it ( "provides a default set of plugins" , ( ) => {
124- let res = _determinePlugins ( ) ;
123+ it ( "provides a default set of plugins" , async ( ) => {
124+ let res = await _determinePlugins ( ) ;
125125 assertDeep ( normalizePlugins ( res ) , DEFAULTS ) ;
126126 } ) ;
127127
128- it ( "supports custom plugins" , ( ) => {
128+ it ( "supports custom plugins" , async ( ) => {
129129 // plugin function within configuration
130130 let anon = ( ) => { } ;
131131 let config = [ {
132132 key : "dummy" ,
133133 bucket : "static" ,
134134 plugin : anon
135135 } ] ;
136- let res = _determinePlugins ( config ) ;
136+ let res = await _determinePlugins ( config ) ;
137137 assertDeep ( normalizePlugins ( res ) , Object . assign ( { } , DEFAULTS , {
138138 dummy : {
139139 bucket : "static" ,
@@ -144,7 +144,7 @@ describe("plugin resolution", () => {
144144 // nested package identifier
145145 let pkg = "faucet-pipeline-dummy" ;
146146 config [ 0 ] . plugin = pkg ;
147- res = _determinePlugins ( config ) ;
147+ res = await _determinePlugins ( config ) ;
148148 assertDeep ( normalizePlugins ( res ) , Object . assign ( { } , DEFAULTS , {
149149 dummy : {
150150 bucket : "static" ,
@@ -154,7 +154,7 @@ describe("plugin resolution", () => {
154154 } ) ) ;
155155
156156 // simple package identifier
157- res = _determinePlugins ( [ pkg ] ) ;
157+ res = await _determinePlugins ( [ pkg ] ) ;
158158 assertDeep ( normalizePlugins ( res ) , Object . assign ( { } , DEFAULTS , {
159159 dummy : {
160160 bucket : "static" ,
@@ -163,12 +163,12 @@ describe("plugin resolution", () => {
163163 } ) ) ;
164164 } ) ;
165165
166- it ( "allows overriding plugins' default configuration" , ( ) => {
166+ it ( "allows overriding plugins' default configuration" , async ( ) => {
167167 let config = [ {
168168 key : "yummy" ,
169169 plugin : "faucet-pipeline-dummy"
170170 } ] ;
171- let res = _determinePlugins ( config ) ;
171+ let res = await _determinePlugins ( config ) ;
172172 assertDeep ( normalizePlugins ( res ) , Object . assign ( { } , DEFAULTS , {
173173 yummy : {
174174 bucket : "static" ,
@@ -177,7 +177,7 @@ describe("plugin resolution", () => {
177177 } ) ) ;
178178
179179 config [ 0 ] . bucket = "styles" ;
180- res = _determinePlugins ( config ) ;
180+ res = await _determinePlugins ( config ) ;
181181 assertDeep ( normalizePlugins ( res ) , Object . assign ( { } , DEFAULTS , {
182182 yummy : {
183183 bucket : "styles" ,
@@ -188,12 +188,12 @@ describe("plugin resolution", () => {
188188 } ) ;
189189
190190 it ( "balks at invalid package identifiers" , ( ) => {
191- assert . throws ( ( ) => {
192- _determinePlugins ( [ "faucet-pipeline-yummy" ] ) ;
191+ assert . rejects ( async ( ) => {
192+ return _determinePlugins ( [ "faucet-pipeline-yummy" ] ) ;
193193 } , / e x i t 1 / ) ;
194194
195- assert . throws ( ( ) => {
196- _determinePlugins ( [ {
195+ assert . rejects ( ( ) => {
196+ return _determinePlugins ( [ {
197197 // NB: local configuration must not be comprehensive to ensure
198198 // plugin is loaded
199199 key : "yummy" ,
@@ -203,8 +203,8 @@ describe("plugin resolution", () => {
203203 } ) ;
204204
205205 it ( "balks at duplicate configuration keys" , ( ) => {
206- assert . throws ( ( ) => {
207- _determinePlugins ( [ {
206+ assert . rejects ( ( ) => {
207+ return _determinePlugins ( [ {
208208 key : "dummy" ,
209209 bucket : "static" ,
210210 plugin : ( ) => { }
@@ -217,16 +217,16 @@ describe("plugin resolution", () => {
217217 } ) ;
218218
219219 it ( "balks at invalid plugins" , ( ) => {
220- assert . throws ( ( ) => {
221- _determinePlugins ( [ "faucet-pipeline-invalid-a" ] ) ;
220+ assert . rejects ( ( ) => {
221+ return _determinePlugins ( [ "faucet-pipeline-invalid-a" ] ) ;
222222 } , / e x i t 1 / ) ;
223223
224- assert . throws ( ( ) => {
225- _determinePlugins ( [ "faucet-pipeline-invalid-b" ] ) ;
224+ assert . rejects ( ( ) => {
225+ return _determinePlugins ( [ "faucet-pipeline-invalid-b" ] ) ;
226226 } , / e x i t 1 / ) ;
227227
228- assert . throws ( ( ) => {
229- _determinePlugins ( [ "faucet-pipeline-invalid-c" ] ) ;
228+ assert . rejects ( ( ) => {
229+ return _determinePlugins ( [ "faucet-pipeline-invalid-c" ] ) ;
230230 } , / e x i t 1 / ) ;
231231 } ) ;
232232
@@ -237,14 +237,14 @@ describe("plugin resolution", () => {
237237 } ;
238238 [ "static" , "scripts" , "styles" , "markup" ] . forEach ( bucket => {
239239 plugin . bucket = bucket ;
240- assert . doesNotThrow ( ( ) => {
241- _determinePlugins ( [ plugin ] ) ;
240+ assert . doesNotReject ( ( ) => {
241+ return _determinePlugins ( [ plugin ] ) ;
242242 } , / e x i t 1 / ) ;
243243 } ) ;
244244
245245 plugin . bucket = "dummy" ;
246- assert . throws ( ( ) => {
247- _determinePlugins ( [ plugin ] ) ;
246+ assert . rejects ( ( ) => {
247+ return _determinePlugins ( [ plugin ] ) ;
248248 } , / e x i t 1 / ) ;
249249 } ) ;
250250} ) ;
0 commit comments