11'use strict' ;
22
33var assign = require ( 'object-assign' ) ;
4+ var td = require ( 'testdouble' ) ;
45var StyleLintPlugin = require ( '../' ) ;
56var pack = require ( './helpers/pack' ) ;
67var webpack = require ( './helpers/webpack' ) ;
@@ -82,26 +83,6 @@ describe('stylelint-webpack-plugin', function () {
8283 } ) ;
8384 } ) ;
8485
85- // TODO use snapshots to ensure something is printed to the console
86- it . skip ( 'sends messages to console when quiet prop set to false' , function ( ) {
87- var config = {
88- context : './test/fixtures/syntax-error' ,
89- entry : './index' ,
90- plugins : [
91- new StyleLintPlugin ( {
92- configFile : configFilePath ,
93- quiet : true
94- } )
95- ]
96- } ;
97-
98- return pack ( assign ( { } , baseConfig , config ) )
99- . then ( function ( stats ) {
100- expect ( stats . compilation . errors ) . to . have . length ( 1 ) ;
101- expect ( stats . compilation . warnings ) . to . have . length ( 0 ) ;
102- } ) ;
103- } ) ;
104-
10586 it ( 'fails when .stylelintrc is not a proper format' , function ( ) {
10687 var config = {
10788 entry : './index' ,
@@ -121,6 +102,35 @@ describe('stylelint-webpack-plugin', function () {
121102 } ) ;
122103 } ) ;
123104
105+ context ( 'iff quiet is strictly false' , function ( ) {
106+ beforeEach ( function ( ) {
107+ td . replace ( console , 'warn' , td . function ( ) ) ;
108+ } ) ;
109+
110+ afterEach ( function ( ) {
111+ td . reset ( ) ;
112+ } ) ;
113+
114+ it ( 'sends messages to the console' , function ( ) {
115+ var config = {
116+ context : './test/fixtures/syntax-error' ,
117+ entry : './index' ,
118+ plugins : [
119+ new StyleLintPlugin ( {
120+ configFile : configFilePath ,
121+ quiet : false
122+ } )
123+ ]
124+ } ;
125+
126+ return pack ( assign ( { } , baseConfig , config ) )
127+ . then ( function ( stats ) {
128+ expect ( stats . compilation . errors ) . to . have . length ( 1 ) ;
129+ td . verify ( console . warn ( td . matchers . contains ( '✖' ) ) ) ;
130+ } ) ;
131+ } ) ;
132+ } ) ;
133+
124134 context ( 'without StyleLintPlugin configuration' , function ( ) {
125135 var config = {
126136 context : './test/fixtures/lint-free' ,
0 commit comments