0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/test/e2e/setup.js
Juan Picado 5b1264c733
feat: allow override user rate limit and user agent (#2803)
* feat: allow override user rate limit

- improve user_agent config allow string

* chore: fix tests

* chore: refactor userRateLimit

* chore: remove comment

* chore: optional prop

* chore: refactor limiter

* chore: refactor endpoints

* chore: fix undefined

* chore: fix params

* chore: fix params

* chore: update ui

* chore: refactor limiter

* chore: fix tests

* chore: fix test
2021-12-24 19:04:15 +01:00

17 lines
611 B
JavaScript

const fs = require('fs');
const os = require('os');
const path = require('path');
const { green } = require('kleur');
const puppeteer = require('puppeteer');
const mkdirp = require('mkdirp');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
module.exports = async function () {
// eslint-disable-next-line no-console
console.log(green('Setup Puppeteer'));
const browser = await puppeteer.launch({ headless: true, /* slowMo: 300 */ args: ['--no-sandbox'] });
global.__BROWSER__ = browser;
mkdirp.sync(DIR);
fs.writeFileSync(path.join(DIR, 'wsEndpoint'), browser.wsEndpoint());
};