Jeff-Lewis / cls-hooked

cls-hooked : CLS using AsynWrap or async_hooks instead of async-listener for node 4.7+
BSD 2-Clause "Simplified" License
758 stars 89 forks source link

npm test failed on node 11 #40

Open devthejo opened 5 years ago

devthejo commented 5 years ago

Here is the complete log:

cls-hooked@4.2.2 test /home/jo/.dev/cls-hooked mocha test/.js & tap test/tap/.tap.js

cls simple async local context ✓ asynchronously propagating state with local-context

cls edges and regression testing + ! ✓ minimized test case that caused #6011 patch to fail

cls with http Agent when making two http requests test/tap/async-context.tap.js ......................... 2/2 test/tap/async-no-run-queue-multiple.tap.js + .! .. ✓ should retain context during first (255ms) ✓ should retain context during second (65ms)

cls with http connections client server ✓ server request event should be called ✓ server request event should receive data ✓ server request data event should be called ✓ server request data event should receive data ✓ client data event should be called ✓ client data event should receive data ✓ final context value should be 4919

multiple namespaces handles them correctly Namespace { name: 'ONE', active: { _ns_name: 'ONE', id: 191 }, _set: [ null ], id: 1, _contexts: Map { 191 => { _ns_name: 'ONE', id: 189, name: 'tom1' }, 192 => { _ns_name: 'ONE', id: 191 } }, _indent: 0 } true Namespace { name: 'TWO', active: { _ns_name: 'TWO', id: 189, name: 'paul2' }, _set: [ null ], id: 1, _contexts: Map { 191 => { _ns_name: 'TWO', id: 189, name: 'paul2' }, 192 => { _ns_name: 'TWO', id: 189, name: 'paul2' } }, _indent: 0 } true ✓ name tom1 ✓ name paul2 ✓ name bob ✓ name alice

cls namespace management ✓ name is required ✓ namespace is returned upon creation ✓ namespace lookup works ✓ allows resetting namespaces ✓ namespaces have been reset ✓ namespace is available from global ✓ destroying works ✓ namespace has been removed

cls with net connection ✓ value newContextValue 1) value newContextValue 2 ✓ value MONKEY ✓ value MONKEY 2

cls with net connection 2 2) client server

Promise context convention ✓ convention should be 3

27 passing (381ms) 2 failing

1) cls with net connection value newContextValue 2: AssertionError: expected undefined to exist at Assertion. (node_modules/chai/lib/chai/core/assertions.js:819:10) at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29) at Object.get () at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:86:22) at Object.should.exist (node_modules/chai/lib/chai/interface/should.js:129:34) at Context.it (test/net-events.test.js:81:12)

2) cls with net connection 2 client server: Uncaught AssertionError: state is still preserved: expected undefined to equal 4919 at Proxy.assertEqual (node_modules/chai/lib/chai/core/assertions.js:1014:12) at Proxy.methodWrapper (node_modules/chai/lib/chai/utils/addMethod.js:57:25) at Socket.OnServerSocketData (test/net-events2.test.js:31:46) at Socket.clsBind (context.js:172:17) at Socket.emitted [as emit] (node_modules/emitter-listener/listener.js:122:21) at addChunk (_stream_readable.js:288:12) at readableAddChunk (_stream_readable.js:269:11) at Socket.Readable.push (_stream_readable.js:224:10) at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:145:17)

test/tap/async-no-run-queue-multiple.tap.js ........... 3/3 test/tap/bind-emitter-multiple.tap.js ................. 6/6 test/tap/bind-emitter.tap.js ........................ 51/51 test/tap/bind.tap.js .................................. 6/6 test/tap/crypto.tap.js ................................ 3/3 test/tap/dns.tap.js ................................. 44/44 test/tap/error-handling.tap.js ...................... 17/17 test/tap/fs.tap.js .(node:9131) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. test/tap/fs.tap.js ................................ 174/175 continuation-local state with MakeCallback and fs module > fs.unlink not ok Callback must be a function stack: | test/tap/fs.tap.js:471:22 at: line: 133 column: 9 file: fs.js function: maybeCallback type: 'TypeError [ERR_INVALID_CALLBACK]' test: fs.unlink

test/tap/interleave-contexts.tap.js ................. 10/10 test/tap/namespaces-multiple-values.tap.js ............ 4/4 test/tap/namespaces.tap.js ............................ 8/8 test/tap/nesting.tap.js ............................. 18/18 test/tap/net-events.tap.js ............................ 3/4 continuation-local state with net connection not ok state is still preserved +++ found
--- wanted
-"newContextValue"
+[null]
compare: === at: line: 21 column: 13 file: test/tap/net-events.tap.js type: Socket stack: | Socket. (test/tap/net-events.tap.js:21:13) source: | t.equal(namespace.get('test'), 'newContextValue', 'state is still preserved');

test/tap/promises.tap.js ............................ 16/16 test/tap/proper-exit.tap.js ........................... 0/1 Skipped: 1 proper exit on uncaughtException

test/tap/run-and-return.tap.js ........................ 7/7 test/tap/simple.tap.js ................................ 6/6 test/tap/timers.tap.js ................................ 8/8 test/tap/tracer-scenarios.tap.js .................... 71/71 test/tap/zlib.tap.js (node:9491) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. test/tap/zlib.tap.js .................................. 1/1 total ............................................. 458/461

458 passing (6s) 1 pending 2 failing

npm ERR! Test failed. See above for more details.

matthewadams commented 5 years ago

@Jeff-Lewis I currently need to use cls-hooks on Node 11 (in order to use worker threads for CPU-intensive calculations), so this might be a problem. I see no commits since Jul 2017, leading me to wonder whether this package is still actively maintained, whether it's been superceded by something else, or whether it's achieved such stability that it hasn't needed maintenance until this issue.

Can you please advise? Thanks!

Jeff-Lewis commented 5 years ago

I could use some help, but the one known issue with cls-hooks has not been ignored. I've been waited (for a while) for resolution on these tests failures to make the next release. I was hoping Node would fix the issue but instead I've been working on a workaround recently. See #36 for details.

Jeff-Lewis commented 5 years ago

As for node 11 and worker threads, I have not touched that yet... If you have some sample code that I could convert into some test cases, that would speed up the dev time.