You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
672 B

'use strict';
require('../common');
// This tests that AsyncResource throws an error if bad parameters are passed
const assert = require('assert');
const AsyncResource = require('async_hooks').AsyncResource;
assert.throws(() => {
return new AsyncResource();
}, /^TypeError: type must be a string with length > 0$/);
assert.throws(() => {
new AsyncResource('');
}, /^TypeError: type must be a string with length > 0$/);
assert.throws(() => {
new AsyncResource('type', -4);
}, /^RangeError: triggerAsyncId must be an unsigned integer$/);
assert.throws(() => {
new AsyncResource('type', Math.PI);
}, /^RangeError: triggerAsyncId must be an unsigned integer$/);