test: convert new tests to use error types
PR-URL: https://github.com/nodejs/node/pull/18581 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
93bbe4e3ee
commit
1729af2ce9
@ -60,7 +60,7 @@ arrayTypes.forEach((currentType) => {
|
|||||||
const template = Reflect.construct(currentType, buffer);
|
const template = Reflect.construct(currentType, buffer);
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
test_typedarray.CreateTypedArray(template, buffer, 0, 136);
|
test_typedarray.CreateTypedArray(template, buffer, 0, 136);
|
||||||
}, /Invalid typed array length/);
|
}, RangeError);
|
||||||
});
|
});
|
||||||
|
|
||||||
const nonByteArrayTypes = [ Int16Array, Uint16Array, Int32Array, Uint32Array,
|
const nonByteArrayTypes = [ Int16Array, Uint16Array, Int32Array, Uint32Array,
|
||||||
@ -71,5 +71,5 @@ nonByteArrayTypes.forEach((currentType) => {
|
|||||||
test_typedarray.CreateTypedArray(template, buffer,
|
test_typedarray.CreateTypedArray(template, buffer,
|
||||||
currentType.BYTES_PER_ELEMENT + 1, 1);
|
currentType.BYTES_PER_ELEMENT + 1, 1);
|
||||||
console.log(`start of offset ${currentType}`);
|
console.log(`start of offset ${currentType}`);
|
||||||
}, /start offset of/);
|
}, RangeError);
|
||||||
});
|
});
|
||||||
|
@ -17,8 +17,7 @@ assert.strictEqual(global.console, 42);
|
|||||||
common.expectsError(
|
common.expectsError(
|
||||||
() => console.log('foo'),
|
() => console.log('foo'),
|
||||||
{
|
{
|
||||||
type: TypeError,
|
type: TypeError
|
||||||
message: 'console.log is not a function'
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user