@@ -40,31 +40,31 @@ const formatter = proxyquire("../../../lib/formatters/codeframe", { chalk: chalk
40
40
// Tests
41
41
//------------------------------------------------------------------------------
42
42
43
- describe ( "formatter:codeframe" , function ( ) {
43
+ describe ( "formatter:codeframe" , ( ) => {
44
44
let sandbox ;
45
45
46
- beforeEach ( function ( ) {
46
+ beforeEach ( ( ) => {
47
47
sandbox = sinon . sandbox . create ( ) ;
48
48
} ) ;
49
49
50
- afterEach ( function ( ) {
50
+ afterEach ( ( ) => {
51
51
sandbox . verifyAndRestore ( ) ;
52
52
} ) ;
53
53
54
- describe ( "when passed no messages" , function ( ) {
54
+ describe ( "when passed no messages" , ( ) => {
55
55
const code = [ {
56
56
filePath : "foo.js" ,
57
57
messages : [ ]
58
58
} ] ;
59
59
60
- it ( "should return nothing" , function ( ) {
60
+ it ( "should return nothing" , ( ) => {
61
61
const result = formatter ( code ) ;
62
62
63
63
assert . equal ( result , "" ) ;
64
64
} ) ;
65
65
} ) ;
66
66
67
- describe ( "when passed a single message" , function ( ) {
67
+ describe ( "when passed a single message" , ( ) => {
68
68
const code = [ {
69
69
filePath : path . join ( process . cwd ( ) , "lib" , "foo.js" ) ,
70
70
source : "var foo = 1;\n var bar = 2;\n" ,
@@ -77,7 +77,7 @@ describe("formatter:codeframe", function() {
77
77
} ]
78
78
} ] ;
79
79
80
- it ( "should return a string in the correct format for errors" , function ( ) {
80
+ it ( "should return a string in the correct format for errors" , ( ) => {
81
81
const result = formatter ( code ) ;
82
82
83
83
assert . equal ( chalk . stripColor ( result ) , [
@@ -91,7 +91,7 @@ describe("formatter:codeframe", function() {
91
91
] . join ( "\n" ) ) ;
92
92
} ) ;
93
93
94
- it ( "should return a string in the correct format for warnings" , function ( ) {
94
+ it ( "should return a string in the correct format for warnings" , ( ) => {
95
95
code [ 0 ] . messages [ 0 ] . severity = 1 ;
96
96
97
97
const result = formatter ( code ) ;
@@ -107,7 +107,7 @@ describe("formatter:codeframe", function() {
107
107
] . join ( "\n" ) ) ;
108
108
} ) ;
109
109
110
- it ( "should return bold red summary when there are errors" , function ( ) {
110
+ it ( "should return bold red summary when there are errors" , ( ) => {
111
111
sandbox . spy ( chalkStub . yellow , "bold" ) ;
112
112
sandbox . spy ( chalkStub . red , "bold" ) ;
113
113
code [ 0 ] . messages [ 0 ] . severity = 2 ;
@@ -118,7 +118,7 @@ describe("formatter:codeframe", function() {
118
118
assert . equal ( chalkStub . red . bold . callCount , 1 ) ;
119
119
} ) ;
120
120
121
- it ( "should return bold yellow summary when there are only warnings" , function ( ) {
121
+ it ( "should return bold yellow summary when there are only warnings" , ( ) => {
122
122
sandbox . spy ( chalkStub . yellow , "bold" ) ;
123
123
sandbox . spy ( chalkStub . red , "bold" ) ;
124
124
code [ 0 ] . messages [ 0 ] . severity = 1 ;
@@ -130,7 +130,7 @@ describe("formatter:codeframe", function() {
130
130
} ) ;
131
131
} ) ;
132
132
133
- describe ( "when passed multiple messages" , function ( ) {
133
+ describe ( "when passed multiple messages" , ( ) => {
134
134
const code = [ {
135
135
filePath : "foo.js" ,
136
136
source : "const foo = 1\n" ,
@@ -149,7 +149,7 @@ describe("formatter:codeframe", function() {
149
149
} ] ,
150
150
} ] ;
151
151
152
- it ( "should return a string with multiple entries" , function ( ) {
152
+ it ( "should return a string with multiple entries" , ( ) => {
153
153
const result = formatter ( code ) ;
154
154
155
155
assert . equal ( chalk . stripColor ( result ) , [
@@ -167,7 +167,7 @@ describe("formatter:codeframe", function() {
167
167
] . join ( "\n" ) ) ;
168
168
} ) ;
169
169
170
- it ( "should return bold red summary when at least 1 of the messages is an error" , function ( ) {
170
+ it ( "should return bold red summary when at least 1 of the messages is an error" , ( ) => {
171
171
sandbox . spy ( chalkStub . yellow , "bold" ) ;
172
172
sandbox . spy ( chalkStub . red , "bold" ) ;
173
173
code [ 0 ] . messages [ 0 ] . severity = 1 ;
@@ -179,7 +179,7 @@ describe("formatter:codeframe", function() {
179
179
} ) ;
180
180
} ) ;
181
181
182
- describe ( "when passed one file with 1 message and fixes applied" , function ( ) {
182
+ describe ( "when passed one file with 1 message and fixes applied" , ( ) => {
183
183
const code = [ {
184
184
filePath : "foo.js" ,
185
185
messages : [ {
@@ -193,7 +193,7 @@ describe("formatter:codeframe", function() {
193
193
output : "function foo() {\n\n // a comment\n const foo = 1;\n}\n\n"
194
194
} ] ;
195
195
196
- it ( "should return a string with code preview pointing to the correct location after fixes" , function ( ) {
196
+ it ( "should return a string with code preview pointing to the correct location after fixes" , ( ) => {
197
197
const result = formatter ( code ) ;
198
198
199
199
assert . equal ( chalk . stripColor ( result ) , [
@@ -211,7 +211,7 @@ describe("formatter:codeframe", function() {
211
211
} ) ;
212
212
} ) ;
213
213
214
- describe ( "when passed multiple files with 1 message each" , function ( ) {
214
+ describe ( "when passed multiple files with 1 message each" , ( ) => {
215
215
const code = [ {
216
216
filePath : "foo.js" ,
217
217
source : "const foo = 1\n" ,
@@ -234,7 +234,7 @@ describe("formatter:codeframe", function() {
234
234
} ]
235
235
} ] ;
236
236
237
- it ( "should return a string with multiple entries" , function ( ) {
237
+ it ( "should return a string with multiple entries" , ( ) => {
238
238
const result = formatter ( code ) ;
239
239
240
240
assert . equal ( chalk . stripColor ( result ) , [
@@ -253,7 +253,7 @@ describe("formatter:codeframe", function() {
253
253
} ) ;
254
254
} ) ;
255
255
256
- describe ( "when passed a fatal error message" , function ( ) {
256
+ describe ( "when passed a fatal error message" , ( ) => {
257
257
const code = [ {
258
258
filePath : "foo.js" ,
259
259
source : "e{}\n" ,
@@ -268,7 +268,7 @@ describe("formatter:codeframe", function() {
268
268
} ]
269
269
} ] ;
270
270
271
- it ( "should return a string in the correct format" , function ( ) {
271
+ it ( "should return a string in the correct format" , ( ) => {
272
272
const result = formatter ( code ) ;
273
273
274
274
assert . equal ( chalk . stripColor ( result ) , [
@@ -282,7 +282,7 @@ describe("formatter:codeframe", function() {
282
282
} ) ;
283
283
} ) ;
284
284
285
- describe ( "when passed one file not found message" , function ( ) {
285
+ describe ( "when passed one file not found message" , ( ) => {
286
286
const code = [ {
287
287
filePath : "foo.js" ,
288
288
messages : [ {
@@ -291,14 +291,14 @@ describe("formatter:codeframe", function() {
291
291
} ]
292
292
} ] ;
293
293
294
- it ( "should return a string without code preview (codeframe)" , function ( ) {
294
+ it ( "should return a string without code preview (codeframe)" , ( ) => {
295
295
const result = formatter ( code ) ;
296
296
297
297
assert . equal ( chalk . stripColor ( result ) , "error: Couldn't find foo.js at foo.js\n\n\n1 error found." ) ;
298
298
} ) ;
299
299
} ) ;
300
300
301
- describe ( "when passed a single message with no line or column" , function ( ) {
301
+ describe ( "when passed a single message with no line or column" , ( ) => {
302
302
const code = [ {
303
303
filePath : "foo.js" ,
304
304
messages : [ {
@@ -309,13 +309,13 @@ describe("formatter:codeframe", function() {
309
309
} ]
310
310
} ] ;
311
311
312
- it ( "should return a string without code preview (codeframe)" , function ( ) {
312
+ it ( "should return a string without code preview (codeframe)" , ( ) => {
313
313
const result = formatter ( code ) ;
314
314
315
315
assert . equal ( chalk . stripColor ( result ) , "error: Unexpected foo (foo) at foo.js\n\n\n1 error found." ) ;
316
316
} ) ;
317
317
318
- it ( "should output filepath but without 'line:column' appended" , function ( ) {
318
+ it ( "should output filepath but without 'line:column' appended" , ( ) => {
319
319
const result = formatter ( code ) ;
320
320
321
321
assert . equal ( chalk . stripColor ( result ) , "error: Unexpected foo (foo) at foo.js\n\n\n1 error found." ) ;
0 commit comments