Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove unreachable code #2289

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## Test-specific linter rules

rules:
## allow unreachable code
no-unreachable: 0
## allow undeclared variables
no-undef: 0
## allow global Buffer usage
Expand Down
2 changes: 0 additions & 2 deletions test/message/throw_custom_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ console.error('before');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other one.

// custom error throwing
throw ({ name: 'MyCustomError', message: 'This is a custom message' });

console.error('after');
2 changes: 0 additions & 2 deletions test/message/throw_non_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ console.error('before');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove console.error('before'); also, I guess.

// custom error throwing
throw ({ foo: 'bar' });

console.error('after');
1 change: 0 additions & 1 deletion test/parallel/test-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ expectCaught++;
// as a callback instead.
function fn(er) {
throw new Error('This function should never be called!');
process.exit(1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, we can simply remove fn itself and use assert.fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ? I have no idea how domain works so I wouldn't know how to modify the test, and it's not really related.


var bound = d.intercept(fn);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-file-write-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ file
})
.on('error', function(err) {
throw err;
console.error('error!', err.stack);
})
.on('drain', function() {
console.error('drain!', callbacks.drain);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http-content-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var server = http.createServer(function(req, res) {
break;
default:
throw new Error('Unreachable');
break;
}

receivedRequests++;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-listen-fd-detached-inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function test() {
// Then output the child's pid, and immediately exit.
function parent() {
var server = net.createServer(function(conn) {
throw new Error('Should not see connections on parent');
conn.end('HTTP/1.1 403 Forbidden\r\n\r\nI got problems.\r\n');
throw new Error('Should not see connections on parent');
}).listen(PORT, function() {
console.error('server listening on %d', PORT);

Expand Down