refactor: convert to ESM benchmarks code
[poolifier.git] / benchmarks / benchmarks-utils.mjs
similarity index 95%
rename from benchmarks/benchmarks-utils.js
rename to benchmarks/benchmarks-utils.mjs
index 6195a983c3fe98da9e8f68e06dbc96818773c1fc..45e8cc0ea5882ae0804664d8f25e88f7265f6fe8 100644 (file)
@@ -1,16 +1,12 @@
-const crypto = require('crypto')
-const fs = require('fs')
-const {
+import crypto from 'crypto'
+import fs from 'fs'
+import {
   DynamicClusterPool,
   DynamicThreadPool,
   FixedClusterPool,
   FixedThreadPool
-} = require('../lib')
-const {
-  PoolTypes,
-  WorkerFunctions,
-  WorkerTypes
-} = require('./benchmarks-types')
+} from '../lib/index.mjs'
+import { PoolTypes, WorkerFunctions, WorkerTypes } from './benchmarks-types.mjs'
 
 async function runTest (pool, { taskExecutions, workerData }) {
   return new Promise((resolve, reject) => {
@@ -151,7 +147,7 @@ function buildPool (workerType, poolType, poolSize, poolOptions) {
   }
 }
 
-module.exports = {
+export {
   WorkerFunctions,
   buildPool,
   executeWorkerFunction,