Debian Codegraph @

tests/lib/rules/no-for-of-loops.js

raw symbols SCIP
1 /**
2 * @author Toru Nagashima <https://github.com/mysticatea>
3 * See LICENSE file in root directory for full license.
4 */
5 "use strict"
6
7 const RuleTester = require("../../tester")
8 const rule = require("../../../lib/rules/no-for-of-loops.js")
9
10 new RuleTester().run("no-for-of-loops", rule, {
11 valid: [
12 "for(;;);",
13 "for(a in b);",
14 "for(var a in b);",
15 "for(let a in b);",
16 "for(const a in b);",
17 ],
18 invalid: [
19 {
20 code: "for(a of b);",
21 errors: ["ES2015 'for-of' statements are forbidden."],
22 },
23 {
24 code: "for(var a of b);",
25 errors: ["ES2015 'for-of' statements are forbidden."],
26 },
27 {
28 code: "for(let a of b);",
29 errors: ["ES2015 'for-of' statements are forbidden."],
30 },
31 {
32 code: "for(const a of b);",
33 errors: ["ES2015 'for-of' statements are forbidden."],
34 },
35 {
36 code: "async function f() { for await (const a of b); }",
37 errors: ["ES2015 'for-of' statements are forbidden."],
38 },
39 ],
40 })