0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/test/e2e-cli/setup/test_environment.ts
Behrang Yarahmadi 13310814da
#2606 add prettier plugin sort imports (#2607)
* #2606 add prettier plugin sort imprts

* #2606 update pnpm-lock.yaml

* #2606 update eslint rules

* #2606 fixes website directory formatting

Co-authored-by: Ayush Sharma <ayush.sharma@trivago.com>
2021-10-29 17:33:05 +02:00

38 lines
943 B
TypeScript

import buildDebug from 'debug';
import NodeEnvironment from 'jest-environment-node';
import os from 'os';
import path from 'path';
const fs = require('fs');
const __global = require('../utils/global');
const debug = buildDebug('verdaccio:e2e:env');
class E2ECliTestEnvironment extends NodeEnvironment {
constructor(config) {
super(config);
}
public async setup() {
// create an unique suite location peer test to avoid conflicts
const tempRoot = fs.mkdtempSync(
path.join(fs.realpathSync(os.tmpdir()), 'verdaccio-suite-test-')
);
debug('suite temporary folder %o', tempRoot);
__global.addItem('dir-suite-root', tempRoot);
// @ts-ignore
this.global.__namespace = __global;
debug(`current directory: ${process.cwd()}`);
}
async teardown() {
// TODO: clean folder
}
public runScript(script): any {
return super.runScript(script);
}
}
export default E2ECliTestEnvironment;