@@ -12,6 +12,10 @@ describe("Compiler", function() {
1212 options . entry = entry ;
1313 options . context = path . join ( __dirname , "fixtures" ) ;
1414 options . output . pathinfo = true ;
15+ var logs = {
16+ mkdirp : [ ] ,
17+ writeFile : [ ] ,
18+ } ;
1519
1620 var c = new Compiler ( ) ;
1721 c . options = new WebpackOptionsApply ( ) . process ( options , c ) ;
@@ -20,9 +24,11 @@ describe("Compiler", function() {
2024 c . outputFileSystem = {
2125 join : path . join . bind ( path ) ,
2226 mkdirp : function ( path , callback ) {
27+ logs . mkdirp . push ( path ) ;
2328 callback ( ) ;
2429 } ,
2530 writeFile : function ( name , content , callback ) {
31+ logs . writeFile . push ( name , content ) ;
2632 files [ name ] = content . toString ( "utf-8" ) ;
2733 callback ( ) ;
2834 }
@@ -44,9 +50,26 @@ describe("Compiler", function() {
4450 stats . errors [ 0 ] . should . be . instanceOf ( Error ) ;
4551 throw stats . errors [ 0 ] ;
4652 }
53+ stats . logs = logs ;
4754 callback ( stats , files ) ;
4855 } ) ;
4956 }
57+ it ( "should compile a single file to deep output" , function ( done ) {
58+ var sep = path . sep ;
59+
60+ compile ( "./c" , {
61+ output : {
62+ path : 'what' ,
63+ filename : 'the' + sep + 'hell.js' ,
64+ }
65+ } , function ( stats , files ) {
66+ stats . logs . mkdirp . should . eql ( [
67+ 'what' ,
68+ 'what' + sep + 'the' ,
69+ ] ) ;
70+ done ( ) ;
71+ } ) ;
72+ } ) ;
5073 it ( "should compile a single file" , function ( done ) {
5174 compile ( "./c" , { } , function ( stats , files ) {
5275 files . should . have . property ( "bundle.js" ) . have . type ( "string" ) ;
@@ -135,4 +158,4 @@ describe("Compiler", function() {
135158 done ( ) ;
136159 } ) ;
137160 } ) ;
138- } ) ;
161+ } ) ;
0 commit comments