Skip to content

Commit

Permalink
Core: Throw TypeError instead of Error for invalid test.each() dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Sep 5, 2024
1 parent ec7d6e7 commit 0231379
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Test (settings) {
// - 2: QUnit.test
// - 3: user file
//
// This needs is customised by test.each()
// A notable exception is test.each(), which overrides this.
this.stackOffset = 3;
extend(this, settings);

Expand Down Expand Up @@ -939,7 +939,7 @@ function runEach (data, eachFn) {
eachFn(data[key], key);
}
} else {
throw new Error(
throw new TypeError(
`test.each() expects an array or object as input, but
found ${typeof data} instead.`
);
Expand Down
2 changes: 1 addition & 1 deletion test/main/each.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ QUnit.module('test.each', function () {
QUnit.test.each('test.each fails with non-array input', ['something', 1, undefined, null], function (assert, value) {
assert.throws(function () {
QUnit.test.each('test.each 1D', value, function () { });
});
}, TypeError);
});

// Promise support for test.each() is tested in test/main/promise.js.
Expand Down

0 comments on commit 0231379

Please sign in to comment.