Skip to content

designeng/jest-worker-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jest-worker plugin for wire.js

Installation

npm i jest-worker-plugin

Usage

Install wire from git://github.com/cujojs/wire.git#0.10.11

const wire = require('wire');
const JestWorkerPlugin = require('jest-worker-plugin');

wire({
    $plugins: [
        JestWorkerPlugin
    ],

    worker: {
        createJestWorker: {
            workerPath: __dirname + '/workers/index.js',
            workerOptions: {
                exposedMethods: [
                    'init',
                    'calculate'
                ],
                numWorkers: 4,
                maxRetries: 10,
                forkOptions: {
                    silent: false
                }
            },
            additionalOptions: {
                initImmediately: true
            }
        }
    },

    result: {
        create: {
            module: (worker) => {
                return worker.calculate(8)
            },
            args: [
                {$ref: 'worker'}
            ]
        }
    }
})

Run benchmarks

Run with workers and with simple Promise.all npm run benchmark

About

jest-worker-plugin for wire.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published