Comparing version 1.0.0 to 1.0.1
10
index.js
@@ -24,9 +24,5 @@ 'use strict' | ||
function init (asyncId, type, triggerAsyncId, resource) { | ||
let stack = null | ||
try { | ||
throw Error() | ||
} catch (e) { | ||
stack = e.stack | ||
} | ||
cache.set(asyncId, {asyncId, type, stack}) | ||
const e = {} | ||
Error.captureStackTrace(e) | ||
cache.set(asyncId, {asyncId, type, stack: e.stack}) | ||
} | ||
@@ -33,0 +29,0 @@ |
{ | ||
"name": "blocked-at", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Detects node eventloop block and reports where it started", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# blocked-at | ||
# blocked-at [![Build Status](https://travis-ci.org/naugtur/blocked-at.svg?branch=master)](https://travis-ci.org/naugtur/blocked-at) | ||
@@ -3,0 +3,0 @@ Detects slow synchronous execution and reports where it started. |
@@ -8,2 +8,3 @@ 'use strict' | ||
const case4 = require('./cases/promise') | ||
const case5 = require('./cases/falsepositive') | ||
const assert = require('assert') | ||
@@ -22,2 +23,3 @@ | ||
setImmediate(case4) | ||
setImmediate(case5) | ||
@@ -28,3 +30,3 @@ setTimeout(_ => { | ||
assert(!stacks.includes('async_hooks.js'), 'Expected async_hooks.js traces not to be included') | ||
assert(stacks.includes('test/index.js:16'), 'Expected test/index.js:17 in stack trace') | ||
assert(stacks.includes('test/index.js:17'), 'Expected test/index.js:17 in stack trace') | ||
assert(stacks.includes('Server.connectionListener'), 'Expected Server.connectionListener in stack trace') | ||
@@ -34,3 +36,4 @@ assert(stacks.includes('cases/recursive.js:6'), 'Expected cases/recursive.js:6 in stack trace') | ||
assert(stacks.includes('cases/promise.js:9'), 'Expected cases/promise.js:10 in stack trace') | ||
assert(!stacks.includes('cases/falsepositive.js'), 'Expected falsepositive not to trigger a report') | ||
console.log('OK') | ||
}, 5000) // I know it's naive, but I don't want to add mess to test cases to know when they finish |
@@ -6,5 +6,5 @@ module.exports = function meSoSlow (time) { | ||
while (Date.now() < (t0 + time)) { | ||
'How many CPU cycles does it take to heat the room by 1 degree?'.split().join(':)') | ||
'How many CPU cycles does it take to heat the room by 1 degree?'.split('').join(':)') | ||
} | ||
console.timeEnd('slow') | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9821
14
168