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: replaced anonymous closure functions to arrow functions #24417

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
16 changes: 8 additions & 8 deletions test/parallel/test-error-reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const fixtures = require('../common/fixtures');

function errExec(script, callback) {
const cmd = `"${process.argv[0]}" "${fixtures.path(script)}"`;
return exec(cmd, function(err, stdout, stderr) {
return exec(cmd, (err, stdout, stderr) => {
// There was some error
assert.ok(err);

Expand All @@ -43,39 +43,39 @@ const syntaxErrorMessage = /\bSyntaxError\b/;


// Simple throw error
errExec('throws_error.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error.js', common.mustCall((err, stdout, stderr) => {
assert.ok(/blah/.test(stderr));
}));


// Trying to JSON.parse(undefined)
errExec('throws_error2.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error2.js', common.mustCall((err, stdout, stderr) => {
assert.ok(syntaxErrorMessage.test(stderr));
}));


// Trying to JSON.parse(undefined) in nextTick
errExec('throws_error3.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error3.js', common.mustCall((err, stdout, stderr) => {
assert.ok(syntaxErrorMessage.test(stderr));
}));


// throw ILLEGAL error
errExec('throws_error4.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error4.js', common.mustCall((err, stdout, stderr) => {
assert.ok(syntaxErrorMessage.test(stderr));
}));

// Specific long exception line doesn't result in stack overflow
errExec('throws_error5.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error5.js', common.mustCall((err, stdout, stderr) => {
assert.ok(syntaxErrorMessage.test(stderr));
}));

// Long exception line with length > errorBuffer doesn't result in assertion
errExec('throws_error6.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error6.js', common.mustCall((err, stdout, stderr) => {
assert.ok(syntaxErrorMessage.test(stderr));
}));

// Object that throws in toString() doesn't print garbage
errExec('throws_error7.js', common.mustCall(function(err, stdout, stderr) {
errExec('throws_error7.js', common.mustCall((err, stdout, stderr) => {
assert.ok(/<toString\(\) threw exception/.test(stderr));
}));