File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ const a = 'foobar' ;
Original file line number Diff line number Diff line change @@ -1033,5 +1033,33 @@ module.exports = {
10331033 done ( ) ;
10341034 } ) ;
10351035 } ) ;
1036+
1037+ it ( 'When enabled, eslint checks for linting errors' , ( done ) => {
1038+ const config = createWebpackConfig ( 'www/build' , 'dev' ) ;
1039+ config . setPublicPath ( '/build' ) ;
1040+ config . addEntry ( 'main' , './js/eslint' ) ;
1041+ config . enableEslintLoader ( {
1042+ // Force eslint-loader to output errors instead of sometimes
1043+ // using warnings (see: https://github.com/MoOx/eslint-loader#errors-and-warning)
1044+ emitError : true ,
1045+ rules : {
1046+ // That is not really needed since it'll use the
1047+ // .eslintrc.js file at the root of the project, but
1048+ // it'll avoid breaking this test if we change these
1049+ // rules later on.
1050+ 'indent' : [ 'error' , 2 ] ,
1051+ 'no-unused-vars' : [ 'error' , { 'args' : 'all' } ]
1052+ }
1053+ } ) ;
1054+
1055+ testSetup . runWebpack ( config , ( webpackAssert , stats ) => {
1056+ const eslintErrors = stats . toJson ( ) . errors [ 0 ] ;
1057+
1058+ expect ( eslintErrors ) . to . contain ( 'Expected indentation of 0 spaces but found 2' ) ;
1059+ expect ( eslintErrors ) . to . contain ( '\'a\' is assigned a value but never used' ) ;
1060+
1061+ done ( ) ;
1062+ } , true ) ;
1063+ } ) ;
10361064 } ) ;
10371065} ) ;
You can’t perform that action at this time.
0 commit comments