From 8532e48f001a9dfe57e14a4e11af5efe689b1510 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 8 Jan 2019 14:42:26 -0800 Subject: [PATCH] test,worker: refactor test-worker-cleanup-handles * 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: https://github.com/nodejs/node/pull/25401 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-worker-cleanup-handles.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-worker-cleanup-handles.js b/test/parallel/test-worker-cleanup-handles.js index 855e581eee5b3a..0ed3c747807b30 100644 --- a/test/parallel/test-worker-cleanup-handles.js +++ b/test/parallel/test-worker-cleanup-handles.js @@ -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); @@ -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();