@@ -3,6 +3,7 @@ var path = require("path");
33var fs = require ( "fs" ) ;
44var vm = require ( "vm" ) ;
55var Test = require ( "mocha/lib/test" ) ;
6+ var ExtractTextPlugin = require ( "extract-text-webpack-plugin" ) ;
67var checkArrayExpectation = require ( "./checkArrayExpectation" ) ;
78
89var webpack = require ( "../lib/webpack" ) ;
@@ -48,13 +49,20 @@ describe("HotTestCases", function() {
4849 loaders : [ {
4950 test : / \. j s $ / ,
5051 loader : path . join ( __dirname , "hotCases" , "fake-update-loader.js" )
52+ } , {
53+ test : / \. c s s $ / ,
54+ loader : ExtractTextPlugin . extract ( {
55+ fallbackLoader : "style-loader" ,
56+ loader : "css-loader"
57+ } )
5158 } ]
5259 } ,
5360 target : "async-node" ,
5461 plugins : [
5562 new webpack . HotModuleReplacementPlugin ( ) ,
5663 new webpack . NamedModulesPlugin ( ) ,
57- new webpack . LoaderOptionsPlugin ( fakeUpdateLoaderOptions )
64+ new webpack . LoaderOptionsPlugin ( fakeUpdateLoaderOptions ) ,
65+ new ExtractTextPlugin ( "bundle.css" )
5866 ] ,
5967 recordsPath : recordsPath
6068 }
@@ -84,18 +92,18 @@ describe("HotTestCases", function() {
8492 } ) ;
8593 if ( checkArrayExpectation ( testDirectory , jsonStats , "error" , "errors" + fakeUpdateLoaderOptions . options . updateIndex , "Error" , done ) ) return ;
8694 if ( checkArrayExpectation ( testDirectory , jsonStats , "warning" , "warnings" + fakeUpdateLoaderOptions . options . updateIndex , "Warning" , done ) ) return ;
87- if ( callback ) callback ( ) ;
95+ if ( callback ) callback ( jsonStats ) ;
8896 } )
8997 }
9098
9199 function _require ( module ) {
92100 if ( module . substr ( 0 , 2 ) === "./" ) {
93101 var p = path . join ( outputDirectory , module ) ;
94- var fn = vm . runInThisContext ( "(function(require, module, exports, __dirname, __filename, it, NEXT) {" + fs . readFileSync ( p , "utf-8" ) + "\n})" , p ) ;
102+ var fn = vm . runInThisContext ( "(function(require, module, exports, __dirname, __filename, it, NEXT, STATS ) {" + fs . readFileSync ( p , "utf-8" ) + "\n})" , p ) ;
95103 var module = {
96104 exports : { }
97105 } ;
98- fn . call ( module . exports , _require , module , module . exports , outputDirectory , p , _it , _next ) ;
106+ fn . call ( module . exports , _require , module , module . exports , outputDirectory , p , _it , _next , jsonStats ) ;
99107 return module . exports ;
100108 } else return require ( module ) ;
101109 }
0 commit comments