@@ -12,8 +12,9 @@ describe("NodeTemplatePlugin", function() {
1212 output : {
1313 path : path . join ( __dirname , "js" ) ,
1414 filename : "result.js" ,
15- chunkFilename : "[hash].result[id].js" ,
16- libraryTarget : "commonjs2" ,
15+ chunkFilename : "[hash].result.[id].js" ,
16+ library : "abc" ,
17+ libraryTarget : "commonjs" ,
1718 } ,
1819 optimize : {
1920 minimize : true
@@ -22,21 +23,53 @@ describe("NodeTemplatePlugin", function() {
2223
2324 } , function ( err , stats ) {
2425 if ( err ) return err ;
25- // console.log(stats.toString({colors: true}));
2626 stats . hasErrors ( ) . should . be . not . ok ;
2727 stats . hasWarnings ( ) . should . be . not . ok ;
28- var result = require ( "./js/result" ) ;
28+ var result = require ( "./js/result" ) . abc ;
2929 result . nextTick . should . be . equal ( process . nextTick ) ;
3030 result . fs . should . be . equal ( require ( "fs" ) ) ;
3131 result . loadChunk ( 456 , function ( chunk ) {
3232 chunk . should . be . eql ( 123 ) ;
33- var sameTick = true ;
3433 result . loadChunk ( 567 , function ( chunk ) {
3534 chunk . should . be . eql ( { a : 1 } ) ;
36- sameTick . should . be . eql ( true ) ;
3735 done ( ) ;
3836 } ) ;
39- sameTick = false ;
37+ } ) ;
38+ } ) ;
39+ } ) ;
40+
41+ it ( "should compile and run a simple module in single mode" , function ( done ) {
42+ webpack ( {
43+ context : path . join ( __dirname , "fixtures" , "nodetest" ) ,
44+ target : "node" ,
45+ output : {
46+ path : path . join ( __dirname , "js" ) ,
47+ filename : "result2.js" ,
48+ chunkFilename : "[hash].result2.[id].js" ,
49+ library : "def" ,
50+ libraryTarget : "umd" ,
51+ } ,
52+ optimize : {
53+ minimize : true ,
54+ maxChunks : 1
55+ } ,
56+ entry : "./entry" ,
57+
58+ } , function ( err , stats ) {
59+ if ( err ) return err ;
60+ stats . hasErrors ( ) . should . be . not . ok ;
61+ stats . hasWarnings ( ) . should . be . not . ok ;
62+ var result = require ( "./js/result2" ) ;
63+ result . nextTick . should . be . equal ( process . nextTick ) ;
64+ result . fs . should . be . equal ( require ( "fs" ) ) ;
65+ var sameTick = true ;
66+ result . loadChunk ( 456 , function ( chunk ) {
67+ chunk . should . be . eql ( 123 ) ;
68+ sameTick . should . be . eql ( true ) ;
69+ result . loadChunk ( 567 , function ( chunk ) {
70+ chunk . should . be . eql ( { a : 1 } ) ;
71+ done ( ) ;
72+ } ) ;
4073 } ) ;
4174 } ) ;
4275 } ) ;
0 commit comments