mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
29 lines
706 B
TypeScript
29 lines
706 B
TypeScript
|
const fs = require('fs');
|
||
|
import os from 'os';
|
||
|
import path from 'path';
|
||
|
import NodeEnvironment from 'jest-environment-node';
|
||
|
const __global = require('../utils/global');
|
||
|
// import { npm } from '../utils/process';
|
||
|
|
||
|
|
||
|
class PuppeteerEnvironment extends NodeEnvironment {
|
||
|
constructor(config) {
|
||
|
super(config)
|
||
|
}
|
||
|
|
||
|
async setup() {
|
||
|
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'verdaccio-suite-test-'));
|
||
|
__global.addItem('dir-root', tempRoot);
|
||
|
this.global.__namespace = __global;
|
||
|
console.log(`current directory: ${process.cwd()}`);
|
||
|
}
|
||
|
|
||
|
async teardown() {}
|
||
|
|
||
|
runScript(script) {
|
||
|
return super.runScript(script);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default PuppeteerEnvironment;
|