Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: show actual assertion error message with value
on process exit if some assertion error occurs value of `process._exiting`
was hidden, this fix will show the actual error message with value
  • Loading branch information
thatshailesh committed May 28, 2018
commit a47e4a3f0164da61f261471bee8222a448a50aaa
9 changes: 4 additions & 5 deletions test/parallel/test-next-tick-when-exiting.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict';

require('../common');
const common = require('../common');
const assert = require('assert');

process.on('exit', () => {
assert.strictEqual(process._exiting, true, 'process._exiting was not set!');
// process._exiting was not set!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think the comment is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Actually this is my first PR, and not sure why windows test failed

I am a mac user, is there anything I can do to fix it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure is unrelated, don't worry about that.

assert.strictEqual(process._exiting, true);

process.nextTick(() => {
assert.fail('process is exiting, should not be called.');
});
process.nextTick(common.mustNotCall());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?:

process.nextTick(common.mustNotCall('process is exiting, should not be called'));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

});

process.exit();