-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjest.setup.js
More file actions
27 lines (23 loc) · 834 Bytes
/
jest.setup.js
File metadata and controls
27 lines (23 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require('fs');
const { Localchain } = require('@argonprotocol/localchain');
const rmSync = 'rmSync' in fs ? 'rmSync' : 'rmdirSync';
// eslint-disable-next-line import/no-extraneous-dependencies
const CertificateManager =
require('@ulixee/unblocked-agent-mitm-socket/lib/CertificateGenerator').default;
module.exports = async () => {
try {
fs[rmSync](`${__dirname}/.data-test`, { recursive: true });
fs.mkdirSync(`${__dirname}/.data-test`);
// generate base certs
const certManager = new CertificateManager({
storageDir: `${__dirname}/.data-test`,
});
await certManager.waitForConnected;
certManager.close();
if (process.env.ULX_DATA_DIR) {
Localchain.setDefaultDir(Path.join(process.env.ULX_DATA_DIR, 'argon', 'localchain'));
}
} catch (err) {
// ignore
}
};