Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9986d9e

Browse filesBrowse files
yeonjuanbtmills
authored andcommitted
Chore: add object option test cases in yield-star-spacing (#12679)
1 parent 1713d07 commit 9986d9e
Copy full SHA for 9986d9e

File tree

Expand file treeCollapse file tree

1 file changed

+44
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+44
-0
lines changed
Open diff view settings
Collapse file

‎tests/lib/rules/yield-star-spacing.js‎

Copy file name to clipboardExpand all lines: tests/lib/rules/yield-star-spacing.js
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,24 @@ ruleTester.run("yield-star-spacing", rule, {
137137
{
138138
code: "function *foo(){ var result = yield*foo(); }",
139139
options: ["neither"]
140+
},
141+
142+
// object option
143+
{
144+
code: "function *foo(){ yield* foo; }",
145+
options: [{ before: false, after: true }]
146+
},
147+
{
148+
code: "function *foo(){ yield *foo; }",
149+
options: [{ before: true, after: false }]
150+
},
151+
{
152+
code: "function *foo(){ yield * foo; }",
153+
options: [{ before: true, after: true }]
154+
},
155+
{
156+
code: "function *foo(){ yield*foo; }",
157+
options: [{ before: false, after: false }]
140158
}
141159
],
142160

@@ -227,6 +245,32 @@ ruleTester.run("yield-star-spacing", rule, {
227245
output: "function *foo(){ yield*foo; }",
228246
options: ["neither"],
229247
errors: [unexpectedBeforeError, unexpectedAfterError]
248+
},
249+
250+
// object option
251+
{
252+
code: "function *foo(){ yield*foo; }",
253+
output: "function *foo(){ yield* foo; }",
254+
options: [{ before: false, after: true }],
255+
errors: [missingAfterError]
256+
},
257+
{
258+
code: "function *foo(){ yield * foo; }",
259+
output: "function *foo(){ yield *foo; }",
260+
options: [{ before: true, after: false }],
261+
errors: [unexpectedAfterError]
262+
},
263+
{
264+
code: "function *foo(){ yield*foo; }",
265+
output: "function *foo(){ yield * foo; }",
266+
options: [{ before: true, after: true }],
267+
errors: [missingBeforeError, missingAfterError]
268+
},
269+
{
270+
code: "function *foo(){ yield * foo; }",
271+
output: "function *foo(){ yield*foo; }",
272+
options: [{ before: false, after: false }],
273+
errors: [unexpectedBeforeError, unexpectedAfterError]
230274
}
231275
]
232276

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.