File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,20 @@ describe("main", function() {
488488 it ( "should be able to pipe loaders" , function ( ) {
489489 require ( "testloader!../loaders/reverseloader!../resources/abc.txt" ) . should . be . eql ( "cbawebpack" ) ;
490490 } ) ;
491+ it ( "should allow combinations of async and sync loaders" , function ( ) {
492+ require ( "../loaders/syncloader!./a" ) . should . be . eql ( "a" ) ;
493+ require ( "../loaders/asyncloader!./a" ) . should . be . eql ( "a" ) ;
494+
495+ require ( "../loaders/syncloader!../loaders/syncloader!./a" ) . should . be . eql ( "a" ) ;
496+ require ( "../loaders/syncloader!../loaders/asyncloader!./a" ) . should . be . eql ( "a" ) ;
497+ require ( "../loaders/asyncloader!../loaders/syncloader!./a" ) . should . be . eql ( "a" ) ;
498+ require ( "../loaders/asyncloader!../loaders/asyncloader!./a" ) . should . be . eql ( "a" ) ;
499+
500+ require ( "../loaders/asyncloader!../loaders/asyncloader!../loaders/asyncloader!./a" ) . should . be . eql ( "a" ) ;
501+ require ( "../loaders/asyncloader!../loaders/syncloader!../loaders/asyncloader!./a" ) . should . be . eql ( "a" ) ;
502+ require ( "../loaders/syncloader!../loaders/asyncloader!../loaders/syncloader!./a" ) . should . be . eql ( "a" ) ;
503+ require ( "../loaders/syncloader!../loaders/syncloader!../loaders/syncloader!./a" ) . should . be . eql ( "a" ) ;
504+ } ) ;
491505 describe ( "buildin" , function ( ) {
492506 it ( "should handle the raw loader correctly" , function ( ) {
493507 require ( "raw!../resources/abc.txt" ) . should . be . eql ( "abc" ) ;
Original file line number Diff line number Diff line change 1+ module . exports = function ( content ) {
2+ var cb = this . async ( ) ;
3+ if ( ! cb ) throw new Error ( "Loader should allow async mode" ) ;
4+ if ( cb !== this . callback ) throw new Error ( "result of this.async() should be equal to this.callback" ) ;
5+ process . nextTick ( function ( ) {
6+ cb ( null , content ) ;
7+ } ) ;
8+ } ;
Original file line number Diff line number Diff line change 1+ module . exports = function ( content ) {
2+ return content ;
3+ } ;
You can’t perform that action at this time.
0 commit comments