From 307e83928ac91b6bae00437f2dc9e72b812ca22d Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 6 May 2016 01:27:16 +0900 Subject: [PATCH] Fix: tests for ESLint v1 --- docs/rules/process-exit-as-throw.md | 2 ++ lib/rules/process-exit-as-throw.js | 1 + tests/lib/rules/process-exit-as-throw.js | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/rules/process-exit-as-throw.md b/docs/rules/process-exit-as-throw.md index c765ed93..0d8cef2c 100644 --- a/docs/rules/process-exit-as-throw.md +++ b/docs/rules/process-exit-as-throw.md @@ -2,6 +2,8 @@ **Experimental:** This rule is an experimental thing. This may be changed without major bump in future. +**Note:** This rule is not working on ESLint v1 because v1 doesn't support code path analysis. + ## Rule Details ```js diff --git a/lib/rules/process-exit-as-throw.js b/lib/rules/process-exit-as-throw.js index 66078b1d..02ab6fe4 100644 --- a/lib/rules/process-exit-as-throw.js +++ b/lib/rules/process-exit-as-throw.js @@ -141,6 +141,7 @@ var visitor = CodePathAnalyzer == null ? {} : { module.exports = { meta: { + supported: CodePathAnalyzer != null, schema: [] }, create: function() { diff --git a/tests/lib/rules/process-exit-as-throw.js b/tests/lib/rules/process-exit-as-throw.js index 66319d35..edca8af8 100644 --- a/tests/lib/rules/process-exit-as-throw.js +++ b/tests/lib/rules/process-exit-as-throw.js @@ -19,13 +19,15 @@ var rule = require("../../../lib/rules/process-exit-as-throw"); // Tests //------------------------------------------------------------------------------ +var supported = rule.meta.supported; + describe("process-exit-as-throw", function() { beforeEach(function() { eslint.reset(); eslint.defineRule("process-exit-as-throw", rule); }); - it("should get unreachable error after 'process.exit()'.", function() { + (supported ? it : xit)("should get unreachable error after 'process.exit()'.", function() { var code = [ "foo();", "process.exit(1);", @@ -46,7 +48,7 @@ describe("process-exit-as-throw", function() { assert.equal(messages[0].line, 3); }); - it("should get no unreachable error after 'process.exit()' if this rule is turned off.", function() { + (supported ? it : xit)("should get no unreachable error after 'process.exit()' if this rule is turned off.", function() { var code = [ "foo();", "process.exit(1);", @@ -65,7 +67,7 @@ describe("process-exit-as-throw", function() { assert.equal(messages.length, 0); }); - it("should get no consistent-return error after 'process.exit()'.", function() { + (supported ? it : xit)("should get no consistent-return error after 'process.exit()'.", function() { var code = [ "function foo() {", " if (a) {",