88// Requirements
99//------------------------------------------------------------------------------
1010
11- let assert ,
12- formatter ;
13-
14- assert = require ( "chai" ) . assert ;
15- formatter = require ( "../../../lib/formatters/table" ) ;
11+ const assert = require ( "chai" ) . assert ,
12+ formatter = require ( "../../../lib/formatters/table" ) ;
1613
1714//------------------------------------------------------------------------------
1815// Tests
1916//------------------------------------------------------------------------------
2017
2118describe ( "formatter:table" , function ( ) {
2219 describe ( "when passed no messages" , function ( ) {
23- let code ;
24-
25- code = [
20+ const code = [
2621 {
2722 filePath : "foo.js" ,
2823 messages : [ ] ,
@@ -32,34 +27,25 @@ describe("formatter:table", function() {
3227 ] ;
3328
3429 it ( "should return a table of error and warning count with no messages" , function ( ) {
35- let expectedOutput ,
36- result ;
37-
38- expectedOutput = [
30+ const expectedOutput = [
3931 "" ,
4032 "╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" ,
4133 "║ 0 Errors ║" ,
4234 "╟────────────────────────────────────────────────────────────────────────────────────────────────────────────────╢" ,
4335 "║ 0 Warnings ║" ,
4436 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
4537 ""
46- ] ;
47-
48- expectedOutput = expectedOutput . join ( "\n" ) ;
38+ ] . join ( "\n" ) ;
4939
50- result = formatter ( code ) ;
40+ const result = formatter ( code ) ;
5141
5242 assert . equal ( result , expectedOutput ) ;
5343 } ) ;
5444 } ) ;
5545
5646 describe ( "when passed a single message" , function ( ) {
5747 it ( "should return a string in the correct format for errors" , function ( ) {
58- let expectedOutput ,
59- code ,
60- result ;
61-
62- code = [
48+ const code = [
6349 {
6450 filePath : "foo.js" ,
6551 messages : [
@@ -76,7 +62,7 @@ describe("formatter:table", function() {
7662 }
7763 ] ;
7864
79- expectedOutput = [
65+ const expectedOutput = [
8066 "" ,
8167 "foo.js" ,
8268 "" ,
@@ -90,21 +76,15 @@ describe("formatter:table", function() {
9076 "║ 0 Warnings ║" ,
9177 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
9278 ""
93- ] ;
94-
95- expectedOutput = expectedOutput . join ( "\n" ) ;
79+ ] . join ( "\n" ) ;
9680
97- result = formatter ( code ) ;
81+ const result = formatter ( code ) ;
9882
9983 assert . equal ( result , expectedOutput ) ;
10084 } ) ;
10185
10286 it ( "should return a string in the correct format for warnings" , function ( ) {
103- let expectedOutput ,
104- code ,
105- result ;
106-
107- code = [
87+ const code = [
10888 {
10989 filePath : "foo.js" ,
11090 messages : [
@@ -121,7 +101,7 @@ describe("formatter:table", function() {
121101 }
122102 ] ;
123103
124- expectedOutput = [
104+ const expectedOutput = [
125105 "" ,
126106 "foo.js" ,
127107 "" ,
@@ -135,22 +115,17 @@ describe("formatter:table", function() {
135115 "║ 1 Warning ║" ,
136116 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
137117 ""
138- ] ;
118+ ] . join ( "\n" ) ;
139119
140- expectedOutput = expectedOutput . join ( "\n" ) ;
120+ const result = formatter ( code ) ;
141121
142- result = formatter ( code ) ;
143122 assert . equal ( result , expectedOutput ) ;
144123 } ) ;
145124 } ) ;
146125
147126 describe ( "when passed a fatal error message" , function ( ) {
148127 it ( "should return a string in the correct format" , function ( ) {
149- let code ,
150- expectedOutput ,
151- result ;
152-
153- code = [
128+ const code = [
154129 {
155130 filePath : "foo.js" ,
156131 messages : [
@@ -167,7 +142,7 @@ describe("formatter:table", function() {
167142 }
168143 ] ;
169144
170- expectedOutput = [
145+ const expectedOutput = [
171146 "" ,
172147 "foo.js" ,
173148 "" ,
@@ -181,23 +156,17 @@ describe("formatter:table", function() {
181156 "║ 0 Warnings ║" ,
182157 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
183158 ""
184- ] ;
185-
186- expectedOutput = expectedOutput . join ( "\n" ) ;
159+ ] . join ( "\n" ) ;
187160
188- result = formatter ( code ) ;
161+ const result = formatter ( code ) ;
189162
190163 assert . equal ( result , expectedOutput ) ;
191164 } ) ;
192165 } ) ;
193166
194167 describe ( "when passed multiple messages" , function ( ) {
195168 it ( "should return a string with multiple entries" , function ( ) {
196- let code ,
197- expectedOutput ,
198- result ;
199-
200- code = [
169+ const code = [
201170 {
202171 filePath : "foo.js" ,
203172 messages : [
@@ -221,7 +190,7 @@ describe("formatter:table", function() {
221190 }
222191 ] ;
223192
224- expectedOutput = [
193+ const expectedOutput = [
225194 "" ,
226195 "foo.js" ,
227196 "" ,
@@ -236,23 +205,17 @@ describe("formatter:table", function() {
236205 "║ 1 Warning ║" ,
237206 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
238207 ""
239- ] ;
240-
241- expectedOutput = expectedOutput . join ( "\n" ) ;
208+ ] . join ( "\n" ) ;
242209
243- result = formatter ( code ) ;
210+ const result = formatter ( code ) ;
244211
245212 assert . equal ( result , expectedOutput ) ;
246213 } ) ;
247214 } ) ;
248215
249216 describe ( "when passed multiple files with 1 message each" , function ( ) {
250217 it ( "should return a string with multiple entries" , function ( ) {
251- let code ,
252- expectedOutput ,
253- result ;
254-
255- code = [
218+ const code = [
256219 {
257220 filePath : "foo.js" ,
258221 messages : [
@@ -282,7 +245,7 @@ describe("formatter:table", function() {
282245 }
283246 ] ;
284247
285- expectedOutput = [
248+ const expectedOutput = [
286249 "" ,
287250 "foo.js" ,
288251 "" ,
@@ -302,23 +265,17 @@ describe("formatter:table", function() {
302265 "║ 1 Warning ║" ,
303266 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
304267 ""
305- ] ;
306-
307- expectedOutput = expectedOutput . join ( "\n" ) ;
268+ ] . join ( "\n" ) ;
308269
309- result = formatter ( code ) ;
270+ const result = formatter ( code ) ;
310271
311272 assert . equal ( result , expectedOutput ) ;
312273 } ) ;
313274 } ) ;
314275
315276 describe ( "when passed one file not found message" , function ( ) {
316277 it ( "should return a string without line and column (0, 0)" , function ( ) {
317- let code ,
318- expectedOutput ,
319- result ;
320-
321- code = [
278+ const code = [
322279 {
323280 filePath : "foo.js" ,
324281 messages : [
@@ -332,7 +289,7 @@ describe("formatter:table", function() {
332289 }
333290 ] ;
334291
335- expectedOutput = [
292+ const expectedOutput = [
336293 "" ,
337294 "foo.js" ,
338295 "" ,
@@ -346,11 +303,9 @@ describe("formatter:table", function() {
346303 "║ 0 Warnings ║" ,
347304 "╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" ,
348305 ""
349- ] ;
350-
351- expectedOutput = expectedOutput . join ( "\n" ) ;
306+ ] . join ( "\n" ) ;
352307
353- result = formatter ( code ) ;
308+ const result = formatter ( code ) ;
354309
355310 assert . equal ( result , expectedOutput ) ;
356311 } ) ;
0 commit comments