0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/e2e-cli/setup/test_environment.ts

29 lines
682 B
TypeScript
Raw Normal View History

2019-12-15 02:52:55 -05:00
const fs = require('fs');
import os from 'os';
import path from 'path';
import NodeEnvironment from 'jest-environment-node';
const __global = require('../utils/global');
2019-12-15 11:18:40 -05:00
class E2ECliTestEnvironment extends NodeEnvironment {
2019-12-15 02:52:55 -05:00
constructor(config) {
super(config);
2019-12-15 02:52:55 -05:00
}
async setup() {
const tempRoot = fs.mkdtempSync(
path.join(fs.realpathSync(os.tmpdir()), 'verdaccio-suite-test-')
);
2019-12-15 02:52:55 -05:00
__global.addItem('dir-root', tempRoot);
this.global.__namespace = __global;
console.log(`current directory: ${process.cwd()}`);
}
async teardown() {}
runScript(script): any {
2019-12-15 02:52:55 -05:00
return super.runScript(script);
}
}
2019-12-15 11:18:40 -05:00
export default E2ECliTestEnvironment;