test: add check in test-signal-handler#8248
Conversation
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change.
| // Test on condition where a watcher for SIGNAL | ||
| // has been previously registered, and `process.listeners(SIGNAL).length === 1` | ||
| process.on('SIGHUP', function() {}); | ||
| process.on('SIGHUP', function() { common.fail('should not run'); }); |
There was a problem hiding this comment.
Wrap it with common.mustCall(), tho?
There was a problem hiding this comment.
If the function is called, the test has failed. It would be wrapped in a 'common.mustNotCall()' if we had one.
There was a problem hiding this comment.
I would simply make this
process.on('SIGHUP', common.fail)And just do without the should not run text.
There was a problem hiding this comment.
@jasnell Done that way, the AssertionError looks like this:
AssertionError: null undefined null
at process.exports.fail (/Users/trott/io.js/test/common.js:438:10)
at emitNone (events.js:91:20)
at process.emit (events.js:185:7)
at Signal.wrap.onsignal (internal/process.js:199:44)
There are two things I don't like about that:
- The stack trace does not show where the actual problem is. It does not mention the test file at all.
null undefined null: What?!
In contrast, done the way it is in this PR, it looks like this:
AssertionError: should not run
at Object.exports.fail (/Users/trott/io.js/test/common.js:438:10)
at process.<anonymous> (/Users/trott/io.js/test/parallel/test-signal-handler.js:32:42)
at emitNone (events.js:91:20)
at process.emit (events.js:185:7)
at Signal.wrap.onsignal (internal/process.js:199:44)
The stack trace includes the name of the test file and the line that resulted in the failure.
There was a problem hiding this comment.
null undefined null is going to be my new catchphrase... sigh.. looks like we should tweak the output for common.fail
|
LGTM |
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: nodejs#8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
Landed in a6d53c6 |
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: nodejs#8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: #8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: #8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: #8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: #8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Check that the removed listener is not called. * Opportunistic `==` -> `===` change. PR-URL: #8248 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
test process
Description of change
==->===change.