From 5ca20e3f406823327abf377dcb5d1e75c4949773 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 8 Jan 2019 14:42:26 -0800 Subject: [PATCH] test,worker_threads: 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 --- 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 2fd11398da07b7..e04aeb75577e44 100644 --- a/test/parallel/test-worker-cleanup-handles.js +++ b/test/parallel/test-worker-cleanup-handles.js @@ -1,10 +1,11 @@ // Flags: --experimental-worker '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); @@ -13,14 +14,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();