Skip to content

Commit

Permalink
test,worker: refactor test-worker-cleanup-handles
Browse files Browse the repository at this point in the history
* alphabetize require() statements for built-in modules by module name
* remove unused function argument `code` in callback
* replace common.expectsError() with assert.throws()
* remove unneeded line-wrap

PR-URL: #25401
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Jan 14, 2019
1 parent 82fc9a8 commit a6df727
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-worker-cleanup-handles.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';
const common = require('../common');

const assert = require('assert');
const { Worker, isMainThread, parentPort } = require('worker_threads');
const { Server } = require('net');
const fs = require('fs');
const { Server } = require('net');
const { Worker, isMainThread, parentPort } = require('worker_threads');

if (isMainThread) {
const w = new Worker(__filename);
Expand All @@ -12,14 +13,13 @@ if (isMainThread) {
assert.strictEqual(typeof fd_, 'number');
fd = fd_;
}));
w.on('exit', common.mustCall((code) => {
w.on('exit', common.mustCall(() => {
if (fd === -1) {
// This happens when server sockets don’t have file descriptors,
// i.e. on Windows.
return;
}
common.expectsError(() => fs.fstatSync(fd),
{ code: 'EBADF' });
assert.throws(() => fs.fstatSync(fd), { code: 'EBADF' });
}));
} else {
const server = new Server();
Expand Down

0 comments on commit a6df727

Please sign in to comment.