Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
export class TestScript<a> extends Script {
name = 'test-script';
blueprint() {
// eslint-disable-next-line
return {} as $FixMe;
}
}
// Use core package since resources are located here
export const BEEMO_APP_PATH = Path.resolve('..', __dirname);
// Use a folder that should not cause issues / contain much code
export const BEEMO_TEST_ROOT = Path.resolve('../../../tests', __dirname);
export function mockTool(argv: Argv = []): Beemo {
const tool = new Beemo(argv, '', true);
Object.assign(tool.options, {
appName: 'beemo',
appPath: BEEMO_APP_PATH.path(),
root: BEEMO_TEST_ROOT.path(),
workspaceRoot: BEEMO_TEST_ROOT.path(),
});
tool.config = stubToolConfig({
configure: {
cleanup: false,
parallel: true,
},</a>
if (!module) {
throw new Error(this.msg('errors:moduleConfigMissing', { configName }));
}
// Allow for local development
if (module === '@local') {
this.debug('Using %s configuration module', chalk.yellow('@local'));
this.moduleRoot = new Path(process.cwd());
return this.moduleRoot;
}
// Reference a node module
const rootPath = Path.resolve(`node_modules/${module}`);
if (!rootPath.exists()) {
throw new Error(this.msg('errors:moduleMissing', { configName, module }));
}
this.debug('Found configuration module root path: %s', chalk.cyan(rootPath));
this.moduleRoot = rootPath;
return rootPath;
}
protected prepareContext(context: T): T {
context.argv = this.argv;
context.cwd = Path.resolve(this.options.root);
context.moduleRoot = this.getConfigModuleRoot();
context.workspaceRoot = Path.resolve(this.options.workspaceRoot || this.options.root);
context.workspaces = this.getWorkspacePaths({ root: context.workspaceRoot });
return context;
}
protected prepareContext(context: T): T {
context.argv = this.argv;
context.cwd = Path.resolve(this.options.root);
context.moduleRoot = this.getConfigModuleRoot();
context.workspaceRoot = Path.resolve(this.options.workspaceRoot || this.options.root);
context.workspaces = this.getWorkspacePaths({ root: context.workspaceRoot });
return context;
}