@@ -63,6 +63,18 @@ runRuleTester('valid-title', rule, {
63
63
] ,
64
64
options : [ { disallowedWords : [ 'properly' ] } ] ,
65
65
} ,
66
+ {
67
+ code : 'test.step(`that the value is set properly`, function () {})' ,
68
+ errors : [
69
+ {
70
+ column : 11 ,
71
+ data : { word : 'properly' } ,
72
+ line : 1 ,
73
+ messageId : 'disallowedWord' ,
74
+ } ,
75
+ ] ,
76
+ options : [ { disallowedWords : [ 'properly' ] } ] ,
77
+ } ,
66
78
// Global aliases
67
79
{
68
80
code : 'it("the correct way to properly handle all things", () => {});' ,
@@ -142,7 +154,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
142
154
} ) ;
143
155
144
156
test . describe ( 'e2e tests #e4e' , ( ) => {
145
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
157
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
158
+ test . step ( '#wow' , ( ) => { } ) ;
159
+ } ) ;
146
160
} ) ;
147
161
} ) ;
148
162
` ,
@@ -165,6 +179,15 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
165
179
line : 9 ,
166
180
messageId : 'mustNotMatch' ,
167
181
} ,
182
+ {
183
+ column : 17 ,
184
+ data : {
185
+ functionName : 'step' ,
186
+ pattern : / (?: # (? ! u n i t | e 2 e ) ) \w + / u,
187
+ } ,
188
+ line : 10 ,
189
+ messageId : 'mustNotMatch' ,
190
+ } ,
168
191
] ,
169
192
options : [
170
193
{
@@ -183,7 +206,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
183
206
} ) ;
184
207
185
208
test . describe ( 'e2e tests #e4e' , ( ) => {
186
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
209
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
210
+ test . step ( '#wow' , ( ) => { } ) ;
211
+ } ) ;
187
212
} ) ;
188
213
} ) ;
189
214
` ,
@@ -208,6 +233,15 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
208
233
line : 9 ,
209
234
messageId : 'mustNotMatchCustom' ,
210
235
} ,
236
+ {
237
+ column : 17 ,
238
+ data : {
239
+ message : 'Please include "#unit" or "#e2e" in titles' ,
240
+ pattern : / (?: # (? ! u n i t | e 2 e ) ) \w + / u,
241
+ } ,
242
+ line : 10 ,
243
+ messageId : 'mustNotMatchCustom' ,
244
+ } ,
211
245
] ,
212
246
options : [
213
247
{
@@ -232,7 +266,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
232
266
} ) ;
233
267
234
268
test . describe ( 'e2e tests #e4e' , ( ) => {
235
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
269
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
270
+ test . step ( '#wow' , ( ) => { } ) ;
271
+ } ) ;
236
272
} ) ;
237
273
} ) ;
238
274
` ,
@@ -264,7 +300,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
264
300
} ) ;
265
301
266
302
test . describe ( 'e2e tests #e4e' , ( ) => {
267
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
303
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
304
+ test . step ( '#wow' , ( ) => { } ) ;
305
+ } ) ;
268
306
} ) ;
269
307
} ) ;
270
308
` ,
@@ -302,7 +340,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
302
340
} ) ;
303
341
304
342
test . describe ( 'e2e tests #e4e' , ( ) => {
305
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
343
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
344
+ test . step ( '#wow' , ( ) => { } ) ;
345
+ } ) ;
306
346
} ) ;
307
347
} ) ;
308
348
` ,
@@ -334,7 +374,9 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
334
374
} ) ;
335
375
336
376
test . describe ( 'e2e tests #e4e' , ( ) => {
337
- test ( 'is another test #e2e #playwright4life' , ( ) => { } ) ;
377
+ test ( 'is another test #e2e #playwright4life' , ( ) => {
378
+ test . step ( '#wow' , ( ) => { } ) ;
379
+ } ) ;
338
380
} ) ;
339
381
} ) ;
340
382
` ,
@@ -409,6 +451,21 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
409
451
{ mustMatch : { describe : / # (?: u n i t | i n t e g r a t i o n | e 2 e ) / u. source } } ,
410
452
] ,
411
453
} ,
454
+ {
455
+ code : 'test.step("the test", () => {});' ,
456
+ errors : [
457
+ {
458
+ column : 11 ,
459
+ data : {
460
+ functionName : 'step' ,
461
+ pattern : / # (?: u n i t | i n t e g r a t i o n | e 2 e ) / u,
462
+ } ,
463
+ line : 1 ,
464
+ messageId : 'mustMatch' ,
465
+ } ,
466
+ ] ,
467
+ options : [ { mustMatch : { step : / # (?: u n i t | i n t e g r a t i o n | e 2 e ) / u. source } } ] ,
468
+ } ,
412
469
{
413
470
code : 'test.describe.skip("the test", () => {});' ,
414
471
errors : [
@@ -503,6 +560,12 @@ runRuleTester('mustMatch & mustNotMatch options', rule, {
503
560
{ mustMatch : { describe : / # (?: u n i t | i n t e g r a t i o n | e 2 e ) / u. source } } ,
504
561
] ,
505
562
} ,
563
+ {
564
+ code : 'test.step("correctly sets the value", () => {});' ,
565
+ options : [
566
+ { mustMatch : { describe : / # (?: u n i t | i n t e g r a t i o n | e 2 e ) / u. source } } ,
567
+ ] ,
568
+ } ,
506
569
{
507
570
code : javascript `
508
571
test . describe ( 'things to test' , ( ) => {
@@ -657,6 +720,17 @@ runRuleTester('title-must-be-string', rule, {
657
720
} ,
658
721
] ,
659
722
} ,
723
+ {
724
+ code : 'test.step(123, () => {});' ,
725
+ errors : [
726
+ {
727
+ column : 11 ,
728
+ line : 1 ,
729
+ messageId : 'titleMustBeString' ,
730
+ } ,
731
+ ] ,
732
+ options : [ { ignoreTypeOfStepName : false } ] ,
733
+ } ,
660
734
// Global aliases
661
735
{
662
736
code : 'it(String(/.+/), () => {});' ,
@@ -685,6 +759,7 @@ runRuleTester('title-must-be-string', rule, {
685
759
'test.describe.skip("is a string", () => {});' ,
686
760
'test.describe.skip(`${myFunc} is a string`, () => {});' ,
687
761
'test.describe("is a string", () => {});' ,
762
+ 'test.step(123, () => {});' ,
688
763
{
689
764
code : 'test.describe(String(/.+/), () => {});' ,
690
765
options : [ { ignoreTypeOfDescribeName : true } ] ,
@@ -811,6 +886,17 @@ runRuleTester('no-empty-title', rule, {
811
886
} ,
812
887
] ,
813
888
} ,
889
+ {
890
+ code : 'test.step(``, function () {})' ,
891
+ errors : [
892
+ {
893
+ column : 1 ,
894
+ data : { functionName : 'step' } ,
895
+ line : 1 ,
896
+ messageId : 'emptyTitle' ,
897
+ } ,
898
+ ] ,
899
+ } ,
814
900
// Global aliases
815
901
{
816
902
code : 'it.describe("", function () {})' ,
@@ -840,6 +926,7 @@ runRuleTester('no-empty-title', rule, {
840
926
'test.skip(`foo`, function () {})' ,
841
927
'test(`${foo}`, function () {})' ,
842
928
'test.fixme(`${foo}`, function () {})' ,
929
+ 'test.step(`${foo}`, function () {})' ,
843
930
// Global aliases
844
931
{
845
932
code : 'test.describe()' ,
@@ -969,6 +1056,21 @@ runRuleTester('no-accidental-space', rule, {
969
1056
errors : [ { column : 6 , line : 1 , messageId : 'accidentalSpace' } ] ,
970
1057
output : 'test("foo", function () {})' ,
971
1058
} ,
1059
+ {
1060
+ code : 'test.step(` foo bar bang `, function () {})' ,
1061
+ errors : [ { column : 11 , line : 1 , messageId : 'accidentalSpace' } ] ,
1062
+ output : 'test.step(`foo bar bang`, function () {})' ,
1063
+ } ,
1064
+ {
1065
+ code : 'test.step(" foo", function () {})' ,
1066
+ errors : [ { column : 11 , line : 1 , messageId : 'accidentalSpace' } ] ,
1067
+ output : 'test.step("foo", function () {})' ,
1068
+ } ,
1069
+ {
1070
+ code : 'test.step(" foo ", function () {})' ,
1071
+ errors : [ { column : 11 , line : 1 , messageId : 'accidentalSpace' } ] ,
1072
+ output : 'test.step("foo", function () {})' ,
1073
+ } ,
972
1074
{
973
1075
code : javascript `
974
1076
test . describe ( ' foo' , ( ) => {
@@ -1013,6 +1115,8 @@ runRuleTester('no-accidental-space', rule, {
1013
1115
'test("foo", function () {})' ,
1014
1116
'test.describe()' ,
1015
1117
'test.describe("foo", function () {})' ,
1118
+ 'test.step()' ,
1119
+ 'test.step("foo", function () {})' ,
1016
1120
'test.only()' ,
1017
1121
'test.only("foo", function () {})' ,
1018
1122
javascript `
@@ -1135,6 +1239,37 @@ runRuleTester('no-duplicate-prefix test', rule, {
1135
1239
] ,
1136
1240
} )
1137
1241
1242
+ runRuleTester ( 'no-duplicate-prefix step' , rule , {
1243
+ invalid : [
1244
+ {
1245
+ code : 'test.step("step foo", function () {})' ,
1246
+ errors : [ { column : 11 , line : 1 , messageId : 'duplicatePrefix' } ] ,
1247
+ output : 'test.step("foo", function () {})' ,
1248
+ } ,
1249
+ {
1250
+ code : 'test.step("step foo", function () {})' ,
1251
+ errors : [ { column : 11 , line : 1 , messageId : 'duplicatePrefix' } ] ,
1252
+ output : 'test.step("foo", function () {})' ,
1253
+ } ,
1254
+ {
1255
+ code : 'test.step("step foo", function () {})' ,
1256
+ errors : [ { column : 11 , line : 1 , messageId : 'duplicatePrefix' } ] ,
1257
+ output : 'test.step("foo", function () {})' ,
1258
+ } ,
1259
+ {
1260
+ code : "test.step('step foo', function () {})" ,
1261
+ errors : [ { column : 11 , line : 1 , messageId : 'duplicatePrefix' } ] ,
1262
+ output : "test.step('foo', function () {})" ,
1263
+ } ,
1264
+ {
1265
+ code : 'test.step(`step foo`, function () {})' ,
1266
+ errors : [ { column : 11 , line : 1 , messageId : 'duplicatePrefix' } ] ,
1267
+ output : 'test.step(`foo`, function () {})' ,
1268
+ } ,
1269
+ ] ,
1270
+ valid : [ 'test.step("foo", function () {})' ] ,
1271
+ } )
1272
+
1138
1273
runRuleTester ( 'no-duplicate-prefix nested' , rule , {
1139
1274
invalid : [
1140
1275
{
@@ -1176,6 +1311,23 @@ runRuleTester('no-duplicate-prefix nested', rule, {
1176
1311
} )
1177
1312
` ,
1178
1313
} ,
1314
+ {
1315
+ code : javascript `
1316
+ test . describe ( 'foo' , ( ) => {
1317
+ test ( 'bar' , ( ) => {
1318
+ test . step ( 'step foobar' , ( ) => { } )
1319
+ } )
1320
+ } )
1321
+ ` ,
1322
+ errors : [ { column : 15 , line : 3 , messageId : 'duplicatePrefix' } ] ,
1323
+ output : javascript `
1324
+ test . describe ( 'foo' , ( ) => {
1325
+ test ( 'bar' , ( ) => {
1326
+ test . step ( 'foobar' , ( ) => { } )
1327
+ } )
1328
+ } )
1329
+ ` ,
1330
+ } ,
1179
1331
// Global aliases
1180
1332
{
1181
1333
code : javascript `
0 commit comments