1+ "use strict" ;
2+
13/*globals describe it */
2- var should = require ( "should" ) ;
3- var path = require ( "path" ) ;
4+ const should = require ( "should" ) ;
5+ const path = require ( "path" ) ;
46
5- var webpack = require ( "../lib/webpack" ) ;
7+ const webpack = require ( "../lib/webpack" ) ;
68
7- var base = path . join ( __dirname , "fixtures" , "errors" ) ;
9+ const base = path . join ( __dirname , "fixtures" , "errors" ) ;
810
9- describe ( "Errors" , function ( ) {
11+ describe ( "Errors" , ( ) => {
1012 function customOutputFilesystem ( c ) {
11- var files = { } ;
13+ const files = { } ;
1214 c . outputFileSystem = {
1315 join : path . join . bind ( path ) ,
1416 mkdirp : function ( path , callback ) {
@@ -24,9 +26,9 @@ describe("Errors", function() {
2426
2527 function getErrors ( options , callback ) {
2628 options . context = base ;
27- var c = webpack ( options ) ;
29+ const c = webpack ( options ) ;
2830 customOutputFilesystem ( c ) ;
29- c . run ( function ( err , stats ) {
31+ c . run ( ( err , stats ) => {
3032 if ( err ) throw err ;
3133 should . strictEqual ( typeof stats , "object" ) ;
3234 stats = stats . toJson ( {
@@ -40,14 +42,14 @@ describe("Errors", function() {
4042 callback ( stats . errors , stats . warnings ) ;
4143 } ) ;
4244 }
43- it ( "should throw an error if file doesn't exist" , function ( done ) {
45+ it ( "should throw an error if file doesn't exist" , ( done ) => {
4446 getErrors ( {
4547 entry : "./missingFile"
46- } , function ( errors , warnings ) {
48+ } , ( errors , warnings ) => {
4749 errors . length . should . be . eql ( 2 ) ;
4850 warnings . length . should . be . eql ( 0 ) ;
4951 errors . sort ( ) ;
50- var lines = errors [ 0 ] . split ( "\n" ) ;
52+ let lines = errors [ 0 ] . split ( "\n" ) ;
5153 lines [ 0 ] . should . match ( / m i s s i n g F i l e .j s / ) ;
5254 lines [ 1 ] . should . match ( / ^ M o d u l e n o t f o u n d / ) ;
5355 lines [ 1 ] . should . match ( / \. \/ d i r \/ m i s s i n g 2 / ) ;
@@ -60,25 +62,25 @@ describe("Errors", function() {
6062 done ( ) ;
6163 } ) ;
6264 } ) ;
63- it ( "should report require.extensions as unsupported" , function ( done ) {
65+ it ( "should report require.extensions as unsupported" , ( done ) => {
6466 getErrors ( {
6567 entry : "./require.extensions"
66- } , function ( errors , warnings ) {
68+ } , ( errors , warnings ) => {
6769 errors . length . should . be . eql ( 0 ) ;
6870 warnings . length . should . be . eql ( 1 ) ;
69- var lines = warnings [ 0 ] . split ( "\n" ) ;
71+ const lines = warnings [ 0 ] . split ( "\n" ) ;
7072 lines [ 0 ] . should . match ( / r e q u i r e .e x t e n s i o n s \. j s / ) ;
7173 lines [ 1 ] . should . match ( / r e q u i r e .e x t e n s i o n s i s n o t s u p p o r t e d b y w e b p a c k / ) ;
7274 done ( ) ;
7375 } ) ;
7476 } ) ;
75- it ( "should warn about case-sensitive module names" , function ( done ) {
77+ it ( "should warn about case-sensitive module names" , ( done ) => {
7678 getErrors ( {
7779 entry : "./case-sensitive"
78- } , function ( errors , warnings ) {
80+ } , ( errors , warnings ) => {
7981 if ( errors . length === 0 ) {
8082 warnings . length . should . be . eql ( 1 ) ;
81- var lines = warnings [ 0 ] . split ( "\n" ) ;
83+ const lines = warnings [ 0 ] . split ( "\n" ) ;
8284 lines [ 4 ] . should . match ( / F I L E \. j s / ) ;
8385 lines [ 5 ] . should . match ( / U s e d b y / ) ;
8486 lines [ 6 ] . should . match ( / c a s e - s e n s i t i v e / ) ;
@@ -92,15 +94,15 @@ describe("Errors", function() {
9294 done ( ) ;
9395 } ) ;
9496 } ) ;
95- it ( "should warn about NoErrorsPlugin being deprecated in favor of NoEmitOnErrorsPlugin" , function ( done ) {
97+ it ( "should warn about NoErrorsPlugin being deprecated in favor of NoEmitOnErrorsPlugin" , ( done ) => {
9698 getErrors ( {
9799 entry : "./no-errors-deprecate" ,
98100 plugins : [
99101 new webpack . NoErrorsPlugin ( )
100102 ]
101- } , function ( errors , warnings ) {
103+ } , ( errors , warnings ) => {
102104 warnings . length . should . be . eql ( 1 ) ;
103- var lines = warnings [ 0 ] . split ( "\n" ) ;
105+ const lines = warnings [ 0 ] . split ( "\n" ) ;
104106 lines [ 0 ] . should . match ( / w e b p a c k / ) ;
105107 lines [ 0 ] . should . match ( / N o E r r o r s P l u g i n / ) ;
106108 lines [ 0 ] . should . match ( / d e p r e c a t e d / ) ;
@@ -109,29 +111,29 @@ describe("Errors", function() {
109111 done ( ) ;
110112 } ) ;
111113 } ) ;
112- it ( "should not warn if the NoEmitOnErrorsPlugin is used over the NoErrorsPlugin" , function ( done ) {
114+ it ( "should not warn if the NoEmitOnErrorsPlugin is used over the NoErrorsPlugin" , ( done ) => {
113115 getErrors ( {
114116 entry : "./no-errors-deprecate" ,
115117 plugins : [
116118 new webpack . NoEmitOnErrorsPlugin ( )
117119 ]
118- } , function ( errors , warnings ) {
120+ } , ( errors , warnings ) => {
119121 errors . length . should . be . eql ( 0 ) ;
120122 warnings . length . should . be . eql ( 0 ) ;
121123 done ( ) ;
122124 } ) ;
123125 } ) ;
124- it ( "should not not emit if NoEmitOnErrorsPlugin is used and there is an error" , function ( done ) {
126+ it ( "should not not emit if NoEmitOnErrorsPlugin is used and there is an error" , ( done ) => {
125127 getErrors ( {
126128 entry : "./missingFile" ,
127129 plugins : [
128130 new webpack . NoEmitOnErrorsPlugin ( )
129131 ]
130- } , function ( errors , warnings ) {
132+ } , ( errors , warnings ) => {
131133 errors . length . should . be . eql ( 2 ) ;
132134 warnings . length . should . be . eql ( 0 ) ;
133135 errors . sort ( ) ;
134- var lines = errors [ 0 ] . split ( "\n" ) ;
136+ let lines = errors [ 0 ] . split ( "\n" ) ;
135137 lines [ 0 ] . should . match ( / m i s s i n g F i l e .j s / ) ;
136138 lines [ 1 ] . should . match ( / ^ M o d u l e n o t f o u n d / ) ;
137139 lines [ 1 ] . should . match ( / \. \/ d i r \/ m i s s i n g 2 / ) ;
@@ -144,7 +146,7 @@ describe("Errors", function() {
144146 done ( ) ;
145147 } ) ;
146148 } ) ;
147- it ( "should throw an error when using incorrect CommonsChunkPlugin configuration" , function ( done ) {
149+ it ( "should throw an error when using incorrect CommonsChunkPlugin configuration" , ( done ) => {
148150 getErrors ( {
149151 entry : {
150152 a : "./entry-point" ,
@@ -166,16 +168,16 @@ describe("Errors", function() {
166168 minChunks : Infinity
167169 } )
168170 ]
169- } , function ( errors , warnings ) {
171+ } , ( errors , warnings ) => {
170172 errors . length . should . be . eql ( 1 ) ;
171173 warnings . length . should . be . eql ( 0 ) ;
172- var lines = errors [ 0 ] . split ( "\n" ) ;
174+ const lines = errors [ 0 ] . split ( "\n" ) ;
173175 lines [ 0 ] . should . match ( / C o m m o n s C h u n k P l u g i n / ) ;
174176 lines [ 0 ] . should . match ( / n o n - e n t r y / ) ;
175177 done ( ) ;
176178 } ) ;
177179 } ) ;
178- it ( "should throw an error when trying to use [chunkhash] when it's invalid" , function ( done ) {
180+ it ( "should throw an error when trying to use [chunkhash] when it's invalid" , ( done ) => {
179181 getErrors ( {
180182 entry : {
181183 a : "./entry-point" ,
@@ -188,11 +190,11 @@ describe("Errors", function() {
188190 plugins : [
189191 new webpack . HotModuleReplacementPlugin ( )
190192 ]
191- } , function ( errors , warnings ) {
193+ } , ( errors , warnings ) => {
192194 errors . length . should . be . eql ( 3 ) ;
193195 warnings . length . should . be . eql ( 0 ) ;
194- errors . forEach ( function ( error ) {
195- var lines = error . split ( "\n" ) ;
196+ errors . forEach ( ( error ) => {
197+ const lines = error . split ( "\n" ) ;
196198 lines [ 0 ] . should . match ( / c h u n k ( a | b | c ) / ) ;
197199 lines [ 2 ] . should . match ( / \[ c h u n k h a s h \] .j s / ) ;
198200 lines [ 2 ] . should . match ( / u s e \[ h a s h \] i n s t e a d / ) ;
0 commit comments