Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@ava/get-port

Experimental AVA plugin which works like get-port, but ensures the port is locked across all test files.

Install this as a development dependency alongside AVA itself:

npm install --save-dev @ava/get-port

Then make sure you've enabled the shared workers experiment:

ava.config.js:

export default {
  nonSemVerExperiments: {
    sharedWorkers: true
  }
};

Usage

const {default: getPort} = require('@ava/get-port');

test.before('get port', async t => {
  t.context.port = await getPort();
});

getPort() reserves a port, such that no other concurrently executing test file also using getPort() will select that same port. To ensure the port is available it then (briefly) listens. You can pass options used when listening. You can't pass port though.

About

Cooperative get-port implementation

Topics

Resources

Packages

No packages published
You can’t perform that action at this time.