Use one declaration per statement

The old style of merging all of a function's variable declarations into
a single statement made some sense back in the days of var, but there's
no reason to keep doing it now that we use const and let.
This commit is contained in:
Steve Gravrock
2026-03-10 20:02:42 -07:00
parent 03ebebf6fb
commit 434575f49d
88 changed files with 3650 additions and 3604 deletions

View File

@@ -10,10 +10,10 @@ describe('toThrowMatching', function() {
});
it('throws an error when the expected is not a function', function() {
const matcher = privateUnderTest.matchers.toThrowMatching(),
fn = function() {
throw new Error('foo');
};
const matcher = privateUnderTest.matchers.toThrowMatching();
const fn = function() {
throw new Error('foo');
};
expect(function() {
matcher.compare(fn, 1);
@@ -21,10 +21,10 @@ describe('toThrowMatching', function() {
});
it('fails if actual does not throw at all', function() {
const matcher = privateUnderTest.matchers.toThrowMatching(),
fn = function() {
return true;
};
const matcher = privateUnderTest.matchers.toThrowMatching();
const fn = function() {
return true;
};
const result = matcher.compare(fn, function() {
return true;
@@ -36,11 +36,11 @@ describe('toThrowMatching', function() {
it('fails with the correct message if thrown is a falsy value', function() {
const matcher = privateUnderTest.matchers.toThrowMatching({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw undefined;
};
pp: privateUnderTest.makePrettyPrinter()
});
const fn = function() {
throw undefined;
};
const result = matcher.compare(fn, function() {
return false;
@@ -52,13 +52,13 @@ describe('toThrowMatching', function() {
});
it('passes if the argument is a function that returns true when called with the error', function() {
const matcher = privateUnderTest.matchers.toThrowMatching(),
predicate = function(e) {
return e.message === 'nope';
},
fn = function() {
throw new TypeError('nope');
};
const matcher = privateUnderTest.matchers.toThrowMatching();
const predicate = function(e) {
return e.message === 'nope';
};
const fn = function() {
throw new TypeError('nope');
};
const result = matcher.compare(fn, predicate);
@@ -70,14 +70,14 @@ describe('toThrowMatching', function() {
it('fails if the argument is a function that returns false when called with the error', function() {
const matcher = privateUnderTest.matchers.toThrowMatching({
pp: privateUnderTest.makePrettyPrinter()
}),
predicate = function(e) {
return e.message === 'oh no';
},
fn = function() {
throw new TypeError('nope');
};
pp: privateUnderTest.makePrettyPrinter()
});
const predicate = function(e) {
return e.message === 'oh no';
};
const fn = function() {
throw new TypeError('nope');
};
const result = matcher.compare(fn, predicate);