forked from mysticatea/eslint-plugin-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no-process-exit.js
42 lines (39 loc) · 1.02 KB
/
no-process-exit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @author Nicholas C. Zakas
* See LICENSE file in root directory for full license.
*/
"use strict"
const RuleTester = require("eslint").RuleTester
const rule = require("../../../lib/rules/no-process-exit")
new RuleTester().run("no-process-exit", rule, {
valid: ["Process.exit()", "var exit = process.exit;", "f(process.exit)"],
invalid: [
{
code: "process.exit(0);",
errors: [
{
messageId: "noProcessExit",
type: "CallExpression",
},
],
},
{
code: "process.exit(1);",
errors: [
{
messageId: "noProcessExit",
type: "CallExpression",
},
],
},
{
code: "f(process.exit(1));",
errors: [
{
messageId: "noProcessExit",
type: "CallExpression",
},
],
},
],
})