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>
pull/18629/merge
Jack Horton 2018-02-05 11:00:33 -08:00 committed by Ruben Bridgewater
parent 93bbe4e3ee
commit 1729af2ce9
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
2 changed files with 3 additions and 4 deletions

View File

@ -60,7 +60,7 @@ arrayTypes.forEach((currentType) => {
const template = Reflect.construct(currentType, buffer);
assert.throws(() => {
test_typedarray.CreateTypedArray(template, buffer, 0, 136);
}, /Invalid typed array length/);
}, RangeError);
});
const nonByteArrayTypes = [ Int16Array, Uint16Array, Int32Array, Uint32Array,
@ -71,5 +71,5 @@ nonByteArrayTypes.forEach((currentType) => {
test_typedarray.CreateTypedArray(template, buffer,
currentType.BYTES_PER_ELEMENT + 1, 1);
console.log(`start of offset ${currentType}`);
}, /start offset of/);
}, RangeError);
});

View File

@ -17,8 +17,7 @@ assert.strictEqual(global.console, 42);
common.expectsError(
() => console.log('foo'),
{
type: TypeError,
message: 'console.log is not a function'
type: TypeError
}
);