Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge 3f78d3f as of 2018-02-28
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
chakrabot committed Mar 1, 2018
2 parents cea4e97 + 3f78d3f commit ed26d54
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ coverage-build: all
--single-branch git://github.com/gcovr/gcovr.git; fi
if [ ! -d build ]; then git clone --depth=1 \
--single-branch https://github.com/nodejs/build.git; fi
if [ ! -f gcovr/scripts/gcovr.orig ]; then \
(cd gcovr && patch -N -p1 < \
if [ ! -f gcovr/gcovr/gcov.py.orig ]; then \
(cd gcovr && patch -b -N -p1 < \
"$(CURDIR)/build/jenkins/scripts/coverage/gcovr-patches.diff"); fi
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
mv lib lib_
Expand All @@ -203,7 +203,7 @@ coverage-test: coverage-build
(cd lib && .$(NODE) ../node_modules/.bin/nyc report \
--temp-directory "$(CURDIR)/.cov_tmp" \
--report-dir "../coverage")
-(cd out && "../gcovr/scripts/gcovr" --gcov-exclude='.*deps' \
-(cd out && PYTHONPATH=$(CURDIR)/gcovr $(PYTHON) -m gcovr --gcov-exclude='.*deps' \
--gcov-exclude='.*usr' -v -r Release/obj.target \
--html --html-detail -o ../coverage/cxxcoverage.html \
--gcov-executable="$(GCOV)")
Expand Down
10 changes: 5 additions & 5 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ const {
class AsyncHook {
constructor({ init, before, after, destroy, promiseResolve }) {
if (init !== undefined && typeof init !== 'function')
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'init');
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.init');
if (before !== undefined && typeof before !== 'function')
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.before');
if (after !== undefined && typeof after !== 'function')
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.after');
if (destroy !== undefined && typeof destroy !== 'function')
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.destroy');
if (promiseResolve !== undefined && typeof promiseResolve !== 'function')
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'promiseResolve');
throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.promiseResolve');

this[init_symbol] = init;
this[before_symbol] = before;
Expand Down
23 changes: 23 additions & 0 deletions test/parallel/test-async-hooks-constructor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

// This tests that AsyncHooks throws an error if bad parameters are passed.

const common = require('../common');
const async_hooks = require('async_hooks');
const non_function = 10;

typeErrorForFunction('init');
typeErrorForFunction('before');
typeErrorForFunction('after');
typeErrorForFunction('destroy');
typeErrorForFunction('promiseResolve');

function typeErrorForFunction(functionName) {
common.expectsError(() => {
async_hooks.createHook({ [functionName]: non_function });
}, {
code: 'ERR_ASYNC_CALLBACK',
type: TypeError,
message: `hook.${functionName} must be a function`
});
}

0 comments on commit ed26d54

Please sign in to comment.