mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
fe60eab99c
* test: enable e2e * test: improve setup * chore: update setup * test: publish on temp folder * chore: initial setup example * chore: add global install to pnpm * chore: update test script * test: add info command * chore: add install tests * chore: add debug enabled code * chore: update pnpm lock file
37 lines
928 B
TypeScript
37 lines
928 B
TypeScript
import os from 'os';
|
|
import path from 'path';
|
|
import buildDebug from 'debug';
|
|
import NodeEnvironment from 'jest-environment-node';
|
|
const fs = require('fs');
|
|
|
|
const __global = require('../utils/global');
|
|
|
|
const debug = buildDebug('verdaccio:e2e:env');
|
|
|
|
class E2ECliTestEnvironment extends NodeEnvironment {
|
|
constructor(config) {
|
|
super(config);
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
runScript(script): any {
|
|
return super.runScript(script);
|
|
}
|
|
}
|
|
|
|
export default E2ECliTestEnvironment;
|