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: nodejs#25401
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and BridgeAR committed Jan 16, 2019
1 parent d5fcb0f commit 8532e48
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 8532e48

Please sign in to comment.