summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-04-17 23:41:59 -0700
committerJames M Snell <jasnell@gmail.com>2016-04-20 08:38:41 -0700
commit4faaed69fa372f9a5daf11ef127c3ad2c8c9e93c (patch)
tree42a8eba7222c65f99beb89a56d93a20a48e97fe6 /test
parent8ede3d500254d887e08383f38f1b8732a508819f (diff)
downloadandroid-node-v8-4faaed69fa372f9a5daf11ef127c3ad2c8c9e93c.tar.gz
android-node-v8-4faaed69fa372f9a5daf11ef127c3ad2c8c9e93c.tar.bz2
android-node-v8-4faaed69fa372f9a5daf11ef127c3ad2c8c9e93c.zip
test,tools: enable linting for undefined vars
The test directory had linting for undefined variables disabled. It is enabled everywhere else in the code base. Let's disable the fule for individual lines in the handful of tests that use undefined variables. PR-URL: https://github.com/nodejs/node/pull/6255 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'test')
-rw-r--r--test/.eslintrc2
-rw-r--r--test/message/nexttick_throw.js1
-rw-r--r--test/message/timeout_throw.js1
-rw-r--r--test/parallel/test-domain-exit-dispose-again.js2
-rw-r--r--test/parallel/test-domain-exit-dispose.js2
-rw-r--r--test/parallel/test-exception-handler2.js18
-rw-r--r--test/parallel/test-global.js6
-rw-r--r--test/parallel/test-http-exceptions.js2
-rw-r--r--test/parallel/test-listen-fd-cluster.js1
-rw-r--r--test/parallel/test-next-tick-errors.js2
-rw-r--r--test/parallel/test-regress-GH-2245.js4
-rw-r--r--test/parallel/test-timers-reset-process-domain-on-throw.js2
-rw-r--r--test/parallel/test-util-inspect.js2
13 files changed, 19 insertions, 26 deletions
diff --git a/test/.eslintrc b/test/.eslintrc
index 68b358740f..172c0bfb9d 100644
--- a/test/.eslintrc
+++ b/test/.eslintrc
@@ -1,8 +1,6 @@
## Test-specific linter rules
rules:
- ## allow undeclared variables
- no-undef: 0
## common module is mandatory in tests
required-modules: [2, "common"]
diff --git a/test/message/nexttick_throw.js b/test/message/nexttick_throw.js
index 22f61a36f9..49cd6dd0f7 100644
--- a/test/message/nexttick_throw.js
+++ b/test/message/nexttick_throw.js
@@ -5,6 +5,7 @@ process.nextTick(function() {
process.nextTick(function() {
process.nextTick(function() {
process.nextTick(function() {
+ // eslint-disable-next-line
undefined_reference_error_maker;
});
});
diff --git a/test/message/timeout_throw.js b/test/message/timeout_throw.js
index 5c345ac8c0..14291fabd1 100644
--- a/test/message/timeout_throw.js
+++ b/test/message/timeout_throw.js
@@ -2,5 +2,6 @@
require('../common');
setTimeout(function() {
+ // eslint-disable-next-line no-undef
undefined_reference_error_maker;
});
diff --git a/test/parallel/test-domain-exit-dispose-again.js b/test/parallel/test-domain-exit-dispose-again.js
index e5b1affc0a..7360e79412 100644
--- a/test/parallel/test-domain-exit-dispose-again.js
+++ b/test/parallel/test-domain-exit-dispose-again.js
@@ -56,7 +56,7 @@ setTimeout(function firstTimer() {
// Make V8 throw an unreferenced error. As a result, the domain's error
// handler is called, which disposes the domain "d" and should prevent the
// nested timer that is attached to it from running.
- err3();
+ err3(); // eslint-disable-line no-undef
});
}, TIMEOUT_DURATION);
diff --git a/test/parallel/test-domain-exit-dispose.js b/test/parallel/test-domain-exit-dispose.js
index 2bddb01cbd..94b3dbd4ca 100644
--- a/test/parallel/test-domain-exit-dispose.js
+++ b/test/parallel/test-domain-exit-dispose.js
@@ -29,7 +29,7 @@ function err() {
});
// this function doesn't exist, and throws an error as a result.
- err3();
+ err3(); // eslint-disable-line no-undef
}
function handle(e) {
diff --git a/test/parallel/test-exception-handler2.js b/test/parallel/test-exception-handler2.js
index 3ed2c95204..1dabedf4c6 100644
--- a/test/parallel/test-exception-handler2.js
+++ b/test/parallel/test-exception-handler2.js
@@ -1,22 +1,14 @@
'use strict';
-require('../common');
-var assert = require('assert');
+const common = require('../common');
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
});
-var timeoutFired = false;
-setTimeout(function() {
+setTimeout(common.mustCall(function() {
console.log('This will still run.');
- timeoutFired = true;
-}, 500);
-
-process.on('exit', function() {
- assert.ok(timeoutFired);
-});
+}), 50);
// Intentionally cause an exception, but don't catch it.
-nonexistentFunc();
-console.log('This will not run.');
-
+nonexistentFunc(); // eslint-disable-line no-undef
+common.fail('This will not run.');
diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js
index 4eeecf36e0..c8135ed89f 100644
--- a/test/parallel/test-global.js
+++ b/test/parallel/test-global.js
@@ -4,12 +4,14 @@ var assert = require('assert');
common.globalCheck = false;
-baseFoo = 'foo';
+baseFoo = 'foo'; // eslint-disable-line no-undef
global.baseBar = 'bar';
assert.equal('foo', global.baseFoo, 'x -> global.x in base level not working');
-assert.equal('bar', baseBar, 'global.x -> x in base level not working');
+assert.equal('bar',
+ baseBar, // eslint-disable-line no-undef
+ 'global.x -> x in base level not working');
var module = require('../fixtures/global/plain');
const fooBar = module.fooBar;
diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js
index 922dc20957..b01d31e030 100644
--- a/test/parallel/test-http-exceptions.js
+++ b/test/parallel/test-http-exceptions.js
@@ -3,7 +3,7 @@ var common = require('../common');
var http = require('http');
var server = http.createServer(function(req, res) {
- intentionally_not_defined();
+ intentionally_not_defined(); // eslint-disable-line no-undef
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Thank you, come again.');
res.end();
diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js
index c321f699d7..419efc7c09 100644
--- a/test/parallel/test-listen-fd-cluster.js
+++ b/test/parallel/test-listen-fd-cluster.js
@@ -21,7 +21,6 @@ if (common.isWindows) {
switch (process.argv[2]) {
case 'master': return master();
case 'worker': return worker();
- case 'parent': return parent();
}
var ok;
diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js
index 074bdc0f9f..1fe7826938 100644
--- a/test/parallel/test-next-tick-errors.js
+++ b/test/parallel/test-next-tick-errors.js
@@ -10,7 +10,7 @@ let exceptionHandled = false;
process.nextTick(function() {
order.push('A');
// cause an error
- what();
+ what(); // eslint-disable-line no-undef
});
// This nextTick function should remain in the queue when the first one
diff --git a/test/parallel/test-regress-GH-2245.js b/test/parallel/test-regress-GH-2245.js
index a7f54caa5f..1ee26983ae 100644
--- a/test/parallel/test-regress-GH-2245.js
+++ b/test/parallel/test-regress-GH-2245.js
@@ -3,7 +3,7 @@ require('../common');
var assert = require('assert');
/*
-in node 0.10 a bug existed that caused strict functions to not capture
+In Node.js 0.10, a bug existed that caused strict functions to not capture
their environment when evaluated. When run in 0.10 `test()` fails with a
`ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details.
*/
@@ -21,7 +21,7 @@ function test() {
eval(code);
- return bar();
+ return bar(); // eslint-disable-line no-undef
}
diff --git a/test/parallel/test-timers-reset-process-domain-on-throw.js b/test/parallel/test-timers-reset-process-domain-on-throw.js
index f72530b542..ab3ffd3596 100644
--- a/test/parallel/test-timers-reset-process-domain-on-throw.js
+++ b/test/parallel/test-timers-reset-process-domain-on-throw.js
@@ -22,7 +22,7 @@ function err() {
function err2() {
// this function doesn't exist, and throws an error as a result.
- err3();
+ err3(); // eslint-disable-line no-undef
}
function handleDomainError(e) {
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index 115695db6a..9e713cf16c 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -301,7 +301,7 @@ errors.forEach(function(err) {
assert.equal(util.inspect(err), err.stack);
});
try {
- undef();
+ undef(); // eslint-disable-line no-undef
} catch (e) {
assert.equal(util.inspect(e), e.stack);
}