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) {
|
2021-03-14 02:42:46 -05:00
|
|
|
super(config);
|
2019-12-15 02:52:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
async setup() {
|
2021-03-14 02:42:46 -05:00
|
|
|
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() {}
|
|
|
|
|
2020-04-09 04:09:30 -05:00
|
|
|
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;
|