@@ -78,7 +78,7 @@ describe('rules setup is correct', function () {
78
78
) ;
79
79
} ) ;
80
80
81
- it ( 'should have the right contents (title, examples, notices) for each rule documentation file ', function ( ) {
81
+ describe ( ' rule documentation files ', function ( ) {
82
82
const CONFIG_MSG_RECOMMENDED =
83
83
':white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.' ;
84
84
const CONFIG_MSG_OCTANE =
@@ -92,42 +92,47 @@ describe('rules setup is correct', function () {
92
92
const path = join ( __dirname , '..' , 'docs' , 'rules' , `${ ruleName } .md` ) ;
93
93
const file = readFileSync ( path , 'utf8' ) ;
94
94
95
- expect ( file ) . toContain ( `# ${ ruleName } ` ) ; // Title header.
96
- expect ( file ) . toContain ( '## Examples' ) ; // Examples section header.
97
-
98
- // Check if the rule has configuration options.
99
- if (
100
- ( Array . isArray ( rule . meta . schema ) && rule . meta . schema . length > 0 ) ||
101
- ( typeof rule . meta . schema === 'object' && Object . keys ( rule . meta . schema ) . length > 0 )
102
- ) {
103
- // Should have a configuration section header:
104
- expect ( file ) . toContain ( '## Configuration' ) ;
105
-
106
- // Ensure all configuration options are mentioned.
107
- getAllNamedOptions ( rule . meta . schema ) . forEach ( ( namedOption ) =>
108
- expect ( file ) . toContain ( namedOption )
109
- ) ;
110
- } else {
111
- expect ( file ) . not . toContain ( '## Configuration' ) ;
112
- }
113
-
114
- if ( rule . meta . fixable === 'code' ) {
115
- expect ( file ) . toContain ( FIXABLE_MSG ) ;
116
- } else {
117
- expect ( file ) . not . toContain ( FIXABLE_MSG ) ;
118
- }
119
-
120
- if ( rule . meta . docs . recommended ) {
121
- expect ( file ) . toContain ( CONFIG_MSG_RECOMMENDED ) ;
122
- } else {
123
- expect ( file ) . not . toContain ( CONFIG_MSG_RECOMMENDED ) ;
124
- }
125
-
126
- if ( rule . meta . docs . octane ) {
127
- expect ( file ) . toContain ( CONFIG_MSG_OCTANE ) ;
128
- } else {
129
- expect ( file ) . not . toContain ( CONFIG_MSG_OCTANE ) ;
130
- }
95
+ // eslint-disable-next-line jest/valid-title
96
+ describe ( ruleName , function ( ) {
97
+ it ( 'should have the right contents (title, examples, notices)' , function ( ) {
98
+ expect ( file ) . toContain ( `# ${ ruleName } ` ) ; // Title header.
99
+ expect ( file ) . toContain ( '## Examples' ) ; // Examples section header.
100
+
101
+ // Check if the rule has configuration options.
102
+ if (
103
+ ( Array . isArray ( rule . meta . schema ) && rule . meta . schema . length > 0 ) ||
104
+ ( typeof rule . meta . schema === 'object' && Object . keys ( rule . meta . schema ) . length > 0 )
105
+ ) {
106
+ // Should have a configuration section header:
107
+ expect ( file ) . toContain ( '## Configuration' ) ;
108
+
109
+ // Ensure all configuration options are mentioned.
110
+ getAllNamedOptions ( rule . meta . schema ) . forEach ( ( namedOption ) =>
111
+ expect ( file ) . toContain ( namedOption )
112
+ ) ;
113
+ } else {
114
+ expect ( file ) . not . toContain ( '## Configuration' ) ;
115
+ }
116
+
117
+ if ( rule . meta . fixable === 'code' ) {
118
+ expect ( file ) . toContain ( FIXABLE_MSG ) ;
119
+ } else {
120
+ expect ( file ) . not . toContain ( FIXABLE_MSG ) ;
121
+ }
122
+
123
+ if ( rule . meta . docs . recommended ) {
124
+ expect ( file ) . toContain ( CONFIG_MSG_RECOMMENDED ) ;
125
+ } else {
126
+ expect ( file ) . not . toContain ( CONFIG_MSG_RECOMMENDED ) ;
127
+ }
128
+
129
+ if ( rule . meta . docs . octane ) {
130
+ expect ( file ) . toContain ( CONFIG_MSG_OCTANE ) ;
131
+ } else {
132
+ expect ( file ) . not . toContain ( CONFIG_MSG_OCTANE ) ;
133
+ }
134
+ } ) ;
135
+ } ) ;
131
136
} ) ;
132
137
} ) ;
133
138
0 commit comments